Function utils::md5::find_hash_with_appended_count

source ·
pub fn find_hash_with_appended_count(
    prefix: &str,
    additional_hashes: u32,
    predicate: impl Fn(u32, [u32; 4]) -> bool + Copy + Sync,
)
Expand description

Brute force hashes of a prefix followed by an increasing integer.

This function calls the predicate repeatedly until it returns true from a pool of worker threads each using the FASTEST supported vectorized MD5 implementation to hash multiple inputs at once.

When additional_hashes is zero, the predicate will be called with:

predicate(i, hash(prefix + i.to_string()))

When additional_hashes is more than zero, key stretching is used. For example, passing 2 will cause the predicate to be called with:

predicate(i, hash(to_hex(hash(to_hex(hash(prefix + i.to_string()))))))