Skip to content

Commit

Permalink
Change nonce to &T instead of T
Browse files Browse the repository at this point in the history
Resolves #11
  • Loading branch information
moCello committed Mar 15, 2024
1 parent 3496600 commit 3450478
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Let `Sponge::start` take the io-pattern as `impl Into<Vec<Call>>` [#4]
- Change `nonce` to be `&T` instead of `T` in `encrypt` and `decrypt` [#9]

## [0.1.0] - 2024-03-07

Expand Down
8 changes: 4 additions & 4 deletions src/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn encrypt<E, T, const W: usize>(
domain_sep: impl Into<u64>,
message: impl AsRef<[T]>,
shared_secret: &[T; 2],
nonce: T,
nonce: &T,
) -> Result<Vec<T>, Error>
where
E: Safe<T, W> + Encryption<T, W>,
Expand All @@ -69,7 +69,7 @@ where
domain_sep.into(),
message_len,
shared_secret,
&nonce,
nonce,
)?;

// absorb message
Expand Down Expand Up @@ -110,7 +110,7 @@ pub fn decrypt<E, T, const W: usize>(
domain_sep: impl Into<u64>,
cipher: impl AsRef<[T]>,
shared_secret: &[T; 2],
nonce: T,
nonce: &T,
) -> Result<Vec<T>, Error>
where
E: Safe<T, W> + Encryption<T, W>,
Expand All @@ -124,7 +124,7 @@ where
domain_sep.into(),
message_len,
shared_secret,
&nonce,
nonce,
)?;

// construct the message by subtracting sponge.output from the cipher
Expand Down

0 comments on commit 3450478

Please # to comment.