NOTE
1.3 Hash
Hashing converts a byte string into a digest. These notes begin with its one-way nature, compare hashing with encryption, and record algorithms such as MD5 and SHA.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is a Hash
Hashing is an irreversible string transformation algorithm that converts a byte string of arbitrary length into a large integer.
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 large 128-bit integer. It is an irreversible string transformation algorithm.
3.2. SHA256
4. References
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub