| nonce<12> | encrypt( time_bytes<8> | magic_bytes<32> ) |
| encrypt( rand_len<8> | random_padding<rand_len> | data | digest<64> ) |
rand_len<8> | random_padding<rand_len>
: random content and its length in i64; to eliminate the characteristics of packet lengthdata
: raw datadigest<64>
: digest(rand_len<8> | random_padding<rand_len> | data)
to ensure integritynonce
into bloom filter without checking packet validnesslet nonce = unsafe { from_u8_array::<Nonce<Aes256Gcm>>(&buffer[len - NONCE_LEN..len]) };
// ...
if filters.0.check(&nonce) || filters.1.check(&nonce) {
eprintln!("Replay suspected");
continue;
}
filters.1.set(&nonce);
let res = cipher.decrypt(&nonce, &buffer[..len - NONCE_LEN]);
if res.is_err() {
continue;
}
# wgetflood.sh
for ((;;))
do
wget 127.0.0.1:80/large.txt -O /dev/null > /dev/null 2>&1 &
done