Web · real, tested code

Hash Data with SHA-256 in Larzscript

Compute a real SHA-256 hash and an HMAC-SHA256 message authentication code.

A real FIPS 180-4 implementation in pure Larzscript, no OS crypto library - the same code that backs larzscript update's own release-integrity check.

larzscript pkg install crypto

Code

import "crypto" as crypto

print(crypto.sha256("hello larzscript"))
print(crypto.hmac("secret-key", "message to authenticate"))
Output
70a4348463191aad8ef5fc3292c882ca970b4276cb6fffaa76d7bc29395b24f7
79774090145c3f263969df659b5706baa1d03045d3f55002cf17da54e788fc22