NOTE

1.3 Hash

Hash concepts, properties, use cases, MD5, and SHA-256.

SecurityCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is a Hash

Transform a byte string of arbitrary length into a large integer. It is an irreversible string transformation algorithm.

1.1. Hash vs Encryption

  • Hashing is one-way, while encryption is two-way.
  • Hashes may collide, while encryption does not.
  • Hashing is used to prevent data tampering, while encryption is used to prevent data leakage.
    • Leakage and tampering are not the same thing: for example, if I arbitrarily change several characters in a piece of ciphertext, decryption can still be performed.

2. Hash Properties

Integrity.

2.1. Hash Use Cases

  • Message authentication codes
  • Digital signatures When a private key signs a file, it does not sign the file contents directly; it signs the file’s hash value.

3. Types of Hash Functions

3.1. MD5

MD5 transforms a byte string of arbitrary length into a 128-bit large integer. It is an irreversible string transformation algorithm.

3.2. SHA256

4. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub