mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
scr_md5_block ran its 64 steps as one loop that chose the round function, message index and rotation per step, and the update path called it once per block. scr_md5_blocks unrolls the steps with the message word, constant and rotation inlined, processes every whole block of an update in one call, and keeps each step's critical path to the round function of b, an add, the rotate and the add of b: a + m + K is summed first, G is written as (b & d) + (c & ~d) so that its c & ~d half joins that sum, and an empty asm statement keeps the compiler from moving the constant's add after the round function. MD5, HMAC-MD5 and md5-sha1 use it. Corpus 5775 compares MD5, md5-sha1 and HMAC-MD5 digests over every length from 0 to 520 bytes in five update sizes and over 1 MiB with Node; tests/harness/corpus-costs/ records its plain and sanitized costs.