Some people often ask, what is the difference between CRC, MD5, and sha1 when calculating a verification value? I hope the descriptions below will give you an understanding.
Similarities:
CRC, MD5, and sha1 are calculated to generate a verification value, which is used to verify data integrity.
Differences:
1.AlgorithmDifferent. CRC adopts polynomial Division, while MD5 and sha1 use replacement, rotation, and other methods;
2. The length of the check value is different. The length of the CRC check bit is related to its polynomial, generally 16 or 32 bits; MD5 is 16 bytes (128 bits); sha1 is 20 bytes (160 bits );
3. Different checksum names are used. CRC is generally called the CRC value; MD5 and sha1 are generally called the hash value or hash value;
4. Security is different. The security here refers to the ability to detect errors, that is, data errors can be detected by the check bit. The security of CRC is closely related to polynomial, which is much weaker than MD5 and sha1. MD5 is highly secure, but it was cracked by Wang Xiaoyun of Shandong University in; sha1 has the highest security.
5. The efficiency is different, and the CRC calculation efficiency is very high; MD5 and sha1 are slow.
6. Different purposes. CRC is generally used for verification of communication data; MD5 and sha1 are used for security, such as file verification and digital signature.
I will explain security-related knowledge one by one later.