Hi, I try to understand how the Crypt4GH standard works and therefore checked this library as a reference.
Checking the source code, I see that nonce_bytes gets initialized once:
|
let mut rnd = rand_chacha::ChaCha20Rng::from_entropy(); |
|
let mut nonce_bytes = [0u8; 12]; |
|
rnd.fill(&mut nonce_bytes); |
However, it seems like
nonce_bytes then gets used without ever changing it during looping over the data stream:
|
let nonce = Nonce::from_slice(&nonce_bytes); |
Is this correct? Should the nonce not be changed every time, e.g. by incrementing it by 1, when encrypting a new segment?
Hi, I try to understand how the Crypt4GH standard works and therefore checked this library as a reference.
Checking the source code, I see that
nonce_bytesgets initialized once:crypt4gh-rust/src/lib.rs
Lines 153 to 155 in 2d41a17
However, it seems like
nonce_bytesthen gets used without ever changing it during looping over the data stream:crypt4gh-rust/src/lib.rs
Line 189 in 2d41a17
Is this correct? Should the nonce not be changed every time, e.g. by incrementing it by 1, when encrypting a new segment?