Security is the foundation of modern cryptography confidentiality of the key, rather than classical cryptography algorithm that based on confidentiality
md5
md5 full version called a message digest algorithm 5 (Message Digest Algorithm 5), a hash algorithm
md5 is to no matter what the length of the text, to streamline into a 128-bit hash number
A MD5 value corresponds to an infinite number of the original value, which is a natural defect
Now to break the md5 algorithm, in essence, check rainbow table
Deposit much better in advance common passwords md5 value, then reverse lookup, to give the corresponding original
Originally brute force can not be cracked, however, if the direct use of the characters entered by the user MD5, it is not the same. The user may input combination of characters with respect to the random combination of characters is very centralized, that is, in fact, very low entropy: for example, some password combination will be used by many people, such as 123456, password, etc.
In cryptography, DES and RSA encryption is the real, and more MD5 checksum used on a document, whether a key used to generate the document has been tampered with is detected
Commonly used hash functions, SHA-256, SHA-512 will be more secure than md5, harder to break
With salt
To protect the user's password, early people use the MD5 algorithm to the password stored encrypted, will add a "salt value" (i.e., a fixed secret string) is usually calculated MD5 value, this salt value may be shared (fixed salt), and a user may be a salt value (random salt)
Inventory data on salt and hash, every time a user registration, randomly generated salt,hash = md5(password + salt)
When login authentication md5(input + salt)and hash are equal to
Salt value may even be disclosed
Hashing algorithm always been irreversible, just to add salt to prevent rainbow table attacks
For example, I salt is a string of random characters nizhendehaoshuaia. In this case, the rainbow tables useless
Because the rainbow table is calculated in advance, then I want to let you have this rainbow table, I have to md5 (nizhendehaoshuaia + register all possible passwords "), this whole thing worked out first.
However, the attacker can not count again for each salt rainbow tables, which just not worth it
The best salt for each account are not the same
If you have only one salt, then he counted just once, will be able to counter-check all your accounts
Salt can assure you that is not directly affected by pegging rainbow table attacks, but people want to force blasting a password, or can
For example, I'm going to blast md5 (helloword + nizhendehaoshuaia) this, it can be directly brute force
So those calculations need to slow hash function, so that others exhaustive calculation that takes a long time to give up
For example SHA-256, SHA-512such as hash functions, so they are more secure than md5
To further prevent dictionary attacks, you can add a pepper in the application server
Pepper is a plus, a string of random string on the application server, and then added to the hash code before and behind salt