업데이트로 돌아가기
New releaseAug 7, 2026

rscrypto v0.8.0

기본 의존성 제로 Rust 암호화: BLAKE3, Ed25519/X25519, 해시, MAC, KDF, AEAD, 그리고 완전한 SIMD/ASM 가속을 갖춘 체크섬

공유

rscrypto

Crates.io Docs.rs MSRV 1.100.0 License: Apache-2.0

rscrypto is a Rust library of cryptographic primitives, hashes, password hashing, random generation, and checksums. One feature model controls all of them. Portable Rust is the reference implementation. SIMD and assembly backends make it faster on supported targets. Production builds do not depend on C, FFI, OpenSSL, or system libraries.

The rscrypto crate supplies primitives. The companion rscrypto-rustls supplies TLS and QUIC cryptographic adapters.

Install

rscrypto needs Rust 1.100 or later. Some accelerated POWER, IBM Z, and RISC-V backends need a nightly compiler; builds without their features, and portable-only builds, support the declared MSRV. See Toolchain.

Minimal no_std build with SHA-2 only:

[dependencies]
rscrypto = { version = "0.13", default-features = false, features = ["sha2"] }

All primitives, with operating-system randomness:

[dependencies]
rscrypto = { version = "0.13", features = ["full", "getrandom"] }

The default feature is std. Set default-features = false to remove it. Enable getrandom only for the APIs that get randomness from the operating system, such as key generation, nonces, salts, hedged signing, ML-KEM and X-Wing encapsulation, and RSA blinding. The feature guide explains how to select features. Cargo.toml defines the exact feature graph.

Quick start

use rscrypto::Sha256;

let one_shot = Sha256::digest(b"hello world");

let mut hasher = Sha256::new();
hasher.update(b"hello ");
hasher.update(b"world");

assert_eq!(hasher.finalize(), one_shot);

Hash types support one-shot and streaming use. examples/README.md has runnable examples for AEAD, signatures, RSA, P-256 and P-384 ECDH, X25519, ML-KEM, password hashing, and backend introspection.

Primitives and features

FamilyPrimitivesFeature
ChecksumsCRC-16, CRC-24, CRC-32, CRC-32C, CRC-64/XZ, CRC-64/NVMe, Adler-32checksums or a leaf feature
Cryptographic hashesSHA-2, SHA-3, SHAKE, cSHAKE, BLAKE2, BLAKE3, Ascon-Hash/XOF/CXOFcrypto-hashes or a leaf feature
Fast hashesXXH3-64/128, XXH32, XXH64, RapidHash V3-64fast-hashes or a leaf feature
MACs and KDFsHMAC-SHA-2/SHA-3, KMAC128/256, Poly1305, SipHash-1-3/2-4 (flood-resistant hash tables), HKDF-SHA-2, PBKDF2-HMAC-SHA-2macs, kdfs, or a leaf feature
Password hashingArgon2d/i/id, scrypt, bounded PHC password recordspassword-hashing or a leaf feature
Signatures and RSAECDSA P-256/P-384, Ed25519, ML-DSA-44/65/87, SLH-DSA (all 12 FIPS 205 sets, pure and HashSLH-DSA), composite ML-DSA-65 with Ed25519 or ECDSA P-256 (draft-ietf-lamps-pq-composite-sigs-19), RSA signing, verification, encryption, and key generationsignatures or a leaf feature
Key exchange and KEMsP-256 ECDH, P-384 ECDH, X25519, ML-KEM-512/768/1024, X-Wing (ML-KEM-768 + X25519, draft-connolly-cfrg-xwing-kem-11), HPKE Base mode (RFC 9180) with the DHKEM(X25519) + AES-128-GCM and X-Wing + ChaCha20Poly1305 suiteskey-exchange or a leaf feature
AEADsAES-GCM, AES-GCM-SIV, AES-SIV-CMAC, ChaCha20-Poly1305, XChaCha20-Poly1305, AEGIS-256, Ascon-AEAD128aead or a leaf feature
Random generationChaCha20Rngchacha20-rng (included in full)

ChaCha20Rng accepts a caller-supplied seed and works without std or alloc. rand_core adds generator traits; getrandom adds operating-system seeding.

Signature and KEM keys import and export standard DER (PKCS #8 and SubjectPublicKeyInfo) for ECDSA, Ed25519, RSA, ML-DSA, composite ML-DSA, ML-KEM, and SLH-DSA.

AeadGather encrypts multiple plaintext slices into one ciphertext, and decrypts one ciphertext in place across ordered segments, for AES-GCM and ChaCha20-Poly1305. With aes-gcm, aead::expert::quic_lb encrypts QUIC-LB connection IDs (draft-ietf-quic-load-balancers-22). BLAKE3 supports reader, file, and batch hashing, and an expert decoder verifies sequential unkeyed Bao combined streams. hashes::expert::BLAKE3_PORTABLE_SOURCE holds the source text of the portable BLAKE3 compression function. The feature guide describes these APIs and their allocation and std requirements.

The WebSocket accept digest exists only for protocol compatibility. It needs the websocket-sha1 feature. No umbrella feature, including full, enables it.

See docs.rs for exact types and methods. The API compatibility notes explain output types, collection seeds, and retained method names. The cryptographic resilience guide explains security assumptions, migration boundaries, and the evidence to review when choosing stronger cryptography.

TLS and QUIC provider

The rscrypto-rustls companion connects these primitives to rustls:

CapabilityCoverage
TLSTLS 1.3; opt-in TLS 1.2 ECDHE suites
Key exchangeX25519MLKEM768 hybrid (preferred), X25519, P-256, P-384; opt-in SecP256r1MLKEM768, SecP384r1MLKEM1024, MLKEM768, MLKEM1024
AuthenticationECDSA P-256/P-384, Ed25519, RSA; opt-in ML-DSA-44/65/87 (ml-dsa) and composite ML-DSA-65 with Ed25519 or ECDSA P-256 at provisional draft codepoints (mldsa65-ed25519, mldsa65-ecdsa-p256)
QUICQUIC v1 packet and header protection through rustls's QUIC API; Initial keys, Retry tags, connection IDs, and reset and address tokens for any transport

The provider supports mutual authentication, session resumption, stateless tickets, and caller-supplied entropy. rustls owns the TLS protocol and rustls-webpki validates certificate paths. The QUIC transport belongs to the application.

The companion requires std. Its manifest pins rustls to the crates.io development release =0.24.0-dev.3. A later companion release moves the pin to rustls 0.24.0. Consumers must depend on the same rustls version. See the provider guide for configuration, feature requirements, and limits.

Platforms and dispatch

The portable Rust implementation defines the correct output, byte for byte. Every accelerated backend must give the same output. At compile time, the target sets which backends are available. With std, rscrypto also detects CPU features at run time and selects a backend. If no accelerated backend is available, the portable implementation runs.

The platform guide lists the supported targets. It also explains dispatch, no_std support, and the limits of portable-only.

Assurance

A security claim exists only while its evidence passes. Missing or old evidence removes the claim; it never weakens a gate.

카테고리