How I Built a Free Hash Generator That Runs 100% in Your Browser
说明与用途
构建了一个完全在浏览器中运行的客户端哈希生成器,支持 MD5、SHA‑1/256/384/512 和 HMAC,使用 WebCrypto 和自定义 MD5 实现,支持大文件流式处理,并提供即时 UI 更新。
问题
Users need a client‑side hash generator that supports MD5, SHA‑1/256/384/512 and HMAC without sending data to a server.
结果
The hash generator runs entirely client‑side, supports all common hash algorithms, handles large files via streaming, and provides instant feedback for text input.
工作流
- 1. User types or pastes text into the Text tab; the component calls crypto.subtle.digest() for SHA algorithms and the custom Md5.update() for MD5, running all five digests in parallel via Promise.all.
- 2. User drops a file in the File checksum tab; FileReader streams the file in 64‑byte chunks, feeding each chunk to the incremental Md5 class or crypto.subtle.digest() for SHA, keeping memory usage low.
- 3. User pastes an expected hash in the Compare tab; the tool auto‑detects the algorithm from the hex length and compares the computed hash to the expected value.
- 4. User enters key and message in the HMAC tab; for SHA algorithms WebCrypto imports the key and signs, while for HMAC‑MD5 the custom MD5 implementation is used per RFC 2104.
- 5. Results are displayed instantly for text input and as soon as the file stream completes for file input.
证据
Most free hash tools online paste your input into a form, POST it to a server, and return the digest.
Browsers no longer ship MD5 in WebCrypto. crypto.subtle.digest() supports SHA-1, SHA-256, SHA-384 and SHA-512, but MD5 was left behind because it's not collision-resistant anymore.
I wrote an incremental MD5 implementation straight from RFC 1321… I can hash a 100 MB file in chunks without loading it all into memory.
One gotcha worth knowing: crypto.subtle.digest() is async and takes an ArrayBuffer… The tool computes all five digests in parallel with Promise.all for text input, so the UI updates essentially instantly.
The UI is four tabs, one per question people actually ask… Real example: after downloading a Linux ISO, the mirror usually publishes a SHA-256 checksum… Doing this without uploading a 3 GB file to someone's server is the entire point of building it client-side.
- 记录日期: 2026-10-24T06:11:28.485Z