diff --git a/protocols/v2/noise-sv2/src/handshake.rs b/protocols/v2/noise-sv2/src/handshake.rs index d05d4bc5ca..d17bc6d2af 100644 --- a/protocols/v2/noise-sv2/src/handshake.rs +++ b/protocols/v2/noise-sv2/src/handshake.rs @@ -29,13 +29,12 @@ pub trait HandshakeOp: CipherState { /// Sets the `ck` value to the provided data, updating the chaining key. fn set_ck(&mut self, data: [u8; 32]); - /// Mixes the provided data into the current hash `h` value. + /// Mixes the data into the handshake hash (`h`). /// - /// The `mix_hash` method is used to update the internal hash state `h` with new data. - /// It concatenates the current hash `h` with the provided data and then rehashes the - /// result using SHA-256. This process is crucial for maintaining a running hash of all the - /// messages exchanged during the handshake, ensuring message integrity and - /// protecting again replay attacks. + /// Updates the current handshake hash by combining it with the provided `data`. The result is + /// a new SHA-256 hash digest that reflects all previous handshake messages, ensuring the + /// integrity of the handshake process. This method is typically called whenever a new piece of + /// data (e.g., a public key or ciphertext) needs to be incorporated into the handshake state. fn mix_hash(&mut self, data: &[u8]) { let h = self.get_h(); let mut to_hash = Vec::with_capacity(32 + data.len());