Crate ascon_hash

source ·
Expand description

RustCrypto: Ascon

crate Docs Apache2/MIT licensed Rust Version Project Chat Build Status

Pure Rust implementation of the lightweight cryptographic hash functions AsconHash and AsconAHash and the extendable output functions (XOF) AsconXOF and AsconAXOF.

Documentation

Security Notes

No security audits of this crate have ever been performed.

USE AT YOUR OWN RISK!

Minimum Supported Rust Version

This crate requires Rust 1.56 at a minimum.

We may change the MSRV in the future, but it will be accompanied by a minor version bump.

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Usage (Hashing)

use ascon_hash::{AsconHash, Digest}; // Or `AsconAHash`

let mut hasher = AsconHash::new();
hasher.update(b"some bytes");
let digest = hasher.finalize();
assert_eq!(&digest[..], b"\xb7\x42\xca\x75\xe5\x70\x38\x75\x70\x59\xcc\xcc\x68\x74\x71\x4f\x9d\xbd\x7f\xc5\x92\x4a\x7d\xf4\xe3\x16\x59\x4f\xd1\x42\x6c\xa8");

Usage (XOF)

use ascon_hash::{AsconXof, ExtendableOutput, Update, XofReader};

let mut xof = AsconXof::default();
xof.update(b"some bytes");
let mut reader = xof.finalize_xof();
let mut dst = [0u8; 5];
reader.read(&mut dst);
assert_eq!(&dst, b"\xc2\x19\x72\xfd\xe9");

Re-exports

Structs

Traits

  • Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
  • Trait for hash functions with extendable-output (XOF).
  • Resettable types.
  • Types which consume data with byte granularity.
  • Trait for reader types which are used to extract extendable output from a XOF (extendable-output function) result.

Type Definitions