bytesToBigInt function
Decodes the provided BigInt from bytes. This is OS2IP as defined in rfc3447.
Implementation
BigInt bytesToBigInt(Iterable<int> bytes, {Endian endian = Endian.big}) {
BigInt result = BigInt.from(0);
if (endian == Endian.little) {
bytes = bytes.toList().reversed;
}
for (int byte in bytes) {
result = result << 8;
result |= BigInt.from(byte);
}
return result;
}