Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Simplify sponge finalization and IO-pattern validation
- Raise the MSRV to Rust 1.96.1 [#32]

### Removed

- Remove `PartialEq` from `Sponge` [#39]

## [0.3.0] - 2025-02-06

### Changed
Expand Down Expand Up @@ -65,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add documentation

<!-- ISSUES -->
[#39]: https://github.com/dusk-network/safe/issues/39
[#37]: https://github.com/dusk-network/safe/issues/37
[#35]: https://github.com/dusk-network/safe/issues/35
[#32]: https://github.com/dusk-network/safe/issues/32
Expand Down
25 changes: 22 additions & 3 deletions src/sponge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,28 @@ where
/// elements. Widths below two are rejected. Operation errors and explicit
/// zeroization permanently invalidate the instance, including subsequent
/// clones of that failed instance; construct a new sponge to start again.
#[derive(Clone, PartialEq)]
///
/// Whole-sponge equality is intentionally unsupported: ordinary comparisons
/// of secret state and buffered output have no constant-time guarantee.
/// This is separate from a backend's authentication equality check.
/// When upgrading, remove whole-sponge comparisons and `Sponge: PartialEq`
/// requirements.
///
/// ```compile_fail,E0369
/// use dusk_safe::{Safe, Sponge};
///
/// fn compare<S, T, const W: usize>(
/// left: &Sponge<S, T, W>,
/// right: &Sponge<S, T, W>,
/// ) -> bool
/// where
/// S: Safe<T, W> + PartialEq,
/// T: Default + Copy + zeroize::Zeroize + PartialEq,
/// {
/// left == right
/// }
/// ```
#[derive(Clone)]
pub struct Sponge<S, T, const W: usize>
where
S: Safe<T, W>,
Expand All @@ -90,7 +111,6 @@ where
io_count: usize,
failed: bool,
iopattern: Vec<Call>,
domain_sep: u64,
pub(crate) output: Vec<T>,
}

Expand Down Expand Up @@ -142,7 +162,6 @@ where
io_count: 0,
failed: false,
iopattern,
domain_sep,
output: Vec::new(),
})
}
Expand Down