1. Key hashing
Use MD5 or SHA1 and other hashing algorithms to encrypt plain text. Strictly speaking, MD5 is not an encryption algorithm, but a digest algorithm. No matter how long the input is, MD5 will output a 128-bit (16-byte) hash value. SHA1 is also a popular message digest algorithm that generates a 160-bit (20-byte) hash value called a message digest. Compared with SHA1, MD5 is less secure but faster; SHA1 is more secure than MD5 but slower.
2. Symmetric encryption
Using the encryption method of a single-key cryptosystem, the same key can be used for encryption and decryption of information at the same time. This encryption method is called symmetric encryption. Commonly used algorithms in symmetric encryption algorithms include: DES, 3DES, TDEA, Blowfish, RC2, RC4, RC5, IDEA, SKIPJACK, etc.
3. Asymmetric encryption
The asymmetric encryption algorithm is a key secret method. It requires two keys for encryption and decryption. These two keys are Public key and private key. The public key and the private key are a pair. If the public key is used to encrypt data, it can only be decrypted with the corresponding private key. Asymmetric encryption algorithms include: RSA, Elgamal, backpack algorithm, Rabin, D-H, ECC (elliptic curve encryption algorithm).
4. Digital signature
Digital signature (also known as public key digital signature) is a digital string that can only be generated by the sender of the information and cannot be forged by others. This digital string is also It is also an effective proof of the authenticity of the information sent by the sender of the information. It is a method of authenticating digital information similar to an ordinary physical signature written on paper, but implemented using technology in the field of public key encryption.
5. Directly save in clear text
In the early days, there were many such practices. For example, if the password set by the user is "123", "123" is directly saved into the database. This is the most common method. The simple way to save is also the most unsafe way. But in fact, many Internet companies may adopt this approach.
6. Use one-way HASH algorithms such as MD5 and SHA1 to protect passwords
After using these algorithms, the original password cannot be restored through calculation, and the implementation is relatively simple, so many Internet companies Using this method to save user passwords used to be a relatively safe method. However, with the rise of rainbow table technology, rainbow tables can be created for table lookup and cracking. Currently, this method is no longer safe.
7. Special one-way HASH algorithm
Since the one-way HASH algorithm is no longer safe in protecting passwords, some companies have added salt and Multiple HASH and other extensions, these methods can increase the difficulty of cracking to a certain extent. For the HASH algorithm with a "fixed salt", it is necessary to protect the "salt" from being leaked, which will encounter the same problem as "protecting the symmetric key" , once the "salt" is leaked, the rainbow table can be re-established based on the "salt" for cracking. For multiple HASH, it only increases the cracking time, and there is no essential improvement.
8. PBKDF2
The principle of this algorithm is roughly equivalent to adding random salt to the HASH algorithm and performing multiple HASH operations. The random salt greatly increases the difficulty of creating a rainbow table. , and multiple HASHs also greatly increase the difficulty of table creation and cracking.
9. BCrypt
BCrypt was created in 1999, and is better than PBKDF2 in fighting GPU/ASIC, but I still do not recommend you to use it in new systems. Because it does not perform prominently in the threat model analysis of offline cracking. ?
10. SCrypt
SCrypt is a better choice today: better designed than BCrypt (especially regarding memory) and has been working in this field for 10 years . On the other hand, it is also used in many cryptocurrencies, and we have some hardware (including FPGAs and ASICs) that can implement it. Although they are used specifically for mining, they can also be repurposed for cracking.