Skip to content

Commit d15c855

Browse files
Replace the obsolete SecP256k1 curve object with a constant biginteger (curve order is the only prop used)
1 parent 47df45e commit d15c855

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎Src/FinderOuter/Backend/ConstantsFO.cs‎

Lines changed: 6 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 System;
7+
using System.Numerics;
78

89
namespace FinderOuter.Backend
910
{
@@ -71,5 +72,10 @@ public struct ConstantsFO
7172
['X', 'x'],
7273
['Z', 'z'],
7374
];
75+
76+
/// <summary>
77+
/// N = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
78+
/// </summary>
79+
public static readonly BigInteger CurveOrder = BigInteger.Parse("115792089237316195423570985008687907852837564279074904382605163141518161494337");
7480
}
7581
}

‎Src/FinderOuter/Services/ArmoryService.cs‎

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

66
using Autarkysoft.Bitcoin;
7-
using Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve;
87
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve;
98
using Autarkysoft.Bitcoin.Cryptography.EllipticCurve.Primitives;
109
using FinderOuter.Backend;
@@ -37,7 +36,6 @@ public ArmoryService(IReport rep)
3736
private int[] missingIndexes;
3837
private bool hasChainCode;
3938
private byte[] chainCode;
40-
private readonly BigInteger N = new SecP256k1().N;
4139

4240

4341

‎Src/FinderOuter/Services/Base58Service.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ private void WifLoopMissingEnd(bool compressed)
142142
BigInteger diff = end - start + 1;
143143
report.AddMessageSafe($"Using an optimized method checking only {diff:n0} keys.");
144144

145-
Autarkysoft.Bitcoin.Cryptography.Asymmetric.EllipticCurve.SecP256k1 curve = new();
146-
if (start == 0 || end >= curve.N)
145+
if (start == 0 || end >= ConstantsFO.CurveOrder)
147146
{
148147
report.AddMessageSafe("There is something wrong with the given key, it is outside of valid key range.");
149148
return;

0 commit comments

Comments
 (0)