(byte_array: Vec<u8>)
| 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 |