1 import Base 2 import ./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. 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)