# [−] Trait bitcrypto::Digest

    pub trait Digest {
        fn input(&mut self, input: &[u8]);
        fn result(&mut self, out: &mut [u8]);
        fn reset(&mut self);
        fn output_bits(&self) -> usize;
        fn block_size(&self) -> usize;

        fn output_bytes(&self) -> usize { ... }
        fn input_str(&mut self, input: &str) { ... }
        fn result_str(&mut self) -> String { ... }
    }

The Digest trait specifies an interface common to digest functions, such as SHA-1 and the SHA-2 family of digest functions.

## Required Methods

### `fn input(&mut self, input: &[u8])`

Provide message data.

# Arguments

- input - A vector of message data

### `fn result(&mut self, out: &mut [u8])`

Retrieve the digest result. This method may be called multiple times.

# Arguments

- out - the vector to hold the result. Must be large enough to contain output_bits().

### `fn reset(&mut self)`

Reset the digest. This method must be called after result() and before supplying more data.

### `fn output_bits(&self) -> usize`

Get the output size in bits.

### `fn block_size(&self) -> usize`

Get the block size in bytes.

## Provided Methods

### `fn output_bytes(&self) -> usize`

Get the output size in bytes.

### `fn input_str(&mut self, input: &str)`

Convenience function that feeds a string into a digest.

# Arguments

- `input` The string to feed into the digest

### `fn result_str(&mut self) -> String`

Convenience function that retrieves the result of a digest as a String in hexadecimal format.

## Implementations on Foreign Types

###

`impl Digest for Whirlpool`

####

`fn input(&mut self, source: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha512Trunc256`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Blake2s`

####

`fn reset(&mut self)` |

####

`fn input(&mut self, msg: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Md5`

####

`fn input(&mut self, input: &[u8])` |

####

`fn reset(&mut self)` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha384`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha3`

####

`fn input(&mut self, data: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha224`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Ripemd160`

####

`fn reset(&mut self)` |

Resets the hash to its original state also clearing the buffer. To be used in between hashing separate messages to avoid having to recreate and allocate the whole structure.

####

`fn input(&mut self, msg: &[u8])` |

Adds the input `msg` to the hash. This method can be called repeatedly for use with streaming messages.

####

`fn result(&mut self, out: &mut [u8])` |

Returns the resulting digest of the entire message. Note: `out` must be at least 20 bytes (160 bits)

####

`fn output_bits(&self) -> usize` |

Returns the size of the digest in bits

####

`fn block_size(&self) -> usize` |

Returns the block size the hash operates on in bytes

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha1`

####

`fn reset(&mut self)` |

####

`fn input(&mut self, msg: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha256`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha512`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Sha512Trunc224`

####

`fn input(&mut self, d: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn reset(&mut self)` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for Blake2b`

####

`fn reset(&mut self)` |

####

`fn input(&mut self, msg: &[u8])` |

####

`fn result(&mut self, out: &mut [u8])` |

####

`fn output_bits(&self) -> usize` |

####

`fn block_size(&self) -> usize` |

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

## Implementors

###

`impl Digest for DHash160`

[src]

####

`fn input(&mut self, d: &[u8])`

[src]

####

`fn result(&mut self, out: &mut [u8])`

[src]

####

`fn reset(&mut self)`

[src]

####

`fn output_bits(&self) -> usize`

[src]

####

`fn block_size(&self) -> usize`

[src]

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

###

`impl Digest for DHash256`

[src]

####

`fn input(&mut self, d: &[u8])`

[src]

####

`fn result(&mut self, out: &mut [u8])`

[src]

####

`fn reset(&mut self)`

[src]

####

`fn output_bits(&self) -> usize`

[src]

####

`fn block_size(&self) -> usize`

[src]

####

`fn output_bytes(&self) -> usize` |

####

`fn input_str(&mut self, input: &str)` |

####

`fn result_str(&mut self) -> String` |

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)