# Trait ethcore_util::common::hash::FixedHash [−] [src]

    pub trait FixedHash {
        fn new() -> Self;
        fn zero() -> Self;
        fn random() -> Self;
        fn randomize(&mut self);
        fn len() -> usize;
        fn from_slice(src: &[u8]) -> Self;
        fn clone_from_slice(&mut self, src: &[u8]) -> usize;
        fn copy_to(&self, dest: &mut [u8]);
        fn contains(&'a self, b: &'a Self) -> bool;
        fn is_zero(&self) -> bool;
        fn low_u64(&self) -> u64;
    }

Trait for a fixed-size byte array to be used as the output of hash functions.

## Required Methods

### `fn new() -> Self`

Create a new, zero-initialised, instance.

### `fn zero() -> Self`

Synonym for `new()`. Prefer to new as it's more readable.

### `fn random() -> Self`

Create a new, cryptographically random, instance.

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

Assign self have a cryptographically random value.

### `fn len() -> usize`

Get the size of this object in bytes.

### `fn from_slice(src: &[u8]) -> Self`

Convert a slice of bytes of length `len()` to an instance of this type.

### `fn clone_from_slice(&mut self, src: &[u8]) -> usize`

Assign self to be of the same value as a slice of bytes of length `len()`.

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

Copy the data of this object into some mutable slice of length `len()`.

### `fn contains(&'a self, b: &'a Self) -> bool`

Returns `true` if all bits set in `b` are also set in `self`.

### `fn is_zero(&self) -> bool`

Returns `true` if no bits are set.

### `fn low_u64(&self) -> u64`

Returns the lowest 8 bytes interpreted as a BigEndian integer.

## Implementors

- `impl FixedHash for H32`
- `impl FixedHash for H64`
- `impl FixedHash for H128`
- `impl FixedHash for H160`
- `impl FixedHash for H256`
- `impl FixedHash for H264`
- `impl FixedHash for H512`
- `impl FixedHash for H520`
- `impl FixedHash for H1024`
- `impl FixedHash for H2048`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand 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`)