Crate ascon_hash

Source
Expand description

§Ascon hashes

Pure Rust implementation of the lightweight cryptographic hash function AsconHash256 and the extendable output functions (XOF) AsconXOF128.

§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.85 at a minimum.

§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::{AsconHash256, Digest};

let mut hasher = AsconHash256::new();
hasher.update(b"some bytes");
let digest = hasher.finalize();
assert_eq!(&digest[..], b"\xe9\x09\xc2\xf6\xda\x9c\xb3\x02\x84\x23\x26\x5c\x8f\x23\xfc\x2d\x26\xbf\xc0\xf3\xdb\x70\x46\x83\xef\x16\xb7\x87\xa9\x45\xed\x68");

§Usage (XOF)

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

let mut xof = AsconXof128::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"\x8c\x7d\xd1\x14\xa0");

Re-exports§

pub use digest;

Structs§

AsconCore
Ascon hash implementation
AsconXofCore
Ascon XOF
AsconXofReaderCore
Reader for XOF output

Traits§

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

Type Aliases§

AsconHash256
Ascon-Hash256
AsconXof128
Ascon-XOF128
AsconXof128Reader
Reader for AsconXOF output