Struct keccak_rust::Keccak[][src]

pub struct Keccak { /* fields omitted */ }

An implementation of keccak functions. The Keccak reference.

Example

[dependencies]
keccak-rust = *
extern crate keccak_rust;
use keccak_rust::*;

const YOUR_INPUT_BYTES: [u8; 12] = [72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];

fn main() {
    let mut keccak = Keccak::new(SecurityLevel::SHA256, StateBitsWidth::F1600);
    keccak.append(&mut YOUR_INPUT_BYTES);
    println!("{:?}", keccak.hash());
}

Implementations

impl Keccak[src]

pub fn new(security: SecurityLevel, width: StateBitsWidth) -> Keccak[src]

Creates a new keccak state with a provided security level and state bits width.

Possible securities levels:

  • SHA224 (224 bit)
  • SHA256 (256 bit)
  • SHA384 (384 bit)
  • SHA512 (512 bit)

Possible state bits widths:

  • f25
  • f50
  • f100
  • f200
  • f400
  • f800
  • f1600

pub fn append(&mut self, input: &BytesArr)[src]

Appends input to current state

pub fn hash(&mut self) -> BytesVec[src]

Returns keccak hash based on current state

Auto Trait Implementations

impl RefUnwindSafe for Keccak

impl Send for Keccak

impl Sync for Keccak

impl Unpin for Keccak

impl UnwindSafe for Keccak

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.