HASH value practical learning

Today I’ll write a short article, it’s worth the hash. I have read the ppt in class dozens of times, but this is the first time I have tried it.

Hash value introduction and function

When we were studying network security courses, we learned about the encryption method of hash value. His characteristics are as follows:

  • Forward fast: Given plaintext and Hash algorithm, the Hash value can be calculated within limited time and limited resources.

  • Reverse difficulty: Given a Hash value, it is difficult to reverse the plaintext within a limited time.

  • Input sensitivity: If the original input information changes, the new Hash value should change greatly.

  • Conflict avoidance: It is difficult to find two pieces of plaintext with different contents so that their hash values ​​are consistent.

It has the following functions:

  1. Used to verify file integrity (the file to be downloaded has a hash value, and if the hash value of the downloaded file is the same, it means that the downloaded file is complete. The advantage is that a particularly large file does not need to be verified every byte Once, you only need to calculate the hash value once and compare the fixed-length string).
  2. Verify password (when your password is saved on the server, it is an encrypted hash value. Operation and maintenance personnel cannot see the password. Every time you enter the password for verification, the hash value calculated by entering the password is compared with the background hash value. Yes, if they are the same, you can log in correctly. During the d&b period of elementary school, I saw that several students tried to use hash values ​​to save user passwords).
  3. Digital signature (send encrypted data. The sender sends the hash value of the data and the digital signature encrypted by the private key, and the receiver uses the other party's public key to decrypt the digital signature and then calculates the hash value to verify the file).

Apply try

I tried it when I downloaded pycharm today.

1701413391472

SHA256 is one of the hash algorithms, along with MD5 and SHA1, both of which are relatively less secure.

After downloading the file, Windows calculates the hash value:

1701413491378

The sha hash values ​​are exactly the same.

By the way, try the linux calculation method.

1701413676806

A few days ago, I also learned a way to check the actual storage size of the purchased SD card: write the image, calculate the image hash value in the SD and the original image hash value and compare them.

Guess you like

Origin blog.csdn.net/jtwqwq/article/details/134735280