#port-scan #cipher #numbers #range #order #masscan #blackrock

perfect_rand

A cipher for randomizing numbers in an arbitrary range

8 releases

new 0.3.0 Dec 7, 2024
0.2.0 Jul 1, 2024
0.1.5 Apr 23, 2023

#933 in Cryptography

Download history 7/week @ 2024-08-10 6/week @ 2024-08-17 3/week @ 2024-08-24 20/week @ 2024-09-14 16/week @ 2024-09-21 4/week @ 2024-09-28 5/week @ 2024-10-05 19/week @ 2024-10-12 13/week @ 2024-10-19 13/week @ 2024-10-26 34/week @ 2024-11-02 20/week @ 2024-11-09 8/week @ 2024-11-16 1/week @ 2024-11-23

67 downloads per month

Unlicense

13KB
250 lines

perfect_rand

docs.rs

A port of the Blackrock cipher used in Masscan to Rust.

Its original purpose is efficiently randomizing the order of port scans without having to put every possible target in memory and shuffling.


lib.rs:

A port of the Blackrock cipher used in Masscan to Rust.

Its original purpose is efficiently randomizing the order of port scans without having to put every possible target in memory and shuffling.

Original code.

The DES S-boxes have been replaced with the SipHash round function.

Example

//! Print 10 random IPv4 addresses.


let randomizer = PerfectRng::from_range(2u64.pow(32));
for i in 0..10 {
    let randomized_ip = Ipv4Addr::from(randomizer.shuffle(i) as u32);
    println!("{randomized_ip:?}");
}

Dependencies

~315KB