Closed fusion44 closed 3 years ago
in my project downgrading crypto to 2.0.3 did the trick for some reason.
@fusion44 , have you find a solution please ? with flutter 2.0, we need to update all dependencies.
@redDwarf03 Unfortunately not. Currently working on another project but I eventually will get back to this one. So I'm still interested in a solution.
apparently, this is the method decodeBigInt the source of the issue new code: https://github.com/bcgit/pc-dart/blob/be4142082f01cd3971bec4890342e039799c1f0e/lib/src/utils.dart#L19
/// Decode a BigInt from bytes in big-endian encoding.
/// Twos compliment.
BigInt decodeBigInt(List<int> bytes) {
var negative = bytes.isNotEmpty && bytes[0] & 0x80 == 0x80;
BigInt result;
if (bytes.length == 1) {
result = BigInt.from(bytes[0]);
} else {
result = BigInt.zero;
for (var i = 0; i < bytes.length; i++) {
var item = bytes[bytes.length - i - 1];
result |= (BigInt.from(item) << (8 * i));
}
}
return result != BigInt.zero
? negative ? result.toSigned(result.bitLength) : result
: BigInt.zero;
}
old code:
BigInt decodeBigInt(List<int> bytes) {
BigInt result = new BigInt.from(0);
for (int i = 0; i < bytes.length; i++) {
result += new BigInt.from(bytes[bytes.length - i - 1]) << (8 * i);
}
return result;
}
to be confirmed
Should also be fixed with my PR! https://github.com/dart-bitcoin/bip32-dart/pull/10
Hi,
I have the following code:
Line three throws an error Private key not in range [1, n]
The same code seems to work well when overriding dependencies with an old pointycastle version:
Thank you.