A few days ago, I found that I had a little vague concept of signature algorithm and summary algorithm, so I made a summary here and recalled it and found that I was also vague about these two concepts during the interview before.
Summary Algorithm
Purpose of the abstract
- Verify the integrity of the message
How to achieve this goal?
Essentially we use the Hash function, for example:
x is the original message
h(x) is the summary obtained through the hash function
Usually we use the properties of the Hash function to achieve it, that is, weak collision and the probability of collision are extremely low to ensure the completeness of the original information.
The hash function of the scene
Same and difference with verification code
same:
- All are to detect certain modifications in the data
the difference:
- The probability of verification code collision is greater than that of the digest algorithm
- Some verification code algorithms are reversible, that is, they have certain error correction functions.
Signature Algorithm
Purpose of signature
To enable others to identify the signature
How to achieve it?
Usually asymmetric keys are used
- Encrypt the corresponding information with a private key (usually an encrypted digest, because encrypting a large amount of data is slow, and some algorithm implementations may also have limitations on the size of the plaintext)
- Let others get the corresponding encrypted messages
- At the same time, our public key is exposed
- When the results obtained by using public key decryption are consistent with the expected results, the signer can be determined, and then whether the data source is trustworthy