bp-pp 0.1.1

Rust library for Bulletproofs++ - range-proof protocol in discret loggarithm setting
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use k256::{FieldBytes, ProjectivePoint, Scalar};
use k256::elliptic_curve::group::GroupEncoding;
use k256::elliptic_curve::PrimeField;
use merlin::Transcript;

pub fn app_point(label: &'static [u8], p: &ProjectivePoint, t: &mut Transcript) {
    t.append_message(label, p.to_bytes().as_slice());
}

pub fn get_challenge(label: &'static [u8], t: &mut Transcript) -> Scalar {
    let mut buf = [0u8; 32];
    t.challenge_bytes(label, &mut buf);
    Scalar::from_repr(*FieldBytes::from_slice(&buf)).unwrap()
}