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

Function schedule_iteration

bitvm/src/hash/sha256_u4.rs:236–254  ·  view source on GitHub ↗
(
    i: u32,
    offset_top_sched: u32,
    offset_rot: u32,
    offset_and: u32,
    offset_add: u32,
    use_add_table: bool,
    do_xor_with_and: bool,
)

Source from the content-addressed store, hash-verified

234}
235
236pub fn schedule_iteration(
237 i: u32,
238 offset_top_sched: u32,
239 offset_rot: u32,
240 offset_and: u32,
241 offset_add: u32,
242 use_add_table: bool,
243 do_xor_with_and: bool,
244) -> Script {
245 script! {
246 { calculate_s( offset_top_sched - get_w_pos(i-15), offset_rot, offset_and, vec![7,18,3], true, do_xor_with_and)}
247 { calculate_s( offset_top_sched - get_w_pos(i-2), offset_rot, offset_and, vec![17,19,10], true, do_xor_with_and)}
248 { u4_fromaltstack(16) }
249 { u4_copy_u32_from(offset_top_sched - get_w_pos(i-16)+16 )} // this can be avoided arranging directly with roll
250 { u4_copy_u32_from(offset_top_sched - get_w_pos(i-7)+24 )}
251 { u4_add(8, vec![0, 8, 16, 24], offset_add + 32, use_add_table )}
252 { u4_fromaltstack(8) }
253 }
254}
255
256fn get_full_w_pos(top_table: u32, i: u32) -> u32 {
257 top_table - (i + 1) * 8

Callers 1

test_sizesFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_sizesFunction · 0.68