Use GroupElement ==
MODIFY
WalletWasabi.Tests/UnitTests/Crypto/GroupElements/GeneratorTests.cs
WalletWasabi.Tests/UnitTests/Crypto/GroupElements/GeneratorTests.cs
@@ -40,5 +40,12 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.GroupElements
Assert.Equal("0281E7BCF60042263290325032954C500DCCE6D470A952C2FCDC62CF2280282D76", ByteHelpers.ToHex(Generators.Gx0.ToBytes()));
Assert.Equal("03A031FE97954902E3E84241D5E48264F06748FA741A9B2C35E8DA7C772C1A5105", ByteHelpers.ToHex(Generators.Gx1.ToBytes()));
}
+
+ [Fact]
+ public void FriendlyNameNullCheck()
+ {
+ Assert.False(Generators.TryGetFriendlyGeneratorName(null, out string name));
+ Assert.Empty(name);
+ }
}
}

MODIFY
WalletWasabi/Crypto/Groups/Generators.cs
WalletWasabi/Crypto/Groups/Generators.cs
@@ -57,47 +57,47 @@ namespace WalletWasabi.Crypto.Groups
/// </summary>
public static GroupElement Gs { get; } = GroupElement.FromText("Gs");
- public static bool TryGetFriendlyGeneratorName(GroupElement ge, out string name)
+ public static bool TryGetFriendlyGeneratorName(GroupElement? ge, out string name)
{
name = "";
- if (ge.X == G.X && ge.Y == G.Y)
+ if (ge == G)
{
name = "Standard";
}
- else if (ge.X == Gw.X && ge.Y == Gw.Y)
+ else if (ge == Gw)
{
name = nameof(Gw);
}
- else if (ge.X == Gwp.X && ge.Y == Gwp.Y)
+ else if (ge == Gwp)
{
name = nameof(Gwp);
}
- else if (ge.X == Gx0.X && ge.Y == Gx0.Y)
+ else if (ge == Gx0)
{
name = nameof(Gx0);
}
- else if (ge.X == Gx1.X && ge.Y == Gx1.Y)
+ else if (ge == Gx1)
{
name = nameof(Gx1);
}
- else if (ge.X == GV.X && ge.Y == GV.Y)
+ else if (ge == GV)
{
name = nameof(GV);
}
- else if (ge.X == Gg.X && ge.Y == Gg.Y)
+ else if (ge == Gg)
{
name = nameof(Gg);
}
- else if (ge.X == Gh.X && ge.Y == Gh.Y)
+ else if (ge == Gh)
{
name = nameof(Gh);
}
- else if (ge.X == Ga.X && ge.Y == Ga.Y)
+ else if (ge == Ga)
{
name = nameof(Ga);
}
- else if (ge.X == Gs.X && ge.Y == Gs.Y)
+ else if (ge == Gs)
{
name = nameof(Gs);
}

MODIFY
WalletWasabi/Crypto/Groups/GroupElement.cs
WalletWasabi/Crypto/Groups/GroupElement.cs
@@ -30,8 +30,6 @@ namespace WalletWasabi.Crypto.Groups
public static GroupElement Infinity { get; } = new GroupElement(GE.Infinity);
private GE Ge { get; }
- public FE X => Ge.x;
- public FE Y => Ge.y;
public bool IsInfinity => Ge.IsInfinity;

Use GroupElement ==