From 37e51ca9ec31dec38b1af1b38a78f5ef76c8b20c Mon Sep 17 00:00:00 2001 From: Emir Salkic Date: Mon, 5 Dec 2022 12:19:15 +0100 Subject: [PATCH] =?UTF-8?q?remove=20=C2=B4unsafe=C2=B4=20keyword=20from=20?= =?UTF-8?q?=C2=B4from=5Fbytes=5Funchecked=C2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/message.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/message.rs b/src/message.rs index a2a441b..ba381d0 100644 --- a/src/message.rs +++ b/src/message.rs @@ -29,7 +29,7 @@ impl Message { /// /// There is no guarantee the provided bytes will be the product of a cryptographically secure /// hash. Using insecure messages might compromise the security of the signature. - pub unsafe fn from_bytes_unchecked(bytes: [u8; Self::LEN]) -> Self { + pub fn from_bytes_unchecked(bytes: [u8; Self::LEN]) -> Self { Self(bytes.into()) } @@ -86,14 +86,14 @@ impl From for [u8; Message::LEN] { impl From<&Hasher> for Message { fn from(hasher: &Hasher) -> Self { // Safety: `Hasher` is a cryptographic hash - unsafe { Self::from_bytes_unchecked(*hasher.digest()) } + Self::from_bytes_unchecked(*hasher.digest()) } } impl From for Message { fn from(hasher: Hasher) -> Self { // Safety: `Hasher` is a cryptographic hash - unsafe { Self::from_bytes_unchecked(*hasher.finalize()) } + Self::from_bytes_unchecked(*hasher.finalize()) } }