src/SstChecksum.bend
mylsm-lsm-store@0.2.0.0 · 11 lines · 0 definitions
1import Base
2import 0x9ee2e9a299991dcc089fe22c7f3ceb5f/src/crypto/sha/sha256.bend as SHA
3
4# Single checksum for SSTable v2 framing. The hub SHA-256 is trusted as-is
5# (its own PROOF.bend proves it against the executable FIPS 180-4 spec);
6# our laws only cover framing (digest placed after '#', verified on parse).
7def digest(+body: String) -> String:
8 SHA.hex(SHA.sha256(SHA.ascii(body)))
9
10def verify(+body: String, +claimed: String) -> Bool:
11 String.eq(digest(body), claimed)