Module crypto

Module crypto 

Source
Expand description

Cryptographic operations for Seq

These functions are exported with C ABI for LLVM codegen to call.

§API

# SHA-256 hashing
"hello" crypto.sha256                    # ( String -- String ) hex digest

# HMAC-SHA256 for webhook verification
"message" "secret" crypto.hmac-sha256    # ( String String -- String ) hex signature

# Timing-safe comparison
sig1 sig2 crypto.constant-time-eq        # ( String String -- Bool )

# Secure random bytes
32 crypto.random-bytes                   # ( Int -- String ) hex-encoded random bytes

# UUID v4
crypto.uuid4                             # ( -- String ) "550e8400-e29b-41d4-a716-446655440000"

# AES-256-GCM authenticated encryption
plaintext hex-key crypto.aes-gcm-encrypt  # ( String String -- String Bool )
ciphertext hex-key crypto.aes-gcm-decrypt # ( String String -- String Bool )

# Key derivation from password
password salt iterations crypto.pbkdf2-sha256  # ( String String Int -- String Bool )

Functions§

patch_seq_constant_time_eq
Timing-safe string comparison
patch_seq_crypto_aes_gcm_decrypt
Decrypt ciphertext using AES-256-GCM
patch_seq_crypto_aes_gcm_encrypt
Encrypt plaintext using AES-256-GCM
patch_seq_crypto_ed25519_keypair
Generate an Ed25519 keypair
patch_seq_crypto_ed25519_sign
Sign a message with an Ed25519 private key
patch_seq_crypto_ed25519_verify
Verify an Ed25519 signature
patch_seq_crypto_pbkdf2_sha256
Derive a key from a password using PBKDF2-SHA256
patch_seq_hmac_sha256
Compute HMAC-SHA256 of a message with a key
patch_seq_random_bytes
Generate cryptographically secure random bytes
patch_seq_sha256
Compute SHA-256 hash of a string
patch_seq_uuid4
Generate a UUID v4 (random)