argon2id_p1/lib.rs
1//! Argon2id, version 1.3, one lane, caller-supplied memory.
2//!
3//! # Examples
4//!
5//! ```
6//! use argon2id_p1::{Algorithm, Argon2, Block, Params, Version};
7//!
8//! let params = Params::new(64, 2, 1, Some(32))?; // 64 KiB, 2 passes, 1 lane, 32-byte tag
9//! let mut memory = vec![Block::new(); params.block_count()];
10//!
11//! let argon2 = Argon2::new(Algorithm::Argon2id, Version::V0x13, params);
12//! let mut tag = [0u8; 32];
13//! argon2.hash_password_into_with_memory(b"password", b"0123456789abcdef", &mut tag, &mut memory)?;
14//! # assert_ne!(tag, [0u8; 32]);
15//! # Ok::<(), argon2id_p1::Error>(())
16//! ```
17//!
18//! Working memory belongs to the caller — whether it comes from a fallible
19//! reservation, an arena, or a static buffer is the caller's policy. Slices
20//! longer than [`Params::block_count`] are fine; the excess is ignored.
21
22#![no_std]
23#![forbid(unsafe_code)]
24
25mod algorithm;
26mod argon2;
27mod block;
28mod error;
29mod fill;
30mod hprime;
31mod init;
32mod le;
33mod params;
34mod version;
35
36#[cfg(test)]
37mod tests;
38
39pub use algorithm::Algorithm;
40pub use argon2::Argon2;
41pub use block::Block;
42pub use error::Error;
43pub use params::Params;
44pub use version::Version;