7
7
![ Rust Version] [ rustc-image ]
8
8
[ ![ Project Chat] [ chat-image ]] [ chat-link ]
9
9
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.
13
12
14
13
## Security Notes
15
14
@@ -20,31 +19,31 @@ USE AT YOUR OWN RISK!
20
19
## Examples
21
20
Fixed output size hashing:
22
21
``` rust
23
- use ascon_hash :: {AsconHash , Digest };
22
+ use ascon_hash :: {AsconHash256 , Digest };
24
23
use hex_literal :: hex;
25
24
26
- let mut hasher = AsconHash :: new ();
25
+ let mut hasher = AsconHash256 :: new ();
27
26
hasher . update (b " some bytes" );
28
27
let hash = hasher . finalize ();
29
28
30
- assert_eq! (hash , hex! (" b742ca75e57038757059cccc6874714f9dbd7fc5924a7df4e316594fd1426ca8 " ));
29
+ assert_eq! (hash , hex! (" e909c2f6da9cb3028423265c8f23fc2d26bfc0f3db704683ef16b787a945ed68 " ));
31
30
32
31
// Hex-encode hash using https://docs.rs/base16ct
33
32
let hex_hash = base16ct :: lower :: encode_string (& hash );
34
- assert_eq! (hex_hash , " b742ca75e57038757059cccc6874714f9dbd7fc5924a7df4e316594fd1426ca8 " );
33
+ assert_eq! (hex_hash , " e909c2f6da9cb3028423265c8f23fc2d26bfc0f3db704683ef16b787a945ed68 " );
35
34
```
36
35
37
36
XOF hashing:
38
37
``` rust
39
- use ascon_hash :: {AsconXof , ExtendableOutput , Update , XofReader };
38
+ use ascon_hash :: {AsconXof128 , ExtendableOutput , Update , XofReader };
40
39
use hex_literal :: hex;
41
40
42
- let mut xof = AsconXof :: default ();
41
+ let mut xof = AsconXof128 :: default ();
43
42
xof . update (b " some bytes" );
44
43
let mut reader = xof . finalize_xof ();
45
44
let mut dst = [0u8 ; 5 ];
46
45
reader . read (& mut dst );
47
- assert_eq! (dst , hex! (" c21972fde9 " ));
46
+ assert_eq! (dst , hex! (" 8c7dd114a0 " ));
48
47
```
49
48
50
49
Also, see the [ examples section] in the RustCrypto/hashes readme.
@@ -79,5 +78,5 @@ dual licensed as above, without any additional terms or conditions.
79
78
80
79
[ // ] : # ( general links )
81
80
82
- [ 1 ] : https://ascon.iaik.tugraz.at
81
+ [ 1 ] : https://doi.org/10.6028/NIST.SP.800-232.ipd
83
82
[ examples section ] : https://github.com/RustCrypto/hashes#Examples
0 commit comments