| 206 | } |
| 207 | |
| 208 | pub fn maj_calculation(a: u32, b: u32, c: u32, offset_and: u32) -> Script { |
| 209 | script! { |
| 210 | for nib in 0..8 { |
| 211 | |
| 212 | { a + 7 } // a_nib_pos |
| 213 | OP_PICK // a[nib] |
| 214 | |
| 215 | { b + 7 + 1 } // a b_nib_pos |
| 216 | OP_PICK // a b |
| 217 | OP_2DUP // a b a b |
| 218 | |
| 219 | { u4_xor_with_half_and_table(nib + offset_and + 4) } // a b (a^b) |
| 220 | |
| 221 | { c + 7 + 3 } // a b (a^b) c_nib_pos |
| 222 | OP_PICK // a b (a^b) c |
| 223 | |
| 224 | { u4_half_table_operation(nib + offset_and + 4) } // a b ((a^b) & c) |
| 225 | OP_ROT |
| 226 | OP_ROT // ((a^b) & c) a b |
| 227 | |
| 228 | { u4_half_table_operation(nib + offset_and + 3) } // ((a^b) & c) (a & b) |
| 229 | |
| 230 | { u4_xor_with_half_and_table(nib + offset_and + 2) } // ((a^b) & c) ^ (a & b) |
| 231 | |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | pub fn schedule_iteration( |
| 237 | i: u32, |