Repository navigation
926 Bytes (-17)
⚡ Performance & TurboFan JIT Optimization
- Native
RORRecognition: 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 x86rorlinstruction 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 innerforheader. 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 theisBEcheck directly intoreverseOnBE(a => isBE ? a.reverse() : a) instead of writingisBE &&before every call site, enabling cleaner expression nesting and saving code size.
🧩 Expanded Input Types
- Added official support for
Int8Arrayandnumber[]inputs in both MD5 and HMAC-MD5 (elements are safely cast to bytes viaUint8Array). - Updated TypeScript declarations (
main.d.ts), JSDoc (@typedef Input), andREADME.mdwith usage examples.
🛠️ Tooling & Dependencies
- Updated
terserto^5.51.2andes-checkto^9.7.1. - Added
tsconfig.nocheck.jsoncomposite project reference for minified files. - Added comprehensive test cases for
Int8Arrayandnumber[]inscripts/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