The UUID is a 128-bit globally unique identifier (Univeral unique identifier), typically expressed in the form of a 32-bit string. Sometimes also called a GUID (Global unique identifier). Python has its own UUID module for the generation and management of UUID. (It is unclear from which version.) )
The UUID module in Python is based on the UUID of information such as MAC address, timestamp, namespace, random number, pseudo-random number. There are several ways to do this:
UUID.UUID1 () generates a unique UUID based on MAC address, timestamp, and random number to guarantee uniqueness worldwide.
The UUID.UUID2 () algorithm is the same as UUID1, and the difference is that the first 4 bits of the timestamp are replaced with the POSIX UID. However, it is important to note that there is no DCE-based algorithm in Python, so there is no uuid2 this method in Python's UUID module.
UUID.UUID3 (namespace,name) gives a UUID by calculating the MD5 hash value of a namespace and a name, so that different names in the namespace have different uuid, but the same name is the same UUID. "Thank you," commented the big guy. "Namespace is not a string or other amount that you manually specify, but some of the values given in the UUID module itself. Like the UUID. Namespace_dns,uuid. Namespace_oid,uuid. Namespace_oid these values. The values themselves are UUID objects, which are calculated according to certain rules.
Uuid.uuid4 () The UUID is obtained by pseudo-random number, there is a certain probability repetition
UUID.UUID5 (Namespace,name) and UUID3 are basically the same, except that the hashing algorithm used is SHA1
Python module python UUID module