cryptoxide/
lib.rs

1// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4// option. This file may not be copied, modified, or distributed
5// except according to those terms.
6
7//! A pure-rust implementation of various cryptographic algorithms, which no dependencies
8//! and no foreign code (specially C or assembly).
9//!
10//! Our goals is to support rust cryptography in various constrained environment like embedded devices and web assembly
11//!
12//! This is a fork of [Rust-Crypto by DaGenix](https://github.com/DaGenix/rust-crypto),
13//! which we owe a debt of gratitude for starting some good quality pure rust implementations
14//! of various cryptographic algorithms.
15//!
16//! Notable Differences with the original sources:
17//!
18//! * Maintained
19//! * Extended ED25519 support for extended secret key (64 bytes) support
20//! * Proper implementation of ChaChaPoly1305
21//! * Many cryptographic algorithms removed: AES, Blowfish, Fortuna, RC4, RIPEMD160, Whirlpool, MD5, SHA1.
22//!
23//! As with everything cryptographic implementations, please make sure it suits your security requirements,
24//! and review and audit before using.
25//!
26
27#![warn(clippy::all)]
28#![allow(clippy::unreadable_literal)]
29#![allow(clippy::new_without_default)]
30#![allow(clippy::let_and_return)]
31#![allow(clippy::redundant_field_names)]
32#![allow(clippy::wrong_self_convention)]
33#![allow(clippy::identity_op)]
34#![allow(clippy::many_single_char_names)]
35#![no_std]
36#![cfg_attr(feature = "with-bench", feature(test))]
37#![cfg_attr(feature = "use-stdsimd", feature(stdsimd))]
38#![deny(missing_docs)]
39
40#[cfg(test)]
41#[cfg(feature = "with-bench")]
42extern crate test;
43
44extern crate alloc;
45
46#[cfg(test)]
47#[macro_use]
48extern crate std;
49
50#[cfg(feature = "blake2")]
51pub mod blake2b;
52
53#[cfg(feature = "blake2")]
54pub mod blake2s;
55
56#[cfg(feature = "chacha")]
57pub mod chacha;
58
59#[cfg(feature = "chacha")]
60pub mod chacha20;
61
62#[cfg(all(feature = "chacha", feature = "poly1305"))]
63pub mod chacha20poly1305;
64
65#[cfg(feature = "curve25519")]
66pub mod curve25519;
67
68#[cfg(feature = "x25519")]
69pub mod x25519;
70
71#[cfg(feature = "digest")]
72pub mod digest;
73
74pub mod hashing;
75
76pub mod drg;
77
78#[cfg(feature = "ed25519")]
79pub mod ed25519;
80#[cfg(feature = "hkdf")]
81pub mod hkdf;
82
83pub mod kdf;
84
85#[cfg(feature = "hmac")]
86pub mod hmac;
87#[cfg(feature = "mac")]
88pub mod mac;
89#[cfg(feature = "pbkdf2")]
90pub mod pbkdf2;
91#[cfg(feature = "poly1305")]
92pub mod poly1305;
93#[cfg(feature = "scrypt")]
94pub mod scrypt;
95
96#[cfg(feature = "salsa")]
97pub mod salsa20;
98
99#[cfg(feature = "sha1")]
100pub mod sha1;
101
102#[cfg(feature = "sha2")]
103pub mod sha2;
104
105#[cfg(feature = "sha3")]
106pub mod sha3;
107
108#[cfg(feature = "ripemd160")]
109pub mod ripemd160;
110
111mod cryptoutil;
112mod simd;
113
114pub mod constant_time;