Use const for generating H
This commit is contained in:
parent
af68c8818d
commit
2ca58d8b5a
|
@ -30,6 +30,7 @@ use super::super::cred;
|
||||||
use super::super::scalar_u32;
|
use super::super::scalar_u32;
|
||||||
use super::super::{BridgeAuth, IssuerPubKey};
|
use super::super::{BridgeAuth, IssuerPubKey};
|
||||||
use super::super::{CMZ_A, CMZ_A_TABLE};
|
use super::super::{CMZ_A, CMZ_A_TABLE};
|
||||||
|
pub const H_GENERATOR_STRING: &str = "PR Generator H for ";
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
|
@ -92,7 +93,7 @@ pub fn request(lox_cred: &cred::Lox, lox_pub: &IssuerPubKey) -> Result<Request,
|
||||||
.try_into()
|
.try_into()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
|
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
|
||||||
format!("PR Generator H for {}", date).as_bytes(),
|
format!("{}{}", H_GENERATOR_STRING, date).as_bytes(),
|
||||||
);
|
);
|
||||||
let Htable: RistrettoBasepointTable = RistrettoBasepointTable::create(&H);
|
let Htable: RistrettoBasepointTable = RistrettoBasepointTable::create(&H);
|
||||||
|
|
||||||
|
@ -235,7 +236,7 @@ impl BridgeAuth {
|
||||||
pub fn handle_positive_report(&mut self, req: Request) -> Result<(), ProofError> {
|
pub fn handle_positive_report(&mut self, req: Request) -> Result<(), ProofError> {
|
||||||
let A: &RistrettoPoint = &CMZ_A;
|
let A: &RistrettoPoint = &CMZ_A;
|
||||||
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
|
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
|
||||||
format!("PR Generator H for {}", req.date).as_bytes(),
|
format!("{}{}", H_GENERATOR_STRING, req.date).as_bytes(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if req.P.is_identity() {
|
if req.P.is_identity() {
|
||||||
|
|
Loading…
Reference in New Issue