File Hash Generator
Operator: Abdulla Al Fahad. How tools are built and checked
A checksum is a short fingerprint calculated from every byte of a file. Change one byte and the fingerprint changes completely. Software publishers print a SHA-256 or MD5 value next to their downloads so you can confirm that the installer, disk image or archive on your disk is exactly the one they released, and not a truncated download or a tampered copy from a mirror.
File Hash Generator calculates five of these fingerprints for one file at a time: MD5, SHA-1, SHA-256, SHA-384 and SHA-512, each in lowercase hexadecimal with its own copy button. Paste the value the publisher gave you into the expected hash box and the page tells you whether it matches, working out which algorithm to compare from the length of what you pasted.
Key features
- MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of one file in a single pass
- SHA digests from the browser's Web Crypto API; MD5 from a small implementation in the page, because Web Crypto has none
- Copy button for each hash
- Expected hash check that ignores case and spaces and picks the algorithm by length
- Progress shown while MD5 runs, with a Stop button
- Clear refusal for files over 500 MB rather than a frozen tab
What is hashed, compared and refused
Any file type can be hashed, because a hash works on raw bytes and does not care whether they form a PDF, an ISO image or a ZIP. Results are lowercase hex: 32 characters for MD5, 40 for SHA-1, 64 for SHA-256, 96 for SHA-384 and 128 for SHA-512.
The expected hash box ignores upper or lower case and any spaces or line breaks, so a value copied from a web page in groups of eight characters, or in capitals, still compares correctly. A full line copied from sha256sum output, with the hash followed by two spaces and a file name, is also accepted: the file name is dropped and the first token is compared.
Files up to 500 MB are accepted. The browser's built-in hashing function, crypto.subtle.digest, only accepts the whole file as one block of memory and cannot be fed piece by piece, so a larger file would risk crashing the tab. Above that size the page refuses the file and suggests a command-line tool instead.
How it works
When you pick a file, the page reads it into memory as one ArrayBuffer and passes that buffer to crypto.subtle.digest four times, once each for SHA-1, SHA-256, SHA-384 and SHA-512. Web Crypto has no MD5, so the page then runs its own MD5 over the same buffer in 4 MB slices, pausing between slices so the page keeps responding and the Stop button works.
The expected hash you paste is lowercased and stripped of whitespace, then its length decides which of the five results it is compared with. The comparison is an exact string match, and the matching hash is outlined in the results list.
Typical uses
- Checking that a Linux ISO downloaded from a mirror matches the SHA-256 listed on the distribution's own site before writing it to a USB stick.
- Confirming that a contract PDF emailed back by a client is byte-for-byte the version you sent, by comparing the two files' SHA-256 values.
- Recording the SHA-256 of evidence files or backups at the time they were collected, so a later copy can be shown to be unchanged.
- Looking up a file in an internal asset list that stores MD5 values from an older system.
Building one
- Copy the checksum from the publisher's download page, if you have one, and paste it into the expected hash box.
- Choose the file or drop it on the page. Hashing starts straight away.
- Wait for the five hashes to appear. Large files show MD5 progress as a percentage.
- Read the match line above the results, or copy whichever hash you need.
Example
A text file holding the three letters abc, saved twice: once with no line ending, once with a newline
abc.txt (3 bytes: a b c)
abc-newline.txt (4 bytes: a b c and a line feed)MD5 and SHA-256 for each
abc.txt
MD5 900150983cd24fb0d6963f7d28e17f72
SHA-256 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
abc-newline.txt
MD5 0bee89b07a248e27c83fc3d5951213c1
SHA-256 edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cbTips for best results
- When a publisher lists several algorithms, compare SHA-256 or SHA-512. They are the ones still considered safe against deliberate forgery.
- Copy the expected value from the publisher's own HTTPS page, not from the same mirror that served the file. A checksum hosted next to a tampered file can be tampered with too.
- If the match fails, download the file again before suspecting tampering. An interrupted download is the common cause.
Things to check before you rely on it
A text file's hash depends on its line endings and encoding, not just the visible text. In the example above, a single trailing newline gives different MD5 and SHA-256 values that could not have been predicted from the originals, and the same three letters saved with a Windows line ending give a different SHA-256 again (552bab68... instead of edeaaff3...). Two files that look identical in an editor can therefore fail to match.
MD5 and SHA-1 have known collision attacks: someone can build two different files with the same MD5 or SHA-1. They still catch accidental corruption, but a matching MD5 does not prove a file is the genuine release if an attacker was involved.
The 500 MB limit is a property of how Web Crypto is called here, not of the algorithms. Large disk images, video masters and database dumps need a command-line tool such as sha256sum on Linux, shasum -a 256 on macOS or certutil -hashfile on Windows.
Only one file is hashed at a time, and a folder cannot be hashed as a unit; zip it first if you need one value for a set of files, bearing in mind that zipping on two machines rarely produces identical archives.
Common errors and how to fix them
- The page refuses the file and states its size
- The file is over 500 MB. Use sha256sum, shasum or certutil on your computer, which read the file in pieces and have no such limit.
- The expected value is the wrong number of hex characters
- Part of the hash was probably missed when copying, or a prefix such as sha256: was included. Copy the whole value again and remove any label in front of it.
- The value has characters other than 0-9 and a-f
- Some sites publish checksums in Base64, which uses letters beyond f and ends in = signs. This page compares hex values only.
- The browser does not offer the Web Crypto API here
- Web Crypto only works on pages served over https. Open the site through its normal https address in a current browser.
Best practices
- Store the SHA-256, not the MD5, when you record checksums for your own archives.
- Keep the checksum and the file in separate places, so damage to one does not silently match damage to the other.
- When you publish files yourself, list the SHA-256 in lowercase hex without spaces; it is the form most people paste and compare.
How the MD5 is computed without Web Crypto
The Web Crypto API leaves MD5 out because it is no longer safe for security uses, but plenty of download pages and asset systems still list it. This page carries a short MD5 routine that follows RFC 1321. The specification lists sample values you can use to check it yourself: an empty file should give d41d8cd98f00b204e9800998ecf8427e, and a file holding only abc should give 900150983cd24fb0d6963f7d28e17f72. MD5 runs after the SHA digests, in slices, which is why it is the step that shows a percentage.
Reading a match or a mismatch
A match means the file's bytes are the same as those the checksum was calculated from, with odds of an accident too small to matter for SHA-256. A mismatch means at least one byte differs. It does not say where or how many; a single flipped bit at the end of a 400 MB image produces a value that bears no usable resemblance to the expected one, just as a wholly different file would.
Frequently asked questions
Why does the page need the whole file in memory?
crypto.subtle.digest takes one complete buffer and returns one digest; it has no way to add data in pieces. Holding the full file is the only way to use it, which is what sets the 500 MB ceiling.
Which algorithm should I compare if the publisher lists only one?
Just paste it. The page tells the algorithm apart by length, so a 64-character value is compared with SHA-256 and a 32-character value with MD5.
Does renaming a file change its hash?
No. The file name is stored by the file system, not inside the file's bytes, so a renamed copy keeps the same checksum.