Use const for generating H

This commit is contained in:
Vecna 2024-02-26 17:50:37 -05:00
parent af68c8818d
commit 2ca58d8b5a
1 changed files with 3 additions and 2 deletions

View File

@ -30,6 +30,7 @@ use super::super::cred;
use super::super::scalar_u32;
use super::super::{BridgeAuth, IssuerPubKey};
use super::super::{CMZ_A, CMZ_A_TABLE};
pub const H_GENERATOR_STRING: &str = "PR Generator H for ";
#[derive(Serialize, Deserialize)]
pub struct Request {
@ -92,7 +93,7 @@ pub fn request(lox_cred: &cred::Lox, lox_pub: &IssuerPubKey) -> Result<Request,
.try_into()
.unwrap();
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);
@ -235,7 +236,7 @@ impl BridgeAuth {
pub fn handle_positive_report(&mut self, req: Request) -> Result<(), ProofError> {
let A: &RistrettoPoint = &CMZ_A;
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() {