mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-26 23:37:01 -05:00
Inline AggregationHashes::hash
This commit is contained in:
parent
a4077d13e5
commit
a73024ccfc
@ -32,7 +32,13 @@ pub fn sign(
|
|||||||
);
|
);
|
||||||
let h_0 = hash_to_scalar(&[&prefix, L.compress().as_bytes(), R.compress().as_bytes()]);
|
let h_0 = hash_to_scalar(&[&prefix, L.compress().as_bytes(), R.compress().as_bytes()]);
|
||||||
|
|
||||||
let mus = AggregationHashes::new(&ring, &commitment_ring, I, pseudo_output_commitment, H_p_pk);
|
let mus = AggregationHashes::new(
|
||||||
|
&ring,
|
||||||
|
&commitment_ring,
|
||||||
|
I.compress(),
|
||||||
|
pseudo_output_commitment.compress(),
|
||||||
|
H_p_pk.compress(),
|
||||||
|
);
|
||||||
|
|
||||||
let h_last = fake_responses
|
let h_last = fake_responses
|
||||||
.iter()
|
.iter()
|
||||||
@ -153,58 +159,34 @@ impl AggregationHashes {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
ring: &Ring,
|
ring: &Ring,
|
||||||
commitment_ring: &Ring,
|
commitment_ring: &Ring,
|
||||||
I: EdwardsPoint,
|
I: CompressedEdwardsY,
|
||||||
pseudo_output_commitment: EdwardsPoint,
|
pseudo_output_commitment: CompressedEdwardsY,
|
||||||
D: EdwardsPoint,
|
D: CompressedEdwardsY,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let I = I.compress();
|
let ring = ring.as_ref();
|
||||||
let D = D.compress();
|
let commitment_ring = commitment_ring.as_ref();
|
||||||
|
let I = I.as_bytes().as_ref();
|
||||||
|
let D = D.as_bytes().as_ref();
|
||||||
|
let pseudo_output_commitment = pseudo_output_commitment.as_bytes().as_ref();
|
||||||
|
|
||||||
let pseudo_output_commitment = pseudo_output_commitment.compress();
|
let mu_P = hash_to_scalar(&[
|
||||||
|
|
||||||
let mu_P = Self::hash(
|
|
||||||
b"CLSAG_agg_0",
|
b"CLSAG_agg_0",
|
||||||
ring.as_ref(),
|
|
||||||
commitment_ring.as_ref(),
|
|
||||||
&I,
|
|
||||||
&D,
|
|
||||||
&pseudo_output_commitment,
|
|
||||||
);
|
|
||||||
let mu_C = Self::hash(
|
|
||||||
b"CLSAG_agg_1",
|
|
||||||
ring.as_ref(),
|
|
||||||
commitment_ring.as_ref(),
|
|
||||||
&I,
|
|
||||||
&D,
|
|
||||||
&pseudo_output_commitment,
|
|
||||||
);
|
|
||||||
|
|
||||||
Self { mu_P, mu_C }
|
|
||||||
}
|
|
||||||
|
|
||||||
// aggregation hashes:
|
|
||||||
// mu_{P, C} =
|
|
||||||
// keccak256("CLSAG_agg_{0, 1}" ||
|
|
||||||
// ring || ring of commitments || I || z * hash_to_point(signing pk) ||
|
|
||||||
// pseudooutput commitment)
|
|
||||||
//
|
|
||||||
// where z = blinding of real commitment - blinding of pseudooutput commitment.
|
|
||||||
fn hash(
|
|
||||||
domain_prefix: &[u8],
|
|
||||||
ring: &[u8],
|
|
||||||
commitment_ring: &[u8],
|
|
||||||
I: &CompressedEdwardsY,
|
|
||||||
z_key_image: &CompressedEdwardsY,
|
|
||||||
pseudo_output_commitment: &CompressedEdwardsY,
|
|
||||||
) -> Scalar {
|
|
||||||
hash_to_scalar(&[
|
|
||||||
domain_prefix,
|
|
||||||
ring,
|
ring,
|
||||||
commitment_ring,
|
commitment_ring,
|
||||||
I.as_bytes(),
|
I,
|
||||||
z_key_image.as_bytes(),
|
D,
|
||||||
pseudo_output_commitment.as_bytes(),
|
pseudo_output_commitment,
|
||||||
])
|
]);
|
||||||
|
let mu_C = hash_to_scalar(&[
|
||||||
|
b"CLSAG_agg_1",
|
||||||
|
ring,
|
||||||
|
commitment_ring,
|
||||||
|
I,
|
||||||
|
D,
|
||||||
|
pseudo_output_commitment,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Self { mu_P, mu_C }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user