Reverse use of Tryinto<[u8; 64]> since it's not yet on stable
This commit is contained in:
+7
-5
@@ -19,7 +19,6 @@ use generic_array::{
|
|||||||
ArrayLength, GenericArray,
|
ArrayLength, GenericArray,
|
||||||
};
|
};
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use zeroize::Zeroize;
|
use zeroize::Zeroize;
|
||||||
|
|
||||||
@@ -98,10 +97,12 @@ impl Group for RistrettoPoint {
|
|||||||
|
|
||||||
type UniformBytesLen = U64;
|
type UniformBytesLen = U64;
|
||||||
fn hash_to_curve(uniform_bytes: &GenericArray<u8, Self::UniformBytesLen>) -> Self {
|
fn hash_to_curve(uniform_bytes: &GenericArray<u8, Self::UniformBytesLen>) -> Self {
|
||||||
let bits: [u8; 64] = (&uniform_bytes[..])
|
// https://caniuse.rs/features/array_gt_32_impls
|
||||||
.try_into()
|
let bits: [u8; 64] = {
|
||||||
.expect("GenericArray has a type-level length");
|
let mut bytes = [0u8; 64];
|
||||||
|
bytes.copy_from_slice(uniform_bytes);
|
||||||
|
bytes
|
||||||
|
};
|
||||||
RistrettoPoint::from_uniform_bytes(&bits)
|
RistrettoPoint::from_uniform_bytes(&bits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,6 +158,7 @@ impl Group for EdwardsPoint {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
const EIGHT_TORSION: [[u8; 32]; 8] = [
|
const EIGHT_TORSION: [[u8; 32]; 8] = [
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user