mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-06 20:20:34 +00:00
Remove dependency on byteorder crate
This commit is contained in:
parent
783e602e85
commit
c48229ce0f
2 changed files with 1 additions and 5 deletions
|
|
@ -50,7 +50,6 @@ blake2b_simd = "0.5"
|
||||||
sha3 = "0.9.1"
|
sha3 = "0.9.1"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
byteorder = "1.4.2"
|
|
||||||
|
|
||||||
# Temporary workaround for https://github.com/myrrlyn/funty/issues/3
|
# Temporary workaround for https://github.com/myrrlyn/funty/issues/3
|
||||||
funty = "=1.1.0"
|
funty = "=1.1.0"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
//! This module implements "simplified SWU" hashing to short Weierstrass curves
|
//! This module implements "simplified SWU" hashing to short Weierstrass curves
|
||||||
//! with a = 0.
|
//! with a = 0.
|
||||||
|
|
||||||
use byteorder::{BigEndian, WriteBytesExt};
|
|
||||||
use subtle::ConstantTimeEq;
|
use subtle::ConstantTimeEq;
|
||||||
|
|
||||||
use crate::arithmetic::{Curve, CurveAffine, FieldExt};
|
use crate::arithmetic::{Curve, CurveAffine, FieldExt};
|
||||||
|
|
@ -16,12 +15,10 @@ pub fn hash_to_field<F: FieldExt>(message: &[u8], domain_separation_tag: &[u8],
|
||||||
const CHUNKLEN: usize = 64;
|
const CHUNKLEN: usize = 64;
|
||||||
|
|
||||||
let outlen = buf.len() * CHUNKLEN;
|
let outlen = buf.len() * CHUNKLEN;
|
||||||
let mut outlen_enc = vec![];
|
|
||||||
outlen_enc.write_u32::<BigEndian>(outlen as u32).unwrap();
|
|
||||||
|
|
||||||
let mut xof = sha3::Shake128::default();
|
let mut xof = sha3::Shake128::default();
|
||||||
xof.update(message);
|
xof.update(message);
|
||||||
xof.update(outlen_enc);
|
xof.update(&(outlen as u32).to_be_bytes());
|
||||||
xof.update([domain_separation_tag.len() as u8]);
|
xof.update([domain_separation_tag.len() as u8]);
|
||||||
xof.update(domain_separation_tag);
|
xof.update(domain_separation_tag);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue