Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinas committed Jul 2, 2024
1 parent ded38a1 commit 999b414
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use pairing::group::{
use rand_core::RngCore;
use subtle::{Choice, CtOption};

use crate::{affine, Affine, Error, Scalar};
use crate::{affine, Affine, Error, Scalar, RANDOM_DOMAIN_SEPERATOR};

type CompressedSize = U49;
type UncompressedSize = U97;
Expand Down Expand Up @@ -492,7 +492,7 @@ impl Group for G1Projective {
fn random(mut rng: impl RngCore) -> Self {
let mut buf = [0u8; 64];
rng.fill_bytes(&mut buf);
Self::hash_to_curve(buf, b"randrandrandrandrandrandrandrand")
Self::hash_to_curve(buf, RANDOM_DOMAIN_SEPERATOR)
}

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions src/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use pairing::group::{
prime::{PrimeCurve, PrimeGroup},
Curve, Group, GroupEncoding, UncompressedEncoding,
};
use rand_core::RngCore;
use subtle::{Choice, CtOption};

use crate::{affine, Affine, Error, Scalar};
use rand_core::RngCore;
use crate::{affine, Affine, Error, Scalar, RANDOM_DOMAIN_SEPERATOR};

type CompressedSize = U97;
type UncompressedSize = U193;
Expand Down Expand Up @@ -491,7 +491,7 @@ impl Group for G2Projective {
fn random(mut rng: impl RngCore) -> Self {
let mut buf = [0u8; 64];
rng.fill_bytes(&mut buf);
Self::hash_to_curve(buf, b"randrandrandrandrandrandrandrand")
Self::hash_to_curve(buf, RANDOM_DOMAIN_SEPERATOR)
}

#[inline]
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,5 @@ mod test {
assert_eq!(check, pp);
}
}

pub(crate) const RANDOM_DOMAIN_SEPERATOR: &[u8; 32] = b"randrandrandrandrandrandrandrand";

0 comments on commit 999b414

Please sign in to comment.