Skip to main content

Crate cryptography

Crate cryptography 

Source
Expand description

Classical and modern block ciphers, stream ciphers, and DRBGs implemented in pure, safe, portable Rust directly from their published specifications.

Public-key primitives are variable-time and intentionally live under crate::vt to make that side-channel property explicit.

Entropy warning:

  • This crate does not provide an operating-system entropy source.
  • CtrDrbgAes256 is a deterministic DRBG, not a seed generator.
  • Callers must provide high-entropy external seed material for all randomness-dependent operations.

Re-exports§

pub use ciphers::aes;
pub use ciphers::camellia;
pub use ciphers::cast128;
pub use ciphers::chacha20;
pub use ciphers::des;
pub use ciphers::grasshopper;
pub use ciphers::magma;
pub use ciphers::present;
pub use ciphers::rabbit;
pub use ciphers::salsa20;
pub use ciphers::seed;
pub use ciphers::serpent;
pub use ciphers::simon;
pub use ciphers::sm4;
pub use ciphers::snow3g;
pub use ciphers::speck;
pub use ciphers::twofish;
pub use ciphers::zuc;
pub use ciphers::aes::Aes128;
pub use ciphers::aes::Aes128Ct;
pub use ciphers::aes::Aes192;
pub use ciphers::aes::Aes192Ct;
pub use ciphers::aes::Aes256;
pub use ciphers::aes::Aes256Ct;
pub use ciphers::camellia::Camellia;
pub use ciphers::camellia::Camellia128;
pub use ciphers::camellia::Camellia128Ct;
pub use ciphers::camellia::Camellia192;
pub use ciphers::camellia::Camellia192Ct;
pub use ciphers::camellia::Camellia256;
pub use ciphers::camellia::Camellia256Ct;
pub use ciphers::camellia::CamelliaCt;
pub use ciphers::cast128::Cast128;
pub use ciphers::cast128::Cast128Ct;
pub use ciphers::cast128::Cast5;
pub use ciphers::cast128::Cast5Ct;
pub use ciphers::chacha20::ChaCha20;
pub use ciphers::chacha20::XChaCha20;
pub use ciphers::des::key_schedule;
pub use ciphers::des::Des;
pub use ciphers::des::DesCt;
pub use ciphers::des::KeySchedule;
pub use ciphers::des::TDesMode;
pub use ciphers::des::TripleDes;
pub use ciphers::grasshopper::Grasshopper;
pub use ciphers::grasshopper::GrasshopperCt;
pub use ciphers::magma::Magma;
pub use ciphers::magma::MagmaCt;
pub use ciphers::present::Present;
pub use ciphers::present::Present128;
pub use ciphers::present::Present128Ct;
pub use ciphers::present::Present80;
pub use ciphers::present::Present80Ct;
pub use ciphers::present::PresentCt;
pub use ciphers::rabbit::Rabbit;
pub use ciphers::salsa20::Salsa20;
pub use ciphers::seed::Seed;
pub use ciphers::seed::SeedCt;
pub use ciphers::serpent::Serpent;
pub use ciphers::serpent::Serpent128;
pub use ciphers::serpent::Serpent128Ct;
pub use ciphers::serpent::Serpent192;
pub use ciphers::serpent::Serpent192Ct;
pub use ciphers::serpent::Serpent256;
pub use ciphers::serpent::Serpent256Ct;
pub use ciphers::serpent::SerpentCt;
pub use ciphers::simon::Simon128_128;
pub use ciphers::simon::Simon128_192;
pub use ciphers::simon::Simon128_256;
pub use ciphers::simon::Simon32_64;
pub use ciphers::simon::Simon48_72;
pub use ciphers::simon::Simon48_96;
pub use ciphers::simon::Simon64_128;
pub use ciphers::simon::Simon64_96;
pub use ciphers::simon::Simon96_144;
pub use ciphers::simon::Simon96_96;
pub use ciphers::sm4::Sm4;
pub use ciphers::sm4::Sm4Ct;
pub use ciphers::sm4::Sms4;
pub use ciphers::sm4::Sms4Ct;
pub use ciphers::snow3g::Snow3g;
pub use ciphers::snow3g::Snow3gCt;
pub use ciphers::speck::Speck128_128;
pub use ciphers::speck::Speck128_192;
pub use ciphers::speck::Speck128_256;
pub use ciphers::speck::Speck32_64;
pub use ciphers::speck::Speck48_72;
pub use ciphers::speck::Speck48_96;
pub use ciphers::speck::Speck64_128;
pub use ciphers::speck::Speck64_96;
pub use ciphers::speck::Speck96_144;
pub use ciphers::speck::Speck96_96;
pub use ciphers::twofish::Twofish;
pub use ciphers::twofish::Twofish128;
pub use ciphers::twofish::Twofish128Ct;
pub use ciphers::twofish::Twofish192;
pub use ciphers::twofish::Twofish192Ct;
pub use ciphers::twofish::Twofish256;
pub use ciphers::twofish::Twofish256Ct;
pub use ciphers::twofish::TwofishCt;
pub use ciphers::zuc::Zuc128;
pub use ciphers::zuc::Zuc128Ct;
pub use cprng::ctr_drbg::CtrDrbgAes256;
pub use hash::hkdf::Hkdf;
pub use hash::hmac::Hmac;
pub use hash::md5::Md5;
pub use hash::ripemd160::Ripemd160;
pub use hash::sha1::Sha1;
pub use hash::sha2::Sha224;
pub use hash::sha2::Sha256;
pub use hash::sha2::Sha384;
pub use hash::sha2::Sha512;
pub use hash::sha2::Sha512_224;
pub use hash::sha2::Sha512_256;
pub use hash::sha3::Sha3_224;
pub use hash::sha3::Sha3_256;
pub use hash::sha3::Sha3_384;
pub use hash::sha3::Sha3_512;
pub use hash::sha3::Shake128;
pub use hash::sha3::Shake256;
pub use hash::Digest;
pub use hash::Xof;
pub use modes::Aes128GcmSiv;
pub use modes::Aes256GcmSiv;
pub use modes::AesKeyWrap;
pub use modes::Cbc;
pub use modes::Ccm;
pub use modes::Cfb;
pub use modes::Cfb8;
pub use modes::ChaCha20Poly1305;
pub use modes::Cmac;
pub use modes::Ctr;
pub use modes::Eax;
pub use modes::Ecb;
pub use modes::Gcm;
pub use modes::GcmVt;
pub use modes::Gmac;
pub use modes::GmacVt;
pub use modes::Ocb;
pub use modes::Ofb;
pub use modes::Poly1305;
pub use modes::Siv;
pub use modes::Xts;

Modules§

ciphers
Block and stream ciphers.
cprng
Cryptographically motivated pseudorandom generators and DRBGs.
hash
Hash functions, XOFs, and message-authentication helpers.
modes
Generic block-cipher modes of operation.
public_key
Public-key building blocks.
vt
Explicit variable-time public-key surface.

Traits§

Aead
Common interface for AEAD constructions with detached tags.
BlockCipher
Common interface for block ciphers.
Csprng
Common interface for byte-oriented CSPRNG/DRBG outputs.
StreamCipher
Common interface for stream ciphers.

Functions§

zeroize_slice
Overwrites every element of slice with its Default value.