Pure Rust implementation of the lightweight cryptographic hash functions AsconHash and AsconAHash and the extendable output functions (XOF) AsconXOF and AsconAXOF.
No security audits of this crate have ever been performed.
USE AT YOUR OWN RISK!
Fixed output size hashing:
use ascon_hash::{AsconHash, Digest};
use hex_literal::hex;
let mut hasher = AsconHash::new();
hasher.update(b"some bytes");
let hash = hasher.finalize();
assert_eq!(hash, hex!("b742ca75e57038757059cccc6874714f9dbd7fc5924a7df4e316594fd1426ca8"));
XOF hashing:
use ascon_hash::{AsconXof, ExtendableOutput, Update, XofReader};
use hex_literal::hex;
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, hex!("c21972fde9"));
Also, see the examples section in the RustCrypto/hashes readme.
This crate requires Rust 1.71 at a minimum.
We may change the MSRV in the future, but it will be accompanied by a minor version bump.
The crate is licensed under either of:
at your option.
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.