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 type str to the target hash. This is the hashing function.
  • hash_str_repr_to_hash_type_fn Function that can take the argument target_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.

Hashes a value.

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.

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.