Skip to content

Commit

Permalink
Use complete addition instead of incomplete addition inside sinsemill…
Browse files Browse the repository at this point in the history
…a_commit
  • Loading branch information
dconnolly committed Sep 28, 2021
1 parent 1601c9f commit dba5aa1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions zebra-chain/src/orchard/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ pub fn sinsemilla_hash(D: &[u8], M: &BitVec<Lsb0, u8>) -> Option<pallas::Base> {
/// Sinsemilla commit
///
/// We construct Sinsemilla commitments by hashing to a point with Sinsemilla
/// hash, and adding a randomized point on the Pallas curve.
/// hash, and adding a randomized point on the Pallas curve (with complete
/// addition, vs incomplete addition, as used in [`sinsemilla_hash_to_point`]).
///
/// SinsemillaCommit_r(D, M) := SinsemillaHashToPoint(D || "-M", M) + [r]GroupHash^P(D || "-r", "")
///
Expand All @@ -175,10 +176,8 @@ pub fn sinsemilla_commit(
D: &[u8],
M: &BitVec<Lsb0, u8>,
) -> Option<pallas::Point> {
incomplete_addition(
sinsemilla_hash_to_point(&[D, b"-M"].concat(), M),
Some(pallas_group_hash(&[D, b"-r"].concat(), b"") * r),
)
sinsemilla_hash_to_point(&[D, b"-M"].concat(), M)
.map(|point| point + pallas_group_hash(&[D, b"-r"].concat(), b"") * r)
}

/// SinsemillaShortCommit_r(D, M) := Extract⊥ P(SinsemillaCommit_r(D, M))
Expand Down

0 comments on commit dba5aa1

Please sign in to comment.