Base64UID vs UUID?

I do not quite understand the code as in the second and first cases


What's the code more reliable? What will generate 101% unique values?

To generate lightweight unique key.
June 8th 19 at 16:29
1 answer
June 8th 19 at 16:31
Today there are five versions of UUIDs .

V1 is based on the time stamp key generation and MAC address of the device
V2 reserved for standard security DCE. Itself its specification in the standard UUID is not described, therefore, usually refer to the specification DCE 1.1

V3 is based on the timestamp of generation of the key and a md5-hash of alias to namespace.
V4 is based on the value of the pseudorandom values. Although, it slightly increases the range of values, and eliminates the ability to uniquely identify the place of origin of the key, this also raises the probability of collisions, especially for those cases when the generator of pseudo-random values is not enough "powerful". For this reason, it is recommended to use a common "source" while generating random values in distributed systems.

V5, same as v3 but as the hash uses sha1, which greatly increases the complexity of identifying the origin key.

Which version of key to use - the choice is yours. If it is not a distributed system and the keys are generated in one place, I would prefer v4.

With regard to specific implementations, in the world of php implementation from Ramsey - is considered a de facto standard.
thank you, and please tell me why Ramsey?) - jaycee commented on June 8th 19 at 16:34

Find more questions by tags PHP