Skip to content
MasterMath

Hash Generator

Type a text and all five fingerprints come out at once, computed in your browser. Use it to check that a downloaded file matches the hash its author publishes, and to see why MD5 is no longer good for signing.

SHA-256

—

AlgorithmBitsHash
Input bytes—
Characters—
Comparison—

How it was computed

    What a hash is and what it is for

    A hash function takes data of any size and returns a fixed-size fingerprint: 32 hexadecimal characters for MD5, 64 for SHA-256. Three properties make it useful: the same data always gives the same fingerprint, a tiny change in the data changes the whole fingerprint, and the data cannot be rebuilt from the fingerprint. With that you can check a download arrived intact, store passwords without storing the password, and sign a document by signing only its fingerprint.

    What a hash is not: encryption. There is no key and no way back. What can be done is trying candidates — millions per second — until one produces that fingerprint, which is why passwords are stored with a salt and with deliberately slow functions, not with a bare MD5.

    MD5, SHA-1 and SHA-2, one by one

    MD5 (1992) gives 128 bits. Collisions — two different inputs with the same fingerprint — have been known since 2004 and are produced in seconds today, so it is no good for signing or for passwords. It is still useful for spotting accidental corruption in a download, which is what most people look it up for.

    SHA-1 (1995) gives 160 bits. It met the same fate in 2017, when the first practical collision was published; browsers stopped accepting certificates signed with it that same year. SHA-256, SHA-384 and SHA-512 are the SHA-2 family (2001), with no practical attacks known, and are what is used today: SHA-256 for almost everything, SHA-512 where the processor is 64-bit and the data large, because it is faster there.

    How to verify a download

    Whoever publishes a large file — a system image, an installer — usually publishes its hash next to it. After downloading, you compute the hash of the file you received and compare it with the published one: if they match, the file is identical bit for bit; if not, something changed on the way, whether a dropped connection or something worse. This page hashes a text; for a file, on Windows it is certutil -hashfile file SHA256, on macOS shasum -a 256 file and on Linux sha256sum file.

    The “compare with” field does that check for you: paste the published hash and the page says whether it matches any of the five, so you do not have to read sixty-four characters by eye. Case does not matter; neither do spaces.

    Worth knowing

    The hash is computed over bytes, not characters, and the same text can have different bytes depending on the encoding: “café” is five bytes in UTF-8 and four in Latin-1, with two hashes that look nothing alike. This page uses UTF-8, which is what nearly everything uses today; if a published hash does not match yours and the text has accents, the encoding is the first thing to check. A trailing newline counts too: echo adds one, and it is the most common reason a hash computed in a terminal does not match the one here.

    Everything is computed in your browser with the cryptographic API it ships with — MD5 is not in it and is written by hand, checked against the standard’s test vectors. Nothing is sent anywhere.

    Frequently asked questions

    What is a hash?

    A fixed-length fingerprint of any piece of data: a text, a file, a whole disk. Changing a single bit of the data changes the fingerprint completely, and there is no way back from the fingerprint to the data. It is used to check that two copies are identical without comparing them byte by byte.

    Can a hash be decrypted?

    No, because it is not encryption: it is a one-way function. What can be done is trying millions of candidates to see which one gives that fingerprint, which is how passwords stored with a weak or unsalted hash get cracked.

    Is MD5 still safe?

    For signing or storing passwords, no: collisions have been known since 2004 and are produced in seconds. For checking that a download arrived whole it is still useful, which is why many sites still publish it next to the SHA-256.

    Why do the hashes of “hello” and “Hello” look nothing alike?

    That is the avalanche effect, and it is deliberate: a tiny change in the input has to flip about half the bits of the output. If similar inputs gave similar fingerprints, one could be guessed from the other.

    Which algorithm should I use?

    SHA-256 for almost everything. SHA-512 on a 64-bit system over large data, where it is faster. SHA-1 and MD5 only to check the integrity of something that was already published with them.

    Does the text I type leave my browser?

    No. Everything is computed in your browser with the cryptographic functions it ships with; nothing is sent to any server. You can check by going offline: the page keeps working.