Std\Crypto
Crypto – cryptographic hashing and random byte generation.
Provides SHA-256 hashing, cryptographically secure random bytes, and UUID v4 generation.
Functions
Section titled “Functions”sha256 : String -> String
Section titled “sha256 : String -> String”Compute the SHA-256 hash of a string. Returns the hex-encoded digest.
import sha256 from Std\Crypto insha256 "hello" # => "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"randomBytes : Int -> String
Section titled “randomBytes : Int -> String”Generate n cryptographically secure random bytes, returned as a raw string.
import randomBytes from Std\Crypto inlet key = randomBytes 32 inlength key # => 32randomHex : Int -> String
Section titled “randomHex : Int -> String”Generate n random bytes and return them as a hex-encoded string (2n characters).
import randomHex from Std\Crypto inrandomHex 16 # => "a3f2b1..." (32 hex characters)uuid4 : String
Section titled “uuid4 : String”Generate a random UUID v4 string.
import uuid4 from Std\Crypto inuuid4 # => "550e8400-e29b-41d4-a716-446655440000"