From 905fc7a9d413ee0e088262f5cd60288146eb9085 Mon Sep 17 00:00:00 2001 From: rlee287 Date: Thu, 22 Jun 2023 11:34:07 -0400 Subject: [PATCH] Add const initializer to argon2:Block --- argon2/src/block.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/argon2/src/block.rs b/argon2/src/block.rs index e874c9b8..6586f25b 100644 --- a/argon2/src/block.rs +++ b/argon2/src/block.rs @@ -53,6 +53,11 @@ impl Block { /// Memory block size in bytes pub const SIZE: usize = 1024; + /// Returns a Block initialized with zeros. + pub const fn new() -> Self { + Self([0u64; Self::SIZE / 8]) + } + pub(crate) fn as_bytes(&self) -> &[u8; Self::SIZE] { unsafe { &*(self.0.as_ptr() as *const [u8; Self::SIZE]) } }