Hash algorithm mainly uses:
1) file verification
We are familiar with parity and CRC. Neither of these checks has the ability to resist data tampering. They can detect and correct channel errors in data transmission to a certain extent, but they cannot prevent malicious destruction of data.
The "digital fingerprint" feature of md5 hash algorithm makes it the most widely used file integrity checksum algorithm at present, and many Unix systems provide commands to calculate MD5 checksum.
2) Digital signature
Hash algorithm is also an important part of modern cryptography. Because of the slow operation speed of asymmetric algorithm, one-way hash function plays an important role in digital signature protocol. Digitally signing the hash value, also known as "digital digest", can be considered as equivalent to digitally signing the file itself. There are other benefits to such an agreement.
3) Authentication protocol
The following authentication protocol is also called "challenge authentication mode": when the transmission channel can be intercepted but cannot be tampered with, it is a simple and safe method.
The steps of digital signature and data verification are as follows:
Signature in PKCS 1 and PKCS7 standard formats:
1.PKCS 1 signature: i.e. naked signature, and the signature value only contains signature information.
2.PKCS7 signature: The signature can contain other additional information, such as signature certificate information, original signature information, timestamp information, etc.
Digital signature of PKCS7 by attachment and separation;
1. The attachment mode is to put the signature content and the original text together and package them into PKCS7 format. There is a paragraph in the structure of PKCS7 that can be put into plaintext, but plaintext must be encoded with ASN. 1 When verifying a digital signature, extract plaintext. The plain text here is actually a summary of the real content.
2. The PKCS7 format package packaged in separated mode does not contain plaintext information. Therefore, when verifying, you still need to pass plaintext to verify successfully. Similarly, the plain text here is actually a summary of the real content.