Crypto
Wyn provides cryptographic primitives through the Crypto module. All functions return hex-encoded strings.
Methods
| Method | Returns | Description |
|---|---|---|
Crypto.sha256(s) | string | SHA-256 hash (hex) |
Crypto.hmac_sha256(key, msg) | string | HMAC-SHA256 (hex) |
Examples
wyn
// Hash a string
var hash = Crypto.sha256("hello")
println(hash) // 2cf24dba5fb0a30e...
// HMAC for message authentication (e.g., JWT signing)
var sig = Crypto.hmac_sha256("secret-key", "message-to-sign")
println(sig)