1 import Base 2 import 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). 7 def digest(+body: String) -> String: 8 SHA.hex(SHA.sha256(SHA.ascii(body))) 9 10 def verify(+body: String, +claimed: String) -> Bool: 11 String.eq(digest(body), claimed)