About the storage of passwords in the database

Source: Internet
Author: User
Tags sha1 hash

Many systems are stored in the database after a MD5 or SHA1 hash of the password. Such a password cannot withstand a dictionary attack. The so-called dictionary attack, is to use the common password hash after making a dictionary, crack, only need to look up the dictionary to know the corresponding plaintext password.

To protect against dictionary attacks, it is recommended to use a password + salt (a bunch of random numbers) to hash the method. Each password corresponds to a different random number. This method, in effect, artificially expands the password to n bits, resulting in a large increase in the length of the password, which makes it impossible for an attacker to construct such a large dictionary.

Password + random string to save the password must not be cracked it? There must be two columns in the database table, one column holds the random string, and the other column holds the password + the hash value of the random string. What happens if an attacker gets the database? He can build a dictionary of each password, and then look up the dictionary hack. In fact, the dictionary constructed to crack a password is not very large, as is the case with random strings! But this dictionary is a one-time dictionary.

It is not impossible to break every password by constructing a dictionary, albeit slowly.

As a result, the ultimate solution is to return to the limit password minimum length and use complex passwords.

About the storage of passwords in the database

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.