writeonce/tests/corpus/run/crypto-digests/fixture.wo
shoney.arickathil 5fc32b4926 feat: iteration 34 — digest builtins sha1/sha256/hmac_sha256 (ids 85-87)
- runtime/src/crypto.c: hand-rolled cores, whole-value over Bytes,
  allocation-free tails; VM half returns fresh Bytes, WO_T_BOUNDS on
  wrong class id (Bytes builtins' message shape)
- test_crypto: RFC 3174 + FIPS 180-4 + RFC 4231 (incl. long-key case 6)
  + 63/64/65 block-boundary sweep + the RFC 6455 handshake input, 18/0
- compiler surface flat per house convention (sha1, not crypto.sha1 —
  matches base64_encode): types.ml signatures + result types, emit.ml
  ids/dispatch/arity/known-list/drop-table (fresh-Bytes entries so
  results get their drops)
- corpus run/crypto-digests pins the .wo path through base64_encode
- no .wob bump (ticks-84 precedent); WO_B_MAX 87; surface doc rows
- slice marker + board row: iteration 24 (absorbing 31+34) executing
- battery 12/12 fresh-built

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-23 00:42:43 +02:00

13 lines
578 B
Text

-- iteration 34: digests end to end from .wo — sha1/sha256/hmac_sha256
-- over Bytes, printed through base64_encode (iteration 19). Expected
-- values are the RFC vectors: SHA-1("abc"), SHA-256("abc"), and
-- HMAC-SHA256 key "Jefe" / RFC 4231 case 2's message.
fn main() -> Int {
let abc = bytes_of_text("abc");
print("sha1: ${base64_encode(sha1(abc))}");
print("sha256: ${base64_encode(sha256(abc))}");
let key = bytes_of_text("Jefe");
let msg = bytes_of_text("what do ya want for nothing?");
print("hmac: ${base64_encode(hmac_sha256(key, msg))}");
return 0;
}