docs

core::crypto::sha3

本页内容

API 参考只有英文版,由标准库源代码中的英文文档注释生成。

SHA-3 (FIPS 202): SHA3-256, SHA3-512 and the SHAKE128 / SHAKE256 extendable-output functions, all over Keccak-f[1600]. The types here are the low-level form: one fixed function each, no algorithm chosen at run time. HashAlgorithm::Sha3_256 / Sha3_512 with Digest, Hmac and hkdf is the form chosen at run time.

Structs

Sha3_256Source

pub struct Sha3_256

SHA3-256, fixed at compile time: 32-byte digests. The same function as Digest::new(HashAlgorithm::Sha3_256).

  • pub const OUTPUT_LEN: usize = 32§

    Source

    The digest length in bytes.

  • pub const fn new() -> Sha3_256§

    Source

    An empty running hash.

  • pub fn digest<B: AsBytes>(data: B) -> List<u8>§

    Source

    The 32-byte SHA3-256 digest of data, in one call.

  • pub fn update<B: AsBytes>(ref self, data: B)§

    Source

    Feed data into the hash; call finish for the digest.

  • pub const fn finish(self) -> List<u8>§

    Source

    The 32-byte digest of everything fed so far.

Trait implementations 1

Sha3_512Source

pub struct Sha3_512

SHA3-512, fixed at compile time: 64-byte digests. The same function as Digest::new(HashAlgorithm::Sha3_512).

  • pub const OUTPUT_LEN: usize = 64§

    Source

    The digest length in bytes.

  • pub const fn new() -> Sha3_512§

    Source

    An empty running hash.

  • pub fn digest<B: AsBytes>(data: B) -> List<u8>§

    Source

    The 64-byte SHA3-512 digest of data, in one call.

  • pub fn update<B: AsBytes>(ref self, data: B)§

    Source

    Feed data into the hash; call finish for the digest.

  • pub const fn finish(self) -> List<u8>§

    Source

    The 64-byte digest of everything fed so far.

Trait implementations 1

Shake128Source

pub struct Shake128

SHAKE128: update the input, then squeeze output in any pieces. update after the first squeeze is not allowed.

  • pub const fn new() -> Shake128§

    Source

    An empty sponge.

  • pub fn update<B: AsBytes>(ref self, data: B)§

    Source

    Feed data in; call squeeze for output.

  • pub const fn squeeze(ref self, n: usize) -> List<u8>§

    Source

    The next n bytes of output.

Trait implementations 1

Shake256Source

pub struct Shake256

SHAKE256, like Shake128.

  • pub const fn new() -> Shake256§

    Source

    An empty sponge.

  • pub fn update<B: AsBytes>(ref self, data: B)§

    Source

    Feed data in; call squeeze for output.

  • pub const fn squeeze(ref self, n: usize) -> List<u8>§

    Source

    The next n bytes of output.

Trait implementations 1