Skip to content

sha3, rng cleanup - #94

Open
ounsworth wants to merge 1 commit into
bcgit:release/0.1.3alphafrom
ounsworth:chore/core-imports-and-copy-cleanups
Open

sha3, rng cleanup#94
ounsworth wants to merge 1 commit into
bcgit:release/0.1.3alphafrom
ounsworth:chore/core-imports-and-copy-cleanups

Conversation

@ounsworth

Copy link
Copy Markdown
Contributor

Break up of #87, so this is actually dgh's submission. So I will be reviewing / approving.

Mechanical cleanups, no behaviour change.

use core:: imports, copy Copy types, drop a redundant zeroize

  • std::marker::PhantomData -> core:: in sha3.rs, and std::fmt -> core:: in hash_drbg80090a.rs. Neither needs std; both crates are working towards no_std.
  • KeyType and SecurityStrength are Copy, so min()/max() results are dereferenced rather than .clone()d. This also lets the surrounding expressions be formatted as single calls.
  • Hash::hash_out() and XOF::hash_xof_out() called output.fill(0) before delegating to a path that zeroizes the buffer itself (do_final_out() and squeeze_out() respectively, per the trait contract). Dropped the outer fill; hash_out() no longer needs mut output or a reborrow.

Mechanical cleanups, no behaviour change.

* std::marker::PhantomData -> core:: in sha3.rs, and std::fmt -> core::
  in hash_drbg80090a.rs. Neither needs std; both crates are working
  towards no_std.
* KeyType and SecurityStrength are Copy, so min()/max() results are
  dereferenced rather than .clone()d. This also lets the surrounding
  expressions be formatted as single calls.
* Hash::hash_out() and XOF::hash_xof_out() called output.fill(0) before
  delegating to a path that zeroizes the buffer itself (do_final_out()
  and squeeze_out() respectively, per the trait contract). Dropped the
  outer fill; hash_out() no longer needs `mut output` or a reborrow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant