"About MD5 is not enough" 50,000 data, MD5 began to appear duplicated! Doubts

Source: Internet
Author: User
"About MD5 is enough" 50,000 data, MD5 began to appear duplicates! Doubts
database table pre_post, field ID auto increment, primary key. Field MD5 unique.

The value of the Start field MD5 is $MD 5=md5 (Time (). $ip);
It was later changed to only $MD 5=md5 (Time ()), and then every thousands of writes would appear MD5 duplicates, #1062:

#1062-duplicate entry ' dbecd780b5f02c35f236ac0f4766c634 ' for key ' MD5 '



The original MD5 generated, $IP client IP for the guest
$MD 5 = MD5 (Time (). $ip);

Now the MD5 is generated, only according to the current timestamp
$MD 5 = MD5 (time ());


One question: The first time period of encryption is from The Times (). $ip, the second time () is modified. As a result, there is no possibility of duplication, and the resulting MD5 will not be duplicated. But the second generation of MD5 is the same as the MD5 generated in the first phase, and repeats several times every few 1000 times. Very confused


------Solution--------------------
Microtime ()
  • 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.