Python official Doc: 20.15. uuid-UUID objects according to RFC 4122 UUID algorithm Introduction: A Universally Unique IDentifier (UUID) URN Namespace Overview: UUID is A 128-bit globally Unique IDentifier, it is usually represented by a 32-byte string. It can ensure the uniqueness of time and space, also known as GUID, all called: UUID -- Universally Unique IDentifier in Python uuid guid -- Globally Unique IDentifier C # is called GUID. It guarantees the uniqueness of the generated ID through MAC address, timestamp, namespace, random number, and pseudo-random number.. UUID consists of five algorithms: 1. uuid1 (), which is generated by MAC address, current timestamp, and random number based on the timestamp. Global uniqueness can be guaranteed. However, MAC security issues are also caused by the use of MAC. IP addresses can be used in LAN to replace MAC. 2. uuid2 ()-based on the distributed computing environment DCE (this function is not available in Python), the algorithm is the same as uid1. The difference is to replace the first four positions of the timestamp with the posix uid. This method is rarely used in practice. 3. uuid3 () -- name-based MD5 hash value is obtained by calculating the name and namespace MD5 hash value, ensuring the uniqueness of different names in the same namespace, and the uniqueness of different namespaces, but the same name of the same namespace generates the same uuid. 4. uuid4 ()-a random number is obtained from a pseudo-random number with a certain repetition probability. This probability can be calculated. 5. uuid5 () -- the name-based SHA-1 Hash value Algorithm is the same as that of uuid3. The difference is that the Secure Hash Algorithm 1 Algorithm is used. First, Python does not have a DCE-based Algorithm, therefore, uuid2 can be ignored. Second, uuid4 is probabilistic and repetitive. It is recommended that uuid1 be used in a Global distributed computing environment, uuid3 or uuid5. Encoding method: #-*-coding: UTF-8-*-import uuid name = "test_name" namespace = "test_namespace" print uuid. uuid1 () # For methods with parameters, see Python Doc print uuid. uuid3 (namespace, name) print uuid. uuid4 () print uuid. uuid5 (namespace, name)