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

Function le_to_be_byte_array

bitvm/src/chunk/helpers.rs:79–88  ·  view source on GitHub ↗
(byte_array: Vec<u8>)

Source from the content-addressed store, hash-verified

77 }
78
79 fn le_to_be_byte_array(byte_array: Vec<u8>) -> Vec<u8> {
80 assert!(
81 byte_array.len() % 4 == 0,
82 "Byte array length must be a multiple of 4"
83 );
84 byte_array
85 .chunks(4) // Process each group of 4 bytes (one u32)
86 .flat_map(|chunk| chunk.iter().rev().cloned()) // Reverse each chunk
87 .collect()
88 }
89 le_to_be_byte_array(msg_bytes)
90 }
91

Callers 1

nib_to_byte_arrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected