ywt/algorithm

Types

JWT signing algorithms combining cryptographic primitives with hash functions.

Each algorithm represents a complete signing scheme including the cryptographic method (HMAC, ECDSA, RSA) and hash function. The choice affects security, performance, and compatibility with other JWT implementations.

If you are unsure, choose ES384 as a secure, modern and fast default.

Usage Examples

// For simple applications with shared secrets
let hmac_alg = hs256

// For distributed systems with public key infrastructure
let ecdsa_alg = es256

// The current recommendation for high-security systems
let recommended_alg = es384

// For maximum compatibility with existing systems
let rsa_alg = rs256
pub opaque type Algorithm

Values

pub const es256: Algorithm

ECDSA with P-256 curve and SHA-256 - asymmetric, efficient, modern standard.

pub const es384: Algorithm

ECDSA with P-384 curve and SHA-384 - asymmetric, high security, enterprise grade.

pub const es512: Algorithm

ECDSA with P-521 curve and SHA-512 - asymmetric, maximum security, future-proof.

pub const hs256: Algorithm

HMAC with SHA-256 - symmetric, 256-bit security, most common for simple applications.

pub const hs384: Algorithm

HMAC with SHA-384 - symmetric, 384-bit security, higher security margin.

pub const hs512: Algorithm

HMAC with SHA-512 - symmetric, 512-bit security, maximum HMAC strength.

pub const ps256: Algorithm

RSA PSS with SHA-256 - asymmetric, modern, stronger security proofs.

pub const ps384: Algorithm

RSA PSS with SHA-384 - asymmetric, modern, high security.

pub const ps512: Algorithm

RSA PSS with SHA-512 - asymmetric, modern, maximum security.

pub const rs256: Algorithm

RSA PKCS#1 v1.5 with SHA-256 - asymmetric, compatible, traditional choice.

pub const rs384: Algorithm

RSA PKCS#1 v1.5 with SHA-384 - asymmetric, compatible, higher security.

pub const rs512: Algorithm

RSA PKCS#1 v1.5 with SHA-512 - asymmetric, compatible, maximum hash strength.

Search Document