Skip to content
ProfitTool
Back to all articles
Developer Tools
2 min read

What Is a Hash Function? Cryptographic Hashing Explained

A cryptographic hash function transforms any input into a fixed-length output. This guide explains what makes a hash function secure, what it is used for, and the difference between hashing and encryption.

ProfitTool Team

Security & Dev

What a Hash Function Does

A cryptographic hash function takes an input of any size and produces a fixed-length output (the hash or digest). The same input always produces the same output, but the output reveals nothing useful about the input.

SHA-256("hello") → 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-256("Hello") → 185f8db32921bd46d35fa8c84e89ef2b8a21ed2a3c14f3c5a3f0b4f3e35a2e7

A single character change produces a completely different hash — this is called the avalanche effect.

Properties of a Cryptographic Hash Function

1. Pre-image resistance (one-way)

Given a hash H, it is computationally infeasible to find any input M such that hash(M) = H.

2. Second pre-image resistance

Given an input M1, it is infeasible to find a different input M2 such that hash(M1) = hash(M2).

3. Collision resistance

It is infeasible to find any two different inputs M1 and M2 that produce the same hash.

Hashing vs Encryption

PropertyHashingEncryption
ReversibleNoYes (with key)
Fixed output lengthYesVariable
Key requiredNoYes
Use caseIntegrity, passwordsConfidentiality

Hashing is one-way by design. You cannot "unhash" a value — you can only compare hashes. Encryption is reversible — the ciphertext can be decrypted with the correct key.

Common Uses

Data integrity

File checksums verify a download was not corrupted or tampered with. If the downloaded file's SHA-256 matches the publisher's published hash, the file is intact.

Password storage

Servers store the hash of passwords, not the passwords themselves. At login, the submitted password is hashed and compared to the stored hash.

Digital signatures

A message is hashed, then the hash is signed with a private key. Verifiers hash the message independently and verify the signature against the hash.

Blockchain

Each block in a blockchain includes the hash of the previous block. Altering any block invalidates all subsequent hashes.

  • SHA-256 / SHA-512: standard for data integrity and signatures
  • SHA-3: alternative design lineage if SHA-2 weaknesses emerge
  • BLAKE3: faster than SHA-256, used in high-performance scenarios

Compute hashes of any text with our Hash Generator and identify unknown hashes with our Hash Type Identifier.

Tags:#hash function#cryptography#sha256#md5#data integrity

ProfitTool Team

Security & Dev

Written and maintained by the ProfitTool team. Where an article references a ProfitTool utility, the behaviour described is the behaviour of the tool on this site — you can open it and check the output yourself.