1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#![no_std]
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
#![deny(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms)]
#[cfg(feature = "std")]
extern crate std;
pub use digest::{self, Digest};
use block_buffer::BlockBuffer;
use digest::consts::{U104, U136, U144, U168, U200, U28, U32, U48, U64, U72};
use digest::generic_array::typenum::Unsigned;
use digest::{BlockInput, ExtendableOutputDirty, FixedOutputDirty, Reset, Update};
mod paddings;
#[macro_use]
mod macros;
mod reader;
mod state;
pub use crate::reader::Sha3XofReader;
use crate::state::Sha3State;
sha3_impl!(
Keccak224,
U28,
U144,
paddings::Keccak,
"Keccak-224 hash function."
);
sha3_impl!(
Keccak256,
U32,
U136,
paddings::Keccak,
"Keccak-256 hash function."
);
sha3_impl!(
Keccak384,
U48,
U104,
paddings::Keccak,
"Keccak-384 hash function."
);
sha3_impl!(
Keccak512,
U64,
U72,
paddings::Keccak,
"Keccak-512 hash function."
);
sha3_impl!(
Keccak256Full,
U200,
U136,
paddings::Keccak,
"SHA-3 variant used in CryptoNight."
);
sha3_impl!(
Sha3_224,
U28,
U144,
paddings::Sha3,
"SHA-3-224 hash function."
);
sha3_impl!(
Sha3_256,
U32,
U136,
paddings::Sha3,
"SHA-3-256 hash function."
);
sha3_impl!(
Sha3_384,
U48,
U104,
paddings::Sha3,
"SHA-3-384 hash function."
);
sha3_impl!(
Sha3_512,
U64,
U72,
paddings::Sha3,
"SHA-3-512 hash function."
);
shake_impl!(
Shake128,
U168,
paddings::Shake,
"SHAKE128 extendable output (XOF) hash function"
);
shake_impl!(
Shake256,
U136,
paddings::Shake,
"SHAKE256 extendable output (XOF) hash function"
);