In Linux, there are commands dedicated to UUID generation: Uuidgen [-r] [-t]. A 32-bit string can be generated. This is obtained in the command line. There is a/uuid. h in/usr/include/lib, which defines the data uuid and the unsigned character pointer. Uuid_generate (uuid_t uu) is a function dedicated to UUID generation. The UUID generated is placed in the parameter UU. The result is an 8-digit hexadecimal number. During the UUID generation function, after some processing, the 8-bit hexadecimal number is generated. The reason is that during the generation process, originally, a 32-bit long integer is generated. The result is converted to an 8-bit hexadecimal number through uid_parse. Instead, we have the uuid_unparse function, which can reverse convert the hexadecimal number to a 32-bit integer. Note: When compiling uuid functions in linux, we need to connect the database, that is, add a-luuid. Full Form: Gcc-o uuid. c-luuid At the same time, we need to allocate space reasonably when defining the 32-bit long integer string for saving the transformation. The most insecure way is to apply for a pointer to store one character, so do not avoid doing so! |