Skip to content

Releases: bddjr/tinyhmacmd5

v0.5.3-es2026

Choose a tag to compare

@bddjr bddjr released this 13 Sep 14:19
00da0a0

⚠️Using ECMAScript 2026

888 Bytes (-17)

Full Changelog: v0.5.2-es2026...v0.5.3-es2026

v0.5.3

Choose a tag to compare

@bddjr bddjr released this 13 Sep 14:20
e5c22a8

926 Bytes (-17)

⚡ Performance & TurboFan JIT Optimization

  • Native ROR Recognition: Migrated bit rotation from ROL to ROR (>>> cnt | a << 32 - cnt) with updated shift string table "94/*;72,<50):61+". This allows V8 TurboFan to natively recognize the rotation pattern and emit a single x86 rorl instruction instead of multiple shift/or instructions.
  • Loop-Invariant Register Hoisting (mul & add): Hoisted round multiplier and adder calculations (let mul = 0x7351 >> l, add = 0x0510 >> l) directly into the inner for header. This eliminates 4 shift instructions and memory loads per step in the hot loop, ensuring optimal register allocation and yielding an immediate speedup.
  • Inlined Endianness Check (reverseOnBE): Inlined the isBE check directly into reverseOnBE (a => isBE ? a.reverse() : a) instead of writing isBE && before every call site, enabling cleaner expression nesting and saving code size.

🧩 Expanded Input Types

  • Added official support for Int8Array and number[] inputs in both MD5 and HMAC-MD5 (elements are safely cast to bytes via Uint8Array).
  • Updated TypeScript declarations (main.d.ts), JSDoc (@typedef Input), and README.md with usage examples.

🛠️ Tooling & Dependencies

  • Updated terser to ^5.51.2 and es-check to ^9.7.1.
  • Added tsconfig.nocheck.json composite project reference for minified files.
  • Added comprehensive test cases for Int8Array and number[] in scripts/test.mjs.
  • Added to CDNJS (cdnjs/packages#2199).

📊 Benchmark

> pnpm benchmark
$ node scripts/benchmark.mjs && node scripts/test-513MiB.mjs
Data length: 104857600 chars (100MiB)
--------------------------------------------------
tinyhmacmd5     : 374.04 ms
spark-md5       : 513.18 ms
js-md5          : 481.65 ms
crypto-js       : 1667.43 ms
blueimp-md5     : 3753.25 ms
node:crypto     : 130.88 ms
--------------------------------------------------
✅ All pure JS implementations match node:crypto result.

--- Pure 513MiB Test (No prior small tests) ---
tinyhmacmd5 HMAC-MD5 timer: 1.794s
node:crypto HMAC-MD5 timer: 550.872ms
tinyhmacmd5 MD5 timer: 1.786s
node:crypto MD5 timer: 548.873ms

CPU: i5-10600KF
DRAM: 64GiB DDR4 3333MT/s
OS: Windows 11 Pro for Workstations 25H2 26200.8737
Node.js: v26.8.1

Full Changelog: v0.5.2...v0.5.3

v0.5.2-es2026

Choose a tag to compare

@bddjr bddjr released this 12 Sep 09:39
ad98906

⚠️Using ECMAScript 2026

905 Bytes (-18)

Full Changelog: v0.5.1-es2026...v0.5.2-es2026

v0.5.2

Choose a tag to compare

@bddjr bddjr released this 12 Sep 09:39
3c0162e

943 Bytes (-12)

  • ⚡ Optimize & Eliminate JIT Deopt: Simplified inputToWords and output formatting. Replaced the old big-endian JS bitwise loop with native TypedArray .reverse(), completely eliminating JIT deoptimization (bailout) risks and keeping type feedback clean and monomorphic.
  • 📊 Benchmark:
    • Added spark-md5 to benchmarks.
    • Fixed js-md5 silently delegating to node:crypto in Node.js, ensuring a fair pure-JS benchmark.
    • tinyhmacmd5 remains the fastest pure-JS MD5 / HMAC-MD5 implementation.
  • 📝 Updated package description: "A tiny, fast and reliable implementation of MD5 and HMAC-MD5 for JavaScript."
> pnpm benchmark
$ node scripts/benchmark.mjs && node scripts/test-513MiB.mjs
Data length: 104857600 chars (100MiB)
--------------------------------------------------
tinyhmacmd5     : 388.45 ms
spark-md5       : 520.13 ms
js-md5          : 480.29 ms
crypto-js       : 1661.32 ms
blueimp-md5     : 3749.15 ms
node:crypto     : 129.97 ms
--------------------------------------------------
✅ All pure JS implementations match node:crypto result.

--- Pure 513MiB Test (No prior small tests) ---
tinyhmacmd5 HMAC-MD5 timer: 1.867s
node:crypto HMAC-MD5 timer: 548.332ms
tinyhmacmd5 MD5 timer: 1.869s
node:crypto MD5 timer: 551.244ms

Full Changelog: v0.5.1...v0.5.2

v0.5.1-es2026

Choose a tag to compare

@bddjr bddjr released this 07 Sep 03:09
e7a13ca

⚠️Using ECMAScript 2026

923 Bytes (-24)

Full Changelog: v0.5.0-es2026...v0.5.1-es2026

v0.5.1

Choose a tag to compare

@bddjr bddjr released this 07 Sep 03:11
cc41a39

955 Bytes (-24)

🚀 Optimize performance: reduced the processing time of 513 MiB data from 2.693s to 1.868s

> pnpm benchmark
$ node scripts/benchmark.mjs && node scripts/test-513MiB.mjs
Data length: 104857600 chars (100MiB)
--------------------------------------------------
tinyhmacmd5     : 388.35 ms
js-md5          : 128.71 ms
blueimp-md5     : 3823.48 ms
crypto-js       : 1553.58 ms
node:crypto     : 129.86 ms
--------------------------------------------------
✅ All pure JS implementations match node:crypto result.

--- Pure 513MiB Test (No prior small tests) ---
tinyhmacmd5 HMAC-MD5 timer: 1.886s
node:crypto HMAC-MD5 timer: 548.216ms
tinyhmacmd5 MD5 timer: 1.868s
node:crypto MD5 timer: 548.352ms

❤️ Thanks: @jexjws @GuaiZai233

Full Changelog: v0.5.0...v0.5.1

INVINCIBLE EXPERIMENT!

v0.5.0-es2026

Choose a tag to compare

@bddjr bddjr released this 06 Sep 07:56
c7d3816

⚠️Using ECMAScript 2026

947 bytes

v0.5.0

Choose a tag to compare

@bddjr bddjr released this 06 Sep 07:56
e4ee3e6

979 bytes

  • Unlicense

Full Changelog: v0.4.2...v0.5.0

v0.4.2-es2026

Choose a tag to compare

@bddjr bddjr released this 05 Sep 16:56
45f85e0

⚠️Using ECMAScript 2026

975 bytes

Optimize performance.

Full Changelog: v0.4.1-es2026...v0.4.2-es2026

v0.4.2

Choose a tag to compare

@bddjr bddjr released this 05 Sep 16:56
ce90916

1007 bytes

Optimize performance.

Full Changelog: v0.4.1...v0.4.2