From 56d38dba2cc78a234bfbbd054d5ce9434f27e809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Sun, 20 Sep 2020 09:58:54 -0400 Subject: [PATCH] Reverse use of `Tryinto<[u8; 64]>` since it's not yet on stable --- src/group.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/group.rs b/src/group.rs index 732260f..7a4ed55 100644 --- a/src/group.rs +++ b/src/group.rs @@ -19,7 +19,6 @@ use generic_array::{ ArrayLength, GenericArray, }; use rand_core::{CryptoRng, RngCore}; -use std::convert::TryInto; use std::ops::Mul; use zeroize::Zeroize; @@ -98,10 +97,12 @@ impl Group for RistrettoPoint { type UniformBytesLen = U64; fn hash_to_curve(uniform_bytes: &GenericArray) -> Self { - let bits: [u8; 64] = (&uniform_bytes[..]) - .try_into() - .expect("GenericArray has a type-level length"); - + // https://caniuse.rs/features/array_gt_32_impls + let bits: [u8; 64] = { + let mut bytes = [0u8; 64]; + bytes.copy_from_slice(uniform_bytes); + bytes + }; RistrettoPoint::from_uniform_bytes(&bits) } } @@ -157,6 +158,7 @@ impl Group for EdwardsPoint { mod tests { use super::*; use anyhow::{anyhow, Result}; + use std::convert::TryInto; const EIGHT_TORSION: [[u8; 32]; 8] = [ [