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

Function sha256_32bytes

bitvm/src/hash/sha256.rs:71–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71pub fn sha256_32bytes() -> Script {
72 script! {
73 {push_reverse_bytes_to_alt(32)}
74
75 // top of stack: [ [n bytes input] ]
76 {u8_push_xor_table()}
77 {sha256_k()}
78 // top of stack: [ [64 byte chunks]... ]
79 {padding_add_roll(32)}
80 {sha256_init()}
81 // top of stack: [ [64 byte chunks]..., state[0-7]]
82 {sha256_transform_32bytes(8 + 16 + 64 + 1, 8 + 16)}
83
84 {sha256_final()}
85 for _ in 0..8 {
86 {u32_toaltstack()}
87 }
88 for _ in 0..64 {
89 {u32_drop()}
90 }
91 {u8_drop_xor_table()}
92
93 for _ in 0..8 {
94 {u32_fromaltstack()}
95 }
96 }
97}
98
99pub fn sha256_80bytes() -> Script {
100 script! {

Callers 1

sha256Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected