How can someone say that md5 is used to generate a unique id?

Source: Internet
Author: User
Tags cryptographically secure
How can someone say that md5 is used to generate a unique id? Because the system time is used, the IDS generated by this function are not optimal. To generate an absolutely unique ID, use the md5 () function (please refer to the string function reference ). Someone recommends md5 (uniqid (rand (), true). how can someone say that md5 is used to generate a unique id?
Because the system time is used, the IDS generated by this function are not optimal. To generate an absolutely unique ID, use the md5 () function (please refer to the string function reference ).

Md5 (uniqid (rand (), true) is recommended.

If uniqid cannot be repeated, does md5 have no effect? Because md5 depends on input, it has nothing to do with whether it is unique or not.

------ Solution --------------------
Your understanding is correct.

There is such a comment on the manual, which looks similar but has different meanings: (hmmm, this Chinese version of the manual is lagging behind, without this section)

This function does not generate cryptographically secure tokens, in fact without being passed any additional parameters the return value is little different from microtime (). if you need to generate cryptographically secure tokens use openssl_random_pseudo do_bytes ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.