Skip to content

Commit

Permalink
call Into::into instead of copying the slice
Browse files Browse the repository at this point in the history
  • Loading branch information
drHuangMHT committed Jan 3, 2025
1 parent 02040ff commit 3bb8b00
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions identity/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@ impl SecretKey {
///
/// [RFC3278]: https://tools.ietf.org/html/rfc3278#section-8.2
pub fn sign(&self, msg: &[u8]) -> Vec<u8> {
let generic_array = Sha256::digest(msg);

// FIXME: Once `generic-array` hits 1.0, we should be able to just use `Into` here.
let mut array = [0u8; 32];
array.copy_from_slice(generic_array.as_slice());

let message = Message::parse(&array);
let message = Message::parse(&Sha256::digest(msg).into());

libsecp256k1::sign(&message, &self.0)
.0
Expand Down

0 comments on commit 3bb8b00

Please sign in to comment.