Crate sha3 [] [src]

An implementation of the SHA-3 cryptographic hash algorithms.

There are 6 standard algorithms specified in the SHA-3 standard:

  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA3-512
  • SHAKE128, an extendable output function (XOF)
  • SHAKE256, an extendable output function (XOF)
  • Keccak224, Keccak256, Keccak384, Keccak512 (NIST submission without padding changes)

Usage

An example of using SHA3-256 is:

use sha3::{Digest, Sha3_256};

// create a SHA3-256 object
let mut hasher = Sha3_256::new();

// write input message
hasher.input(b"abc");

// read hash digest
let out = hasher.result();

assert_eq!(out[..], [0x3a, 0x98, 0x5d, 0xa7, 0x4f, 0xe2, 0x25, 0xb2,
                     0x04, 0x5c, 0x17, 0x2d, 0x6b, 0xd3, 0x90, 0xbd,
                     0x85, 0x5f, 0x08, 0x6e, 0x3e, 0x9d, 0x52, 0x5b,
                     0x46, 0xbf, 0xe2, 0x45, 0x11, 0x43, 0x15, 0x32]);

Structs

Sha3

Generic SHA-3 hasher. Type arguments meaning: N -- digest len, K -- rate and block size, M -- padding property

Traits

Digest

The Digest trait specifies an interface common to digest functions

Type Definitions

Keccak224
Keccak256
Keccak384
Keccak512
Sha3_224
Sha3_256
Sha3_384
Sha3_512
Shake128
Shake256