INNER CODE UNIT · Rust
set_sponge
GuildOfWeavers/distaff · src/processor/decoder/mod.rs:438
fn set_sponge(&mut self, state: [u128; SPONGE_WIDTH]) {
self.sponge = state;
self.sponge_trace[0][self.step] = state[0];
self.sponge_trace[1][self.step] = state[1];
self.sponge_trace[2][self.step] = state[2];
self.sponge_trace[3][self.step] = state[3];
}
/// Applies a modified version of Rescue round to the sponge state and copies the result
/// into `sponge_trace` registers.
fn apply_hacc_round(&mut self, op_code: UserOps, op_value: u128) {
// apply single round of sponge function
sponge::apply_round(&mut self.sponge, op_code as u128, op_value, self.step - 1);
// copy the new sponge state into the sponge_trace registers
for i in 0..SPONGE_WIDTH {
self.sponge_trace[i][self.step] = self.sponge[i];