Struct mostinefficientsha::sha::Sha256 [] [src]

pub struct Sha256 {
    pub data: Vec<U>,
    pub input_data_len_in_bits: usize,
    pub digest: Vec<U>,
}

This struct does a lazy SHA-256 hash calculation with fuzzy f64 bits. It first creates a tree of thouthands of Terms that represent the bitwise calculations needed to calculate the final hash. It then calculates that hash by evaluating the Terms that represent the bits of the final 256 bit hash value.

It can do this evaluation to f64 fuzzy bits or to a [8;u32] or ascii representation of the hash by rounding the f64s.

The input data is made of Symbol type Terms, that have to be set before evaluation.

Fields

The original input data. Some of the trailing bits may have been replaced. See new().

The final tree structure is hidden here.

Methods

impl Sha256
[src]

Create a new tree of Terms, that lazily calculates the SHA-256 hash of data.

len_message_in_last_u_in_bits is the number of bits in data.last() that are part of the input data. All following bits in data.last() will be ignored (and replaced).

You can access data afterwards using the data field.

This function just does SHA-256, but with Us instead of u32s.

Resets the cache of all RTerms within the Term tree.

Evaluates the digest/hash result into u32s by rounding the f64 bits.

Evaluates the digest/hash result into its ascii hash representation by rounding the f64 bits.

Evaluates the digest/hash results into 256 f64s.

returnval[0] is the MSBit of the first byte. The first byte corresponds to the start of the ascii hash representation.

Returns the number of Terms that were created to represent this instance of the SHA-256 algorithm. The number depends heavily on the length of the input data.

Returns the number of Terms that would make the flattened version of the tree of each bit of the digest.

Max stack size needed when evaluating each bit of the digest recursively.

It also returns the maximum logic depth.

Returns: (max_logic_depth, max_stacksize)

Returns a String describing the statistics. Same as debug print.

Trait Implementations

impl Debug for Sha256
[src]

Formats the value using the given formatter.