mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-10 15:09:44 -05:00
Inline challenge function
This commit is contained in:
parent
fb36b7fe4f
commit
a4077d13e5
@ -41,17 +41,14 @@ pub fn sign(
|
|||||||
let pk_i = ring[i + 1];
|
let pk_i = ring[i + 1];
|
||||||
let adjusted_commitment_i = commitment_ring[i] - pseudo_output_commitment;
|
let adjusted_commitment_i = commitment_ring[i] - pseudo_output_commitment;
|
||||||
|
|
||||||
// TODO: Do not unwrap here
|
let L_i = compute_L(h_prev, &mus, *s_i, pk_i, adjusted_commitment_i);
|
||||||
challenge(
|
let R_i = compute_R(h_prev, &mus, pk_i, *s_i, I, D_inv_8);
|
||||||
|
|
||||||
|
hash_to_scalar(&[
|
||||||
&prefix,
|
&prefix,
|
||||||
*s_i,
|
L_i.compress().as_bytes().as_ref(),
|
||||||
pk_i,
|
R_i.compress().as_bytes().as_ref(),
|
||||||
adjusted_commitment_i,
|
])
|
||||||
D_inv_8,
|
|
||||||
h_prev,
|
|
||||||
I,
|
|
||||||
&mus,
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let s_last = alpha - h_last * ((mus.mu_P * signing_key) + (mus.mu_C * z));
|
let s_last = alpha - h_last * ((mus.mu_P * signing_key) + (mus.mu_C * z));
|
||||||
@ -116,26 +113,6 @@ fn clsag_round_hash_prefix(
|
|||||||
prefix
|
prefix
|
||||||
}
|
}
|
||||||
|
|
||||||
fn challenge(
|
|
||||||
prefix: &[u8],
|
|
||||||
s_i: Scalar,
|
|
||||||
pk_i: EdwardsPoint,
|
|
||||||
adjusted_commitment_i: EdwardsPoint,
|
|
||||||
D: EdwardsPoint,
|
|
||||||
h_prev: Scalar,
|
|
||||||
I: EdwardsPoint,
|
|
||||||
mus: &AggregationHashes,
|
|
||||||
) -> Scalar {
|
|
||||||
let L_i = compute_L(h_prev, mus, s_i, pk_i, adjusted_commitment_i);
|
|
||||||
let R_i = compute_R(h_prev, mus, pk_i, s_i, I, D);
|
|
||||||
|
|
||||||
hash_to_scalar(&[
|
|
||||||
prefix,
|
|
||||||
L_i.compress().as_bytes().as_ref(),
|
|
||||||
R_i.compress().as_bytes().as_ref(),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
// L_i = s_i * G + c_p * pk_i + c_c * (commitment_i - pseudoutcommitment)
|
// L_i = s_i * G + c_p * pk_i + c_c * (commitment_i - pseudoutcommitment)
|
||||||
fn compute_L(
|
fn compute_L(
|
||||||
h_prev: Scalar,
|
h_prev: Scalar,
|
||||||
@ -241,18 +218,20 @@ impl Signature {
|
|||||||
|
|
||||||
let mut h = self.h_0;
|
let mut h = self.h_0;
|
||||||
|
|
||||||
|
let mus = todo!();
|
||||||
|
let adjusted_commitment_i = todo!();
|
||||||
|
|
||||||
for (i, s_i) in self.responses.iter().enumerate() {
|
for (i, s_i) in self.responses.iter().enumerate() {
|
||||||
let pk_i = ring[(i + 1) % RING_SIZE];
|
let pk_i = ring[(i + 1) % RING_SIZE];
|
||||||
h = challenge(
|
let prefix = clsag_round_hash_prefix(&ring_concat, todo!(), todo!(), msg);
|
||||||
&clsag_round_hash_prefix(&ring_concat, todo!(), todo!(), msg),
|
let L_i = compute_L(h, mus, *s_i, pk_i, adjusted_commitment_i);
|
||||||
*s_i,
|
let R_i = compute_R(h, mus, pk_i, *s_i, self.I, self.D);
|
||||||
pk_i,
|
|
||||||
todo!(),
|
h = hash_to_scalar(&[
|
||||||
todo!(),
|
&prefix,
|
||||||
h,
|
L_i.compress().as_bytes().as_ref(),
|
||||||
self.I,
|
R_i.compress().as_bytes().as_ref(),
|
||||||
todo!(),
|
])
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(h == self.h_0)
|
Ok(h == self.h_0)
|
||||||
|
Loading…
Reference in New Issue
Block a user