Why is MD5'ing a UUID not a good idea?

前端 未结 6 852
挽巷
挽巷 2021-01-31 18:33

PHP has a uniqid() function which generates a UUID of sorts.

In the usage examples, it shows the following:

$token = md5(uniqid());

But in t

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 18:49

    MD5ing a UUID is pointless because UUIDs are already unique and fixed length (short), properties that are some of the reasons that people often use MD5 to begin with. So I suppose it depends on what you plan on doing with the UUID, but in general a UUID has the same properties as some data that has been MD5'd, so why do both?

提交回复
热议问题