This repository was archived by the owner on Nov 22, 2026. It is now read-only.
Repository navigation
mojo-hashlib v0.1.0
mojo-hashlib v0.1.0
Released: 2026-10-21 · Commit: 132cc40 · Previous: first release
What it does
sha256, sha1 and md5 with incremental update() and hexdigest(), plus shlex quote, join and split, byte for byte the same as Python's hashlib and shlex.
Highlights
- Identical to Python on 77 cases, including the padding edges at 55, 56, 63, 64 and 65 bytes and 100 KB of random data.
- shlex is about 30x faster than Python (100k rounds: 49 to 58 ms vs 1,551 to 1,562 ms); many small hashes 2x faster.
- One fixed 64-byte block buffer per hasher; whole blocks are hashed straight from the caller's bytes.
Changes
First public release, no earlier version.
Verified
| Check | Result |
|---|---|
scripts/check.sh: 77 cases vs Python hashlib and shlex |
PASS all |
scripts/ci.sh on a pristine Ubuntu 24.04.5 VM |
PASS all |
Known limits
- Bulk hashing is slower than Python, which uses OpenSSL with the CPU's SHA instructions: sha256 5.3x, sha1 2.2x, md5 1.2x slower on 64 MiB.
- No blake2 or sha512 yet.
- shlex is POSIX mode only.
Upgrade / run
git clone https://github.com/amarbaro/mojo-hashlib && cd mojo-hashlib && uv sync
mojo run -I src examples/quickstart.mojo
Commits
132cc40docs: CI badge5a3a05bchore: real uv.lock, oracle docstring names only what it printsa9edccedocs(hashlib): README, api, design, agent skill, quickstart and CI37d7393bench(hashlib): hashes and shlex against Python, same work and same results3f8aa77test(hashlib): edge cases for the documented APIa5d5149test(hashlib): Mojo case runner for the oracle gate7ad5123feat(hashlib): shlex quote, join and splitb201412feat(hashlib): sha256, sha1 and md5 as one generic hasher9493e97test(hashlib): hashlib and shlex oracle, 77 cases8c5c73cchore: repo layout, Apache-2.0, mojo>=1.1