Skip to content

Commit 2d6379d

Browse files
felixrabenewpavlov
authored andcommitted
Turn Keccak256Full comment into docs (#81)
1 parent 0484eaa commit 2d6379d

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

sha3/src/lib.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,17 @@ mod state;
6868
pub use reader::Sha3XofReader;
6969
use state::Sha3State;
7070

71-
sha3_impl!(Keccak224, U28, U144, paddings::Keccak);
72-
sha3_impl!(Keccak256, U32, U136, paddings::Keccak);
73-
sha3_impl!(Keccak384, U48, U104, paddings::Keccak);
74-
sha3_impl!(Keccak512, U64, U72, paddings::Keccak);
71+
sha3_impl!(Keccak224, U28, U144, paddings::Keccak, "");
72+
sha3_impl!(Keccak256, U32, U136, paddings::Keccak, "");
73+
sha3_impl!(Keccak384, U48, U104, paddings::Keccak, "");
74+
sha3_impl!(Keccak512, U64, U72, paddings::Keccak, "");
7575

76-
// SHA-3 variant used in CryptoNight
77-
sha3_impl!(Keccak256Full, U200, U136, paddings::Keccak);
76+
sha3_impl!(Keccak256Full, U200, U136, paddings::Keccak, "SHA-3 variant used in CryptoNight.");
7877

79-
sha3_impl!(Sha3_224, U28, U144, paddings::Sha3);
80-
sha3_impl!(Sha3_256, U32, U136, paddings::Sha3);
81-
sha3_impl!(Sha3_384, U48, U104, paddings::Sha3);
82-
sha3_impl!(Sha3_512, U64, U72, paddings::Sha3);
78+
sha3_impl!(Sha3_224, U28, U144, paddings::Sha3, "");
79+
sha3_impl!(Sha3_256, U32, U136, paddings::Sha3, "");
80+
sha3_impl!(Sha3_384, U48, U104, paddings::Sha3, "");
81+
sha3_impl!(Sha3_512, U64, U72, paddings::Sha3, "");
8382

84-
shake_impl!(Shake128, U168, paddings::Shake);
85-
shake_impl!(Shake256, U136, paddings::Shake);
83+
shake_impl!(Shake128, U168, paddings::Shake, "");
84+
shake_impl!(Shake256, U136, paddings::Shake, "");

sha3/src/macros.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
macro_rules! impl_state {
2-
($state:ident, $rate:ident, $padding:ty) => {
2+
($state:ident, $rate:ident, $padding:ty, $doc:expr) => {
33

44
#[allow(non_camel_case_types)]
55
#[derive(Clone, Default)]
6+
#[doc=$doc]
67
pub struct $state {
78
state: Sha3State,
89
buffer: BlockBuffer<$rate>,
@@ -24,9 +25,9 @@ macro_rules! impl_state {
2425
}
2526

2627
macro_rules! sha3_impl {
27-
($state:ident, $output_size:ident, $rate:ident, $padding:ty) => {
28+
($state:ident, $output_size:ident, $rate:ident, $padding:ty, $doc:expr) => {
2829

29-
impl_state!($state, $rate, $padding);
30+
impl_state!($state, $rate, $padding, $doc);
3031

3132
impl BlockInput for $state {
3233
type BlockSize = $rate;
@@ -66,8 +67,8 @@ macro_rules! sha3_impl {
6667
}
6768

6869
macro_rules! shake_impl {
69-
($state:ident, $rate:ident, $padding:ty) => {
70-
impl_state!($state, $rate, $padding);
70+
($state:ident, $rate:ident, $padding:ty, $doc:expr) => {
71+
impl_state!($state, $rate, $padding, $doc);
7172

7273
impl Input for $state {
7374
fn input<B: AsRef<[u8]>>(&mut self, input: B) {

0 commit comments

Comments
 (0)