Struct libbruteforce::TargetHashAndHashFunction
source · [−]pub struct TargetHashAndHashFunction<T: CrackTarget> { /* private fields */ }
Expand description
Abstraction over a hashing algorithm and the target hash that needs to be cracked.
T
is of type CrackTarget
. This generic struct exists so that hashes of type
CrackTarget
can be checked independent of the hashing algorithm. This is
more efficient than transforming every hash to a string and compare the hash
string representations afterwards.
Implementations
Constructor that takes a hashing function and a target hash.
Parameters
target_hash
String representation of the target hash we want to crack. This is usually the hex string representation of a sha256 hash or so.hash_fn
Transforms a plain input password/guess of typestr
to the target hash. This is the hashing function.hash_str_repr_to_hash_type_fn
Function that can take the argumenttarget_hash
and transform it to the target hashing type. This usually transforms the hex string that represents the hash to bytes in memory.hash_type_to_str_repr_fn
Function that transform the hash type to a string representation. Usually, this will return a hex string that represents the hash.
Transforms the (hex) string representation into the type the hash implementation uses to represent hashes.
Returns the target hash that we want to crack.
Returns a (hex) string representation of the hash.
Hashes the input value and returns if it equals the target hash. If so, the hash got cracked.