Skip to main content

Crate moirai_crypto

Crate moirai_crypto 

Source
Expand description

§moirai-crypto

Pure-Rust cryptographic primitives and an optional rustls::crypto::CryptoProvider.

The standalone SHA-256, HMAC-SHA256 and fixed-width comparison APIs are available without enabling the provider feature. The default feature enables the complete provider used by the Moirai TLS stack (moirai-tls). All implementations use RustCrypto with zero C dependencies.

With provider enabled, the crate supports the three TLS 1.3 cipher suites, X25519 and P-256 key exchange, and the ECDSA/RSA signature verification algorithms required to validate typical web PKI certificate chains — all implemented in safe, portable Rust.

let provider = moirai_crypto::provider();

Structs§

Sha1
Streaming SHA-1 state for protocol compatibility.
Sha256
Streaming SHA-256 state.

Functions§

base64_decode
Decodes padded standard RFC 4648 Base64.
base64_encode
Encodes bytes as standard RFC 4648 Base64 with padding.
constant_time_eq_32
Compares two 32-byte values without a source-level early exit.
hmac_sha256
Computes HMAC-SHA256 according to RFC 2104.
provider
Construct a CryptoProvider backed by RustCrypto (no C dependencies).
sha1
Computes the protocol-only SHA-1 digest of data.
sha256
Computes a SHA-256 digest in one pass.