The engine cannot reach node:crypto: the viewer bundles the engine into a
browser, so a Node built-in here would break the one consumer that has to
agree with the capture path byte for byte. It also cannot reach
SubtleCrypto, which is asynchronous and unavailable outside a secure
context, and a digest that is sometimes a promise is a digest no synchronous
evidence path can use.
So the transform is written out. It is the FIPS 180-4 algorithm with no
variation, which means the same bytes hash to the same digest as
createHash("sha256") does on the capture side, and the test suite proves
exactly that against Node's implementation rather than against a stored
expectation of this code's own output.
Everything is 32-bit integer arithmetic with >>> 0 normalization, so
endianness, word size, and floating-point behavior cannot make one platform
disagree with another.
SHA-256 over a UTF-8 string, in pure TypeScript.
The engine cannot reach
node:crypto: the viewer bundles the engine into a browser, so a Node built-in here would break the one consumer that has to agree with the capture path byte for byte. It also cannot reachSubtleCrypto, which is asynchronous and unavailable outside a secure context, and a digest that is sometimes a promise is a digest no synchronous evidence path can use.So the transform is written out. It is the FIPS 180-4 algorithm with no variation, which means the same bytes hash to the same digest as
createHash("sha256")does on the capture side, and the test suite proves exactly that against Node's implementation rather than against a stored expectation of this code's own output.Everything is 32-bit integer arithmetic with
>>> 0normalization, so endianness, word size, and floating-point behavior cannot make one platform disagree with another.