From a82c618d0414bcc750f359c4abea4189ea7d7ab0 Mon Sep 17 00:00:00 2001 From: Rodolfo P A <6721075+rodoufu@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:19:16 -0300 Subject: [PATCH] Adding comments --- starknet-core/src/crypto.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/starknet-core/src/crypto.rs b/starknet-core/src/crypto.rs index fe4790a7..3b891ca9 100644 --- a/starknet-core/src/crypto.rs +++ b/starknet-core/src/crypto.rs @@ -98,6 +98,14 @@ pub fn ecdsa_verify( } } +/// MaskBits masks the specified (excess) bits in a byte slice. +/// +/// Parameters: +/// - mask: is an integer representing the number of bits to mask +/// - word_size: is an integer representing the number of bits in each element of the slice +/// - slice: is a byte slice on which the masking operation is performed +/// Makes the operation in place on slice, gets a new byte slice that contains the masked bits +/// Porting the MaskBits from https://github.com/NethermindEth/starknet.go/blob/main/curve/utils.go#L128-L143 pub fn mask_bits(mask: usize, word_size: usize, slice: &mut [u8]) { let mut excess = slice.len() * word_size - mask;