1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! # BLAKE2b Cryptographic Hash Function
//!
//! This module provides access to the BLAKE2b hash function with support for incremental hashing.
//!
//! ## Features
//!
//! - **Variable output length**: Can produce hashes of any size between `BYTES_MIN` (16) and `BYTES_MAX` (64) bytes
//! - **Keyed hashing**: Supports keyed hashing (MAC) with keys of variable length
//! - **High performance**: Optimized for modern CPUs, faster than SHA-2 and SHA-3
//! - **Incremental hashing**: Supports incremental hashing for processing large data streams
//!
//! ## Usage Example
//!
//! ```
//! use libsodium_rs as sodium;
//! use sodium::crypto_generichash::blake2b;
//! use sodium::ensure_init;
//! use ct_codecs::{Encoder, Hex};
//!
//! // Initialize libsodium
//! ensure_init().expect("Failed to initialize libsodium");
//!
//! // One-shot hashing
//! let data = b"The quick brown fox jumps over the lazy dog";
//! let hash = blake2b::hash(
//! data,
//! blake2b::BYTES, // Default output length (32 bytes)
//! );
//!
//! // Convert to hex for display
//! let mut encoded = vec![0u8; hash.len() * 2];
//! let encoded = Hex::encode(&mut encoded, &hash).unwrap();
//! let hash_hex = std::str::from_utf8(encoded).unwrap();
//!
//! println!("BLAKE2b: {}", hash_hex);
//!
//! // Incremental hashing
//! let mut state = blake2b::State::new(
//! None, // No key
//! blake2b::BYTES, // Default output length (32 bytes)
//! ).expect("Failed to initialize BLAKE2b state");
//! state.update(b"The quick brown ");
//! state.update(b"fox jumps over the lazy dog");
//! let hash2 = state.finalize();
//! assert_eq!(hash, hash2);
//! ```
// Re-export the core module contents
pub use *;
// Export the State implementation
pub use State;
// Export the one-shot hashing functions
pub use ;
// Export utility functions
pub use ;
// Include tests