Rename KnowledgeOfExponent to KnowledgeOfDiscreteLog
RENAME
WalletWasabi.Tests/UnitTests/Crypto/ZeroKnowledge/KnowledgeOfExponentTests.cs
WalletWasabi.Tests/UnitTests/Crypto/ZeroKnowledge/KnowledgeOfDiscreteLogTests.cs
@@ -10,7 +10,7 @@ using Xunit;
namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
{
- public class KnowledgeOfExponentTests
+ public class KnowledgeOfDiscreteLogTests
{
public static readonly Scalar ScalarLargestOverflow = new Scalar(uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue);
public static readonly Scalar ScalarN = EC.N;
@@ -86,7 +86,7 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
var challenge = Challenge.Build(publicPoint, nonce);
var response = randomScalar + (secret + Scalar.One) * challenge;
- var proof = new KnowledgeOfExponent(nonce, response);
+ var proof = new KnowledgeOfDiscreteLog(nonce, response);
Assert.False(Verifier.Verify(proof, publicPoint, generator));
// Other false verification tests.
@@ -95,7 +95,7 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
var scalar = new Scalar(11);
var gen = Generators.G;
- proof = new KnowledgeOfExponent(point1, scalar);
+ proof = new KnowledgeOfDiscreteLog(point1, scalar);
Assert.False(Verifier.Verify(proof, point2, gen));
}
@@ -166,15 +166,15 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
}
[Fact]
- public void KnowledgeOfExponentThrows()
+ public void KnowledgeOfDiscreteLogThrows()
{
// Demonstrate when it shouldn't throw.
- new KnowledgeOfExponent(Generators.G, Scalar.One);
+ new KnowledgeOfDiscreteLog(Generators.G, Scalar.One);
// Infinity or zero cannot pass through.
- Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfExponent(Generators.G, Scalar.Zero));
- Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfExponent(GroupElement.Infinity, Scalar.One));
- Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfExponent(GroupElement.Infinity, Scalar.Zero));
+ Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfDiscreteLog(Generators.G, Scalar.Zero));
+ Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfDiscreteLog(GroupElement.Infinity, Scalar.One));
+ Assert.ThrowsAny<ArgumentException>(() => new KnowledgeOfDiscreteLog(GroupElement.Infinity, Scalar.Zero));
}
[Fact]
@@ -207,7 +207,7 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
[Fact]
public void VerifierThrows()
{
- var proof = new KnowledgeOfExponent(Generators.G, Scalar.One);
+ var proof = new KnowledgeOfDiscreteLog(Generators.G, Scalar.One);
// Demonstrate when it shouldn't throw.
Verifier.Verify(proof, Generators.Ga, Generators.Gg);

RENAME
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfExponent.cs
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfDiscreteLog.cs
@@ -7,9 +7,9 @@ using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
- public class KnowledgeOfExponent
+ public class KnowledgeOfDiscreteLog
{
- public KnowledgeOfExponent(GroupElement nonce, Scalar response)
+ public KnowledgeOfDiscreteLog(GroupElement nonce, Scalar response)
{
Guard.False($"{nameof(nonce)}.{nameof(nonce.IsInfinity)}", nonce.IsInfinity);
Guard.False($"{nameof(response)}.{nameof(response.IsZero)}", response.IsZero);

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/Prover.cs
WalletWasabi/Crypto/ZeroKnowledge/Prover.cs
@@ -11,7 +11,7 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
{
public static class Prover
{
- public static KnowledgeOfExponent CreateProof(Scalar secret, GroupElement publicPoint, GroupElement generator, WasabiRandom? random = null)
+ public static KnowledgeOfDiscreteLog CreateProof(Scalar secret, GroupElement publicPoint, GroupElement generator, WasabiRandom? random = null)
{
Guard.False($"{nameof(secret)}.{nameof(secret.IsOverflow)}", secret.IsOverflow);
Guard.False($"{nameof(secret)}.{nameof(secret.IsZero)}", secret.IsZero);
@@ -24,7 +24,7 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
var proof = CreateProof(new[] { (secret, generator) }, publicPoint, random);
- return new KnowledgeOfExponent(proof.Nonce, proof.Responses.First());
+ return new KnowledgeOfDiscreteLog(proof.Nonce, proof.Responses.First());
}
public static KnowledgeOfRepresentation CreateProof(IEnumerable<(Scalar secret, GroupElement generator)> secretGeneratorPairs, GroupElement publicPoint, WasabiRandom? random = null)

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/Verifier.cs
WalletWasabi/Crypto/ZeroKnowledge/Verifier.cs
@@ -9,7 +9,7 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
{
public static class Verifier
{
- public static bool Verify(KnowledgeOfExponent proof, GroupElement publicPoint, GroupElement generator)
+ public static bool Verify(KnowledgeOfDiscreteLog proof, GroupElement publicPoint, GroupElement generator)
{
Guard.False($"{nameof(generator)}.{nameof(generator.IsInfinity)}", generator.IsInfinity);
Guard.False($"{nameof(publicPoint)}.{nameof(publicPoint.IsInfinity)}", publicPoint.IsInfinity);

Rename KnowledgeOfExponent to KnowledgeOfDiscreteLog