mirror of
https://github.com/logos-co/nomos-pocs.git
synced 2025-01-11 01:45:51 +00:00
Use basepoint as the blinding point (#31)
This commit is contained in:
parent
9541c4b34d
commit
8870a32cbe
@ -10,7 +10,6 @@ serde = {version="1.0", features = ["derive"]}
|
||||
group = "0.13.0"
|
||||
rand = "0.8.5"
|
||||
rand_core = "0.6.0"
|
||||
lazy_static = "1.4.0"
|
||||
hex = "0.4.3"
|
||||
curve25519-dalek = {version = "4.1", features = ["serde", "digest", "rand_core"]}
|
||||
sha2 = "0.10"
|
||||
|
@ -1,15 +1,9 @@
|
||||
use curve25519_dalek::{ristretto::RistrettoPoint, traits::VartimeMultiscalarMul, Scalar};
|
||||
use lazy_static::lazy_static;
|
||||
use curve25519_dalek::{ristretto::RistrettoPoint, Scalar};
|
||||
use rand_core::CryptoRngCore;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::NoteWitness;
|
||||
|
||||
lazy_static! {
|
||||
// Precompute of ``
|
||||
static ref PEDERSON_COMMITMENT_BLINDING_POINT: RistrettoPoint = crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING");
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||
pub struct Balance(pub RistrettoPoint);
|
||||
|
||||
@ -56,10 +50,7 @@ impl BalanceWitness {
|
||||
pub fn balance(value: u64, unit: Unit, blinding: Scalar) -> Unit {
|
||||
let value_scalar = Scalar::from(value);
|
||||
// can vartime leak the number of cycles through the stark proof?
|
||||
RistrettoPoint::vartime_multiscalar_mul(
|
||||
&[value_scalar, blinding],
|
||||
&[unit, *PEDERSON_COMMITMENT_BLINDING_POINT],
|
||||
)
|
||||
RistrettoPoint::vartime_double_scalar_mul_basepoint(&value_scalar, &unit, &blinding)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -67,17 +58,6 @@ mod test {
|
||||
use super::*;
|
||||
use crate::note::unit_point;
|
||||
|
||||
#[test]
|
||||
fn test_pederson_blinding_point_pre_compute() {
|
||||
// use k256::elliptic_curve::group::GroupEncoding;
|
||||
// println!("{:?}", <[u8;33]>::from((*PEDERSON_COMMITMENT_BLINDING_POINT).to_bytes()));
|
||||
|
||||
assert_eq!(
|
||||
*PEDERSON_COMMITMENT_BLINDING_POINT,
|
||||
crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_balance_zero_unitless() {
|
||||
// Zero is the same across all units
|
||||
|
Loading…
x
Reference in New Issue
Block a user