src/SstChecksum.bend

mylsm-lsm-store@0.3.1.0 · 11 lines · 0 definitions

1import Base
2import mylsm-lsm-store@0.3.1.0/src/hub_sha/sha256.bend as SHA
3
4# Single checksum for SSTable v2 framing. SHA-256 is vendored under
5# ./hub_sha (see its headers); our laws only cover framing (digest placed
6# after '#', verified on parse), and vectors below pin the primitive.
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)