keccakrs

Crates.iokeccakrs
lib.rskeccakrs
version0.1.6
sourcesrc
created_at2017-10-11 06:47:26.683684
updated_at2017-10-17 05:26:00.763197
descriptionA verbose, readable implementation of Keccak in Rust
homepagehttps://github.com/botagar/keccakrs
repositoryhttps://github.com/botagar/keccakrs
max_upload_size
id35193
size180,048
(botagar)

documentation

README

Add to Cargo.toml

[dependencies]
keccakrs = "*"

In your code, use as follow:

extern crate keccakrs;
use keccakrs::*;

fn main() {
  let mut keccak = keccakrs::Keccak::new(1088usize, 512usize);
  /* Other options include:
  *  keccak = keccakrs::new_keccak1600_224();
  *  keccak = keccakrs::new_keccak1600_256();
  *  keccak = keccakrs::new_keccak1600_384();
  *  keccak = keccakrs::new_keccak1600_512();
  */

  let input = &mut String::from("Hello World");
  
  keccak.injest(input);

  let output: Vec<u8> = keccak.hash();
  let state: Vec<u64> = keccak.get_internal_state();
}

This package is under development. Use at own risk.

The primary goal of this code base is to present a easy to read and understand implementation of Keccak.

(This is not a particularly fast implementation of Keccak, but it utilises NO unsafe code)

test perf_k_256_empty_input ... bench:       2,603 ns/iter (+/- 463)
test perf_k_256_long_input  ... bench:       6,348 ns/iter (+/- 2,624)
test perf_k_512_empty_input ... bench:       2,560 ns/iter (+/- 442)
test perf_k_512_long_input  ... bench:       8,917 ns/iter (+/- 1,638)
Commit count: 31

cargo fmt