Skip to content

Commit

Permalink
tendermint: simplify GenericArray → [u8; N] conversion (#1390) (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Michal Nazarewicz <mina86@mina86.com>
  • Loading branch information
mzabaluev and mina86 committed Mar 14, 2024
1 parent 03974f5 commit 19e607d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions cometbft/src/crypto/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ pub use sha2::Sha256;

impl super::Sha256 for Sha256 {
fn digest(data: impl AsRef<[u8]>) -> [u8; HASH_SIZE] {
let digest = <Self as Digest>::digest(data);
// copy the GenericArray out
let mut hash = [0u8; HASH_SIZE];
hash.copy_from_slice(&digest);
hash
<Self as Digest>::digest(data).into()
}
}

Expand Down

0 comments on commit 19e607d

Please sign in to comment.