Skip to content

Commit e6bc891

Browse files
authored
ascon-hash: adopt changes from NIST draft (fixes #667) (#668)
1 parent dd9a52c commit e6bc891

File tree

9 files changed

+2109
-10490
lines changed

9 files changed

+2109
-10490
lines changed

ascon-hash/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- Edition changed to 2024 and MSRV bumped to 1.85 ([#652])
1010
- Relax MSRV policy and allow MSRV bumps in patch releases
1111
- Update to `digest` v0.11
12+
- Adopt to changes from NIST draft
13+
- Remove `AsconAHash` and `AsconAXof`
14+
- Rename `AsonHash` to `AsconHAsh256`
15+
- Rename `AsconXof` to `AsconXof128`
1216

1317
[#652]: https://github.com/RustCrypto/hashes/pull/652
1418

ascon-hash/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ascon-hash"
33
version = "0.3.0-pre"
4-
description = "Implementation of the Ascon and AsconA hashes and XOFs"
4+
description = "Implementation of Ascon-Hash256 and Ascon-XOF256"
55
authors = [
66
"Sebastian Ramacher <[email protected]>",
77
"RustCrypto Developers",

ascon-hash/README.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
![Rust Version][rustc-image]
88
[![Project Chat][chat-image]][chat-link]
99

10-
Pure Rust implementation of the lightweight cryptographic hash functions
11-
[AsconHash and AsconAHash][1] and the extendable output functions (XOF) AsconXOF
12-
and AsconAXOF.
10+
Pure Rust implementation of the lightweight cryptographic hash function
11+
[AsconHash256][1] and the extendable output functions (XOF) AsconXOF256.
1312

1413
## Security Notes
1514

@@ -20,31 +19,31 @@ USE AT YOUR OWN RISK!
2019
## Examples
2120
Fixed output size hashing:
2221
```rust
23-
use ascon_hash::{AsconHash, Digest};
22+
use ascon_hash::{AsconHash256, Digest};
2423
use hex_literal::hex;
2524

26-
let mut hasher = AsconHash::new();
25+
let mut hasher = AsconHash256::new();
2726
hasher.update(b"some bytes");
2827
let hash = hasher.finalize();
2928

30-
assert_eq!(hash, hex!("b742ca75e57038757059cccc6874714f9dbd7fc5924a7df4e316594fd1426ca8"));
29+
assert_eq!(hash, hex!("e909c2f6da9cb3028423265c8f23fc2d26bfc0f3db704683ef16b787a945ed68"));
3130

3231
// Hex-encode hash using https://docs.rs/base16ct
3332
let hex_hash = base16ct::lower::encode_string(&hash);
34-
assert_eq!(hex_hash, "b742ca75e57038757059cccc6874714f9dbd7fc5924a7df4e316594fd1426ca8");
33+
assert_eq!(hex_hash, "e909c2f6da9cb3028423265c8f23fc2d26bfc0f3db704683ef16b787a945ed68");
3534
```
3635

3736
XOF hashing:
3837
```rust
39-
use ascon_hash::{AsconXof, ExtendableOutput, Update, XofReader};
38+
use ascon_hash::{AsconXof128, ExtendableOutput, Update, XofReader};
4039
use hex_literal::hex;
4140

42-
let mut xof = AsconXof::default();
41+
let mut xof = AsconXof128::default();
4342
xof.update(b"some bytes");
4443
let mut reader = xof.finalize_xof();
4544
let mut dst = [0u8; 5];
4645
reader.read(&mut dst);
47-
assert_eq!(dst, hex!("c21972fde9"));
46+
assert_eq!(dst, hex!("8c7dd114a0"));
4847
```
4948

5049
Also, see the [examples section] in the RustCrypto/hashes readme.
@@ -79,5 +78,5 @@ dual licensed as above, without any additional terms or conditions.
7978

8079
[//]: # (general links)
8180

82-
[1]: https://ascon.iaik.tugraz.at
81+
[1]: https://doi.org/10.6028/NIST.SP.800-232.ipd
8382
[examples section]: https://github.com/RustCrypto/hashes#Examples

0 commit comments

Comments
 (0)