Skip to main content

Hash Guessing Demo

A SHA-256 hash can't be decrypted. Nevertheless, you can sometimes find the input again – namely when only a few inputs are possible at all.

This demo generates the SHA-256 hash of a short PIN and then searches for the PIN by systematic trial.

Hash Guessing Demo

Start the experiment: a SHA-256 hash value is generated from a PIN – then the PIN is recovered purely by trying candidates.

The SHA-256 hash is not decrypted. The tool tries possible inputs, hashes them and compares the result with the target hash.

PIN length
Secret PIN

Takeaway: A small input space can be searched exhaustively – no matter how strong the hash function is. Preimage resistance only protects if the input is hard to guess.

What Does the Experiment Show?​

SHA-256 is not reversed in the process. The tool hashes every candidate – 000, 001, 002, and so on – itself and compares the result with the target hash. If the two match, the matching input has been found.

This works because the input space is small: a four-digit PIN has only 10,000 possibilities, which a browser can try in a short time. The strength of SHA-256 doesn't protect against this search – it depends solely on how many possible inputs there are.

More About Reversing Hashes​

Why hashes can't be decrypted but can still be cracked is explained in the article Can You Reverse a Hash?. The underlying security property is described in What Is Preimage Resistance?, and the algorithm itself in What Is SHA-256?.