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

Function scheduling_64_padding

bitvm/src/hash/sha256_u4_stack.rs:27–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25];
26
27fn scheduling_64_padding() -> [u32; 64] {
28 const PADDING_64_BYTES: [u32; 16] = [
29 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
30 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
31 0x00000000, 0x00000200,
32 ];
33 let mut result = [0; 64];
34 result[..16].clone_from_slice(PADDING_64_BYTES.as_ref());
35
36 for i in 16..64 {
37 let s0 = result[i - 15].rotate_right(7)
38 ^ result[i - 15].rotate_right(18)
39 ^ (result[i - 15] >> 3);
40 let s1 =
41 result[i - 2].rotate_right(17) ^ result[i - 2].rotate_right(19) ^ (result[i - 2] >> 10);
42 result[i] = result[i - 16]
43 .wrapping_add(s0)
44 .wrapping_add(result[i - 7])
45 .wrapping_add(s1);
46 }
47 result
48}
49
50pub fn u4_number_to_nibble(n: u32) -> Script {
51 //constant number used during "compile" time

Callers 1

sha256_stackFunction · 0.85

Calls 1

as_refMethod · 0.80

Tested by

no test coverage detected