]> code.octet-stream.net Git - m17rt/blob - m17core/src/random.rs
Start handling TNC->host messages with KissBuffer
[m17rt] / m17core / src / random.rs
1 //! Randomiser for frame payloads
2
3 const RANDOM_SEQ: [u8; 46] = [
4 0xD6, 0xB5, 0xE2, 0x30, 0x82, 0xFF, 0x84, 0x62, 0xBA, 0x4E, 0x96, 0x90, 0xD8, 0x98, 0xDD, 0x5D,
5 0x0C, 0xC8, 0x52, 0x43, 0x91, 0x1D, 0xF8, 0x6E, 0x68, 0x2F, 0x35, 0xDA, 0x14, 0xEA, 0xCD, 0x76,
6 0x19, 0x8D, 0xD5, 0x80, 0xD1, 0x33, 0x87, 0x13, 0x57, 0x18, 0x2D, 0x29, 0x78, 0xC3,
7 ];
8
9 pub fn random_xor(data: &mut [u8]) {
10 for (idx, byte) in data.iter_mut().enumerate() {
11 *byte ^= RANDOM_SEQ[idx % 46];
12 }
13 }