MCPcopy Create free account
hub / github.com/BitVM/BitVM / ch1_calculation_nib_stack

Function ch1_calculation_nib_stack

bitvm/src/hash/sha256_u4_stack.rs:190–215  ·  view source on GitHub ↗
(
    stack: &mut StackTracker,
    e: StackVariable,
    f: StackVariable,
    g: StackVariable,
    nib: u32,
    lookup: StackVariable,
    xortable: StackVariable,
    shift_table: StackVariable,

Source from the content-addressed store, hash-verified

188
189#[allow(clippy::too_many_arguments)]
190pub fn ch1_calculation_nib_stack(
191 stack: &mut StackTracker,
192 e: StackVariable,
193 f: StackVariable,
194 g: StackVariable,
195 nib: u32,
196 lookup: StackVariable,
197 xortable: StackVariable,
198 shift_table: StackVariable,
199) -> StackVariable {
200 stack.copy_var(g); // g[nib]
201 stack.op_dup(); // g g
202
203 stack.copy_var(f); // g g f[nib]
204
205 u4_logic_with_table_stack(stack, lookup, xortable); // g (g^f)
206
207 stack.copy_var(e); // // g (g^f) e
208
209 u4_and_with_xor_stack(stack, lookup, xortable, shift_table); // g (g^f & e)
210
211 let var = u4_logic_with_table_stack(stack, lookup, xortable); // g ^ ((f ^ g) & e)
212
213 stack.rename(var, format!("ch_i_{}", nib).as_str());
214 var
215}
216
217#[allow(clippy::too_many_arguments)]
218pub fn maj1_calculation_nib_stack(

Callers 1

sha256_stackFunction · 0.85

Calls 2

u4_and_with_xor_stackFunction · 0.85

Tested by

no test coverage detected