Zloweb
RU

How hash functions work

What a digest tells you about the input bytes.

Fixed-length digests

A hash function deterministically maps input bytes to a digest. SHA-256 produces 256 bits, usually written as 64 hexadecimal digits. A small change in the input typically produces a substantially different digest. Because the output space is finite, different inputs can share a digest, although finding a collision is intended to be computationally hard.

Integrity and authentication

An independently trusted digest can detect corrupted downloads. A digest from the same untrusted source as the file provides weaker evidence, since both can be replaced together. Digital signatures or keyed authentication cover cases that require verification of who authorized the content.

Hash two inputs

Hash abc, then hash abc with one extra space. The SHA-256 tool hashes the exact UTF-8 text, including its whitespace. To hash original file bytes, use the file checksum tool instead of opening the file in a text editor.

SHA-256(abc)
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

Try the tools

Related reading

References