pub struct ParanoidHash { /* private fields */ }
Expand description

SecureHash Hashing Constructor

This struct is used to get the configuration for hashing

Implementations

New Hasher

This method allows you to construct the hasher.

It accepts the following:

  • BLAKE2B Digest Size In Bytes [1-64]
  • Operating System Hash Function {SHA1,SHA256,SHA512}

You can choose to use the default if you want optimal security.

Example Code
use paranoid_hash::{ParanoidHash,OsAlgorithm};
 
fn main(){
    let context = ParanoidHash::new(64,OsAlgorithm::SHA256);
}
Read With Key

This method reads the file and uses a key with the Blake2b hash function. It does not and cannot use the key with the operating system hash function.

Read useing std::fs

This function allows you to read files using std::fs. This is rust’s default way of reading files.

Read String

This function will allow you to take a String or str, convert it to bytes, then hash it.

Read Bytes

This function will hash bytes and return the output as two seperate strings.

decode_from_hex()

decode_from_hex() (which was as_bytes()) converts from a Hexadecimal String to a Vector of Bytes

Return Digest Size

This method will return the provided digest size that the struct contains. It should be between 1 and 64 of type usize.

Return Operating System Hash Function

This method will return the hash function used by the operating system that was chosen

Compare Hash

Notice: This function attempts to use constant-time operations in comparing strings based on this.

Description: Compares two hash functions (case-insensitive) and if they are the same, returns true. If they are different, returns false.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.