Skip to content

Commit e12d7fe

Browse files
committed
sha3: Add hazmat TSHK API new_with_round_count
1 parent a16eb1b commit e12d7fe

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sha3/src/macros.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,27 @@ macro_rules! impl_turbo_shake {
246246
impl $name {
247247
/// Creates a new TurboSHAKE instance with the given domain separation.
248248
/// Note that the domain separation needs to be a byte with a value in
249-
/// the range [0x01, . . . , 0x7F]
249+
/// the range [0x01, . . . , 0x7F].
250250
pub fn new(domain_separation: u8) -> Self {
251251
assert!((0x01..=0x7F).contains(&domain_separation));
252252
Self {
253253
domain_separation,
254254
state: Sha3State::new(TURBO_SHAKE_ROUND_COUNT),
255255
}
256256
}
257+
258+
/// Creates a new TurboSHAKE instance with the given domain separation
259+
/// and round_count.
260+
/// This is a low-level "hazmat" API.
261+
/// Note that the domain separation needs to be a byte with a value in
262+
/// the range [0x01, . . . , 0x7F].
263+
pub fn new_with_round_count(domain_separation: u8, round_count: usize) -> Self {
264+
assert!((0x01..=0x7F).contains(&domain_separation));
265+
Self {
266+
domain_separation,
267+
state: Sha3State::new(round_count),
268+
}
269+
}
257270
}
258271

259272
impl HashMarker for $name {}

0 commit comments

Comments
 (0)