From 03bca110b36a8a256d7a67b3c6153b5ffbf85e98 Mon Sep 17 00:00:00 2001 From: Moshe Shababo <17073733+moshababo@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:46:34 -0500 Subject: [PATCH] simplify vec to arr --- node/libs/crypto/src/bn254/hash.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/node/libs/crypto/src/bn254/hash.rs b/node/libs/crypto/src/bn254/hash.rs index cc6abdaa..7a813776 100644 --- a/node/libs/crypto/src/bn254/hash.rs +++ b/node/libs/crypto/src/bn254/hash.rs @@ -20,10 +20,8 @@ pub(crate) fn hash_to_point(msg: &[u8]) -> (G1Affine, u8) { ) .unwrap(); let x_num = hash_num % prime_field_modulus; - - let mut arr = [0u64; 4]; - arr.copy_from_slice(x_num.to_u64_digits().as_slice()); - let mut x = Fq::from_repr(FqRepr(arr)).unwrap(); + let x_arr: [u64; 4] = x_num.to_u64_digits().try_into().unwrap(); + let mut x = Fq::from_repr(FqRepr(x_arr)).unwrap(); for i in 0..255 { let p = get_point_from_x(x);