Homeglossary

Hashing

Hashing is a software technique that converts data of any length into a fixed-size value called a hash. A hash is a repeatable digital fingerprint used for efficient data lookup, file integrity checks, and password protection. Its meaning and safe implementation differ between hash tables and cryptographic security.

Build secure apps with Emergent.

What Is Hashing?

Hashing converts data of any length into a fixed-size value called a hash. A hash function creates this repeatable digital fingerprint, also called a hash value or digest, for lookup, comparison, and security tasks. The same input produces the same output, but hashes are not guaranteed to be unique. Hashing is not encryption and cannot practically recover original data.

How Hashing Works

A program applies a hash function and uses the result for comparison or retrieval.

  1. Provide input, such as a password, username, or downloaded file.
  2. Run it through a hash function to create fixed-size output.
  3. Store or compare the hash instead of repeatedly processing the full input.
  4. For example, compare a downloaded file's hash with the publisher's expected hash to detect changes. In cryptographic hashing, one changed character produces a dramatically different result, called the avalanche effect.

Hash Tables vs. Cryptographic Hashing

These uses share a name but solve different problems.

AreaHash tablesCryptographic hashing
Primary goalFast key-based lookupIntegrity and security
Desired propertiesSpeed and even distributionHard to predict or manipulate
CollisionsHandled with buckets or probingMust be extremely difficult to create
Typical useCaches and dictionariesFile checks and signatures

A fast hash table function is not suitable for password storage because attackers can test guesses quickly.

Common Uses of Hashing in Software

Hashing supports performance and security.

  • Hash maps and caches find values by key efficiently.
  • File and download checks verify data has not changed in transit.
  • Password systems verify submitted passwords without storing them in plain text.
  • Digital signatures hash content before signing it, but hashing does not replace encryption.
  • Version-control systems identify content by its hash.
  • Duplicate-data detection compares fingerprints instead of entire files.

Benefits of Hashing

Used correctly, hashing reduces work and helps detect changes.

  • It enables fast retrieval in in-memory data structures.
  • It makes large-file comparisons practical.
  • It exposes tampering when an expected cryptographic digest no longer matches.
  • It supports safer password verification with unique salts and password-specific algorithms.

Practical Limits and Security Mistakes

Hashing is useful, but its limits matter.

  • Collisions are mathematically inevitable because many inputs map to a finite output space.
  • A hash does not encrypt data, so it cannot be decrypted to reveal the original value.
  • MD5 and SHA-1 should not protect security-sensitive data where collision resistance matters.
  • Fast general-purpose hashes make password guessing cheaper. Passwords need a slow, adaptive function and a unique, randomly generated salt.

Choosing the Right Hashing Approach

Use language-native hash maps for in-memory lookup. Use modern cryptographic hashes such as SHA-256 or SHA-3 for appropriate integrity checks, and use Argon2id, bcrypt, scrypt, or PBKDF2 for passwords. When building a full-stack product, test secure hashing choices alongside authentication and data flows. An AI app builder such as Emergent can help teams build and test these workflows, while the Emergent glossary explains related software concepts.

Start Building
on Emergent today
Start Building