Inherit KnowledgeOfDiscreteLog from KnowledgeOfRepresentation
MODIFY
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfDiscreteLog.cs
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfDiscreteLog.cs
using NBitcoin.Secp256k1;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using WalletWasabi.Crypto.Groups;
using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
- public class KnowledgeOfDiscreteLog
+ public class KnowledgeOfDiscreteLog : KnowledgeOfRepresentation
{
public KnowledgeOfDiscreteLog(GroupElement nonce, Scalar response)
- {
- Guard.False($"{nameof(nonce)}.{nameof(nonce.IsInfinity)}", nonce.IsInfinity);
- Guard.False($"{nameof(response)}.{nameof(response.IsZero)}", response.IsZero);
+ : base(nonce, new[] { response })
- Nonce = nonce;
- Response = response;
+ {
}
- public GroupElement Nonce { get; }
- public Scalar Response { get; }
+ public Scalar Response => Responses.First();
}
}

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfRepresentation.cs
WalletWasabi/Crypto/ZeroKnowledge/KnowledgeOfRepresentation.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Crypto.Groups;
+using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
@@ -10,6 +11,13 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
{
public KnowledgeOfRepresentation(GroupElement nonce, IEnumerable<Scalar> responses)
{
+ Guard.False($"{nameof(nonce)}.{nameof(nonce.IsInfinity)}", nonce.IsInfinity);
+ Guard.NotNullOrEmpty(nameof(responses), responses);
+ foreach (var response in responses)
+ {
+ Guard.False($"{nameof(response)}.{nameof(response.IsZero)}", response.IsZero);
+ }
+
Nonce = nonce;
Responses = responses;
}

Inherit KnowledgeOfDiscreteLog from KnowledgeOfRepresentation