Cryptographic hash functions. All functions return hex-encoded strings by default.
Functions
blake3 core
fn (data: Str | Bytes): Str
BLAKE3 cryptographic hash. Fast, modern hash function. Returns hex-encoded 64-character string.
Example
blake3("hello")
// 64-character hex string
// BLAKE3 is faster than SHA-256 for large inputs
blake3(file-contents)
sha256 core
fn (data: Str | Bytes): Str
SHA-256 cryptographic hash. Returns hex-encoded 64-character string.
Example
sha256("hello")
// "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
sha256("hello world")
// "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"
ed25519-verify
fn (public-key: Str, message: Str | Bytes, signature: Str): Bool
Verify an Ed25519 signature. Takes a hex-encoded 32-byte public key, the signed message, and a hex-encoded 64-byte signature. Returns true if the signature is valid; false for a bad or malformed signature. Errors only if the public key itself is not valid hex.
Used for verifying Discord interaction webhooks, which sign ${timestamp}${raw-body} with your application's public key.
Example
ed25519-verify(public-key-hex, `${timestamp}${body}`, signature-hex)
// => true or false
md5
fn (data: Str | Bytes): Str
MD5 hash (legacy). Use only for checksums or compatibility. NOT secure for cryptographic purposes.
Example
md5("hello")
// "5d41402abc4b2a76b9719d911017c592"
sha1
fn (data: Str | Bytes): Str
SHA-1 hash (legacy). Use only for compatibility with existing systems like GitHub webhooks. NOT recommended for new security applications.
Example
// Verify GitHub webhook signature
sha1(payload)
sha384
fn (data: Str | Bytes): Str
SHA-384 cryptographic hash. Returns hex-encoded 96-character string.
Example
sha384("hello")
// 96-character hex string
sha512
fn (data: Str | Bytes): Str
SHA-512 cryptographic hash. Returns hex-encoded 128-character string.
Example
sha512("hello")
// 128-character hex string