Skip to content

Commit

Permalink
Remove redundant Verify() calls in scalar static tests + add a Multip…
Browse files Browse the repository at this point in the history
…ly test to use r2
  • Loading branch information
Coding-Enthusiast committed Jan 26, 2024
1 parent 95bfdd8 commit 6b1adc7
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1480,24 +1480,22 @@ public void Libsecp256k1_StaticTest(byte[] xba, byte[] yba, byte[] r1ba, byte[]
Assert.False(overflow);

Scalar8x32 z = x.Multiply(y);
Assert.True(z.Verify());
Assert.Equal(r1, z);

if (!y.IsZero)
{
Scalar8x32 zz = y.Inverse();
Assert.True(zz.Verify());
Scalar8x32 zzv = y.InverseVar();
Assert.Equal(zzv, zz);
// x*y*y' == x*1 == x (y' represents inverse of y)
z = z.Multiply(zz);
Assert.True(z.Verify());
Assert.Equal(x, z);
// y'*y == 1
zz = zz.Multiply(y);
Assert.True(zz.Verify());
Assert.Equal(Scalar8x32.One, zz);
}
z = x.Multiply(x);
Assert.Equal(r2, z);
}


Expand Down

0 comments on commit 6b1adc7

Please sign in to comment.