pub struct CrackParameter<T: CrackTarget> { /* private fields */ }
Expand description

Crack parameter for crate::crack<T: CrackTarget>(). It combines the basic struct BasicCrackParameter with the generic TargetHashAndHashFunction. This separation exists so that hash selection functions can be written more convenient.

use libbruteforce::{BasicCrackParameter, CrackParameter, TargetHashInput};
use libbruteforce::hash_fncs::sha256_hashing;
use libbruteforce::symbols;

// sha256("a+c")
let sha256_hash = "3d7edde33628331676b39e19a3f2bdb3c583960ad8d865351a32e2ace7d8e02d";
let max_len = 3;
let min_len = 0;
let alphabet = symbols::Builder::new().with_digits().build();

let res = CrackParameter::new(
        BasicCrackParameter::new(alphabet, max_len, min_len, false),
        sha256_hashing(TargetHashInput::HashAsStr(sha256_hash)),
);

Implementations

Constructor.

use libbruteforce::{BasicCrackParameter, CrackParameter, TargetHashInput};
use libbruteforce::hash_fncs::sha256_hashing;
use libbruteforce::symbols;

// sha256("a+c")
let sha256_hash = "3d7edde33628331676b39e19a3f2bdb3c583960ad8d865351a32e2ace7d8e02d";
let max_len = 3;
let min_len = 0;
let alphabet = symbols::Builder::new().with_digits().build();

let res = CrackParameter::new(
        BasicCrackParameter::new(alphabet, max_len, min_len, false),
        sha256_hashing(TargetHashInput::HashAsStr(sha256_hash)),
);

Convenient wrapper for BasicCrackParameter::alphabet.

Convenient wrapper for BasicCrackParameter::max_length.

Convenient wrapper for BasicCrackParameter::min_length.

Convenient wrapper for BasicCrackParameter::fair_mode.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.