Tin
Standard library · Hashing

On this page

Standard library

Hashing

SHA-256 and HMAC-SHA-256, written in Tin. The Bedrock provider signs its requests with them.

Example

print(sha256("abc".bytes()).hex())
print(hmacSha256("key".bytes(), "message".bytes()).hex().slice(0, 16))
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
6e9ef29b75fffc5b

All 2 symbols

sha256

fn sha256(data: Bytes): Bytes

The SHA-256 digest of the bytes (32 bytes).

hmacSha256

fn hmacSha256(key: Bytes, message: Bytes): Bytes

HMAC-SHA256 of the message under the key (RFC 2104): 32 bytes.

See also