Minor improvements

This commit is contained in:
J. Ayo Akinyele 2019-02-28 00:35:07 -05:00
parent 523543b8ec
commit 232460f9f0
3 changed files with 10 additions and 4 deletions

View File

@ -35,7 +35,7 @@ pub struct ProofCV {
/// NIZK for PoK of the opening of a commitment M = g^m0 * Z1^m1 * ... * Zl^ml
/// Arg 1 - secret values
/// Arg 2 - public bases
/// Arg 3 - challenge to include in the proof
/// Arg 3 - commitment to include in the proof
pub fn bs_gen_nizk_proof(x: &Vec<Fr>, pub_bases: &Vec<G2>, C: G2) -> ProofCV {
let rng = &mut thread_rng();
let l = x.len(); // number of secrets
@ -321,4 +321,4 @@ mod tests {
let proof_vs = vs_gen_nizk_proof(&m1, &common_params1, common_params1.vs);
assert!(vs_verify_blind_sig(&mpk, &m_keypair.pk, &proof_vs, &blind_sigs) == true);
}
}
}

View File

@ -66,7 +66,7 @@ impl fmt::Display for Commitment {
for x in d_vec.iter() {
d_s = format!("{}{:x}", d_s, x);
}
write!(f, "Commitment : (c=0x{}, d=0x{})", c_s, d_s)
write!(f, "Commitment : (c=0x{}, r=0x{})", c_s, d_s)
}
}

View File

@ -139,6 +139,13 @@ pub fn print(g: &G1) -> String {
return c_s;
}
pub fn print_length(commit: &commit_scheme::Commitment) {
let c_vec: Vec<u8> = encode(&commit.c, Infinite).unwrap();
println!("Length of G2: {}", c_vec.len());
let r_vec: Vec<u8> = encode(&commit.r, Infinite).unwrap();
println!("Length of FR: {}", r_vec.len());
}
// OLD RefundMessage
//impl<'a> RefundMessage<'a> {
// pub fn new(_c_id: Fr, _index: i32) -> RefundMessage<'a> {
@ -606,7 +613,6 @@ pub mod bidirectional {
use serialization_wrappers;
use serde::{Serialize, Deserialize};
fn print_secret_vector(x: &Vec<Fr>) {
for i in 0 .. x.len() {
let msg = format!("x[{}] => ", i);