#cipher #range #numbers #perfect #blackrock #randomizing #perfect-rng

perfect_rand

A cipher for randomizing numbers in an arbitrary range

6 releases

0.1.5 Apr 23, 2023
0.1.4 Apr 23, 2023

#1384 in Cryptography

Download history 21/week @ 2024-02-16 166/week @ 2024-02-23 39/week @ 2024-03-01 26/week @ 2024-03-08 16/week @ 2024-03-15 4/week @ 2024-03-22 26/week @ 2024-03-29 9/week @ 2024-04-05 7/week @ 2024-04-12 14/week @ 2024-04-19

56 downloads per month

Unlicense

16KB
254 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.

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

~310KB