Skip to content

Commit f509aaa

Browse files
Replace the obsolete SecP256k1
1 parent 2391b68 commit f509aaa

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

Src/Tests/KeyHelper.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// file LICENCE or http://www.opensource.org/licenses/mit-license.php.
55

66
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
7+
using System.Numerics;
78

89
namespace Tests
910
{
@@ -12,6 +13,10 @@ namespace Tests
1213
/// </summary>
1314
public static class KeyHelper
1415
{
16+
private static readonly byte[] _order = BigInteger.Parse("115792089237316195423570985008687907852837564279074904382605163141518161494337").ToByteArray(true, true);
17+
public static byte[] CurveOrder => _order;
18+
19+
1520
internal static string Prv1Wif = "L28Peud5cQcijrtMthAdUS8FynpM8PKZtnoUZb1VAio9WxKoebHt";
1621
internal static PrivateKey Prv1 => new(Prv1Wif);
1722
internal static Point Pub1

Src/Tests/Services/Comparers/PrvToAddrBothComparerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file LICENCE or http://www.opensource.org/licenses/mit-license.php.
55

6-
using Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve;
76
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
87
using FinderOuter.Services.Comparers;
98
using System;
@@ -96,7 +95,7 @@ public void Compare_EdgeTest()
9695
b = comp.Compare(key);
9796
Assert.False(b);
9897

99-
key = new SecP256k1().N.ToByteArray(true, true);
98+
key = KeyHelper.CurveOrder;
10099
b = comp.Compare(key);
101100
Assert.False(b);
102101
}

Src/Tests/Services/Comparers/PrvToAddrCompComparerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file LICENCE or http://www.opensource.org/licenses/mit-license.php.
55

6-
using Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve;
76
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
87
using FinderOuter.Services.Comparers;
98
using System;
@@ -75,7 +74,7 @@ public void Compare_EdgeTest()
7574
b = comp.Compare(key);
7675
Assert.False(b);
7776

78-
key = new SecP256k1().N.ToByteArray(true, true);
77+
key = KeyHelper.CurveOrder;
7978
b = comp.Compare(key);
8079
Assert.False(b);
8180
}

Src/Tests/Services/Comparers/PrvToAddrNestedComparerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file LICENCE or http://www.opensource.org/licenses/mit-license.php.
55

6-
using Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve;
76
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
87
using FinderOuter.Services.Comparers;
98
using System;
@@ -66,7 +65,7 @@ public void Compare_EdgeTest()
6665
b = comp.Compare(key);
6766
Assert.False(b);
6867

69-
key = new SecP256k1().N.ToByteArray(true, true);
68+
key = KeyHelper.CurveOrder;
7069
b = comp.Compare(key);
7170
Assert.False(b);
7271
}

Src/Tests/Services/Comparers/PrvToAddrUncompComparerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file LICENCE or http://www.opensource.org/licenses/mit-license.php.
55

6-
using Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve;
76
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
87
using FinderOuter.Services.Comparers;
98
using System;
@@ -75,7 +74,7 @@ public void Compare_EdgeTest()
7574
b = comp.Compare(key);
7675
Assert.False(b);
7776

78-
key = new SecP256k1().N.ToByteArray(true, true);
77+
key = KeyHelper.CurveOrder;
7978
b = comp.Compare(key);
8079
Assert.False(b);
8180
}

0 commit comments

Comments
 (0)