Skip to content

Crypto

Wyn provides cryptographic primitives through the Crypto module. All functions return hex-encoded strings.

Methods

MethodReturnsDescription
Crypto.sha256(s)stringSHA-256 hash (hex)
Crypto.hmac_sha256(key, msg)stringHMAC-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)

See Also

  • Bcrypt — password hashing (recommended for passwords)
  • Encoding — Base64 encoding/decoding

See Also

MIT License