bitsToBigIntWithLengthLimit static method

BigInt bitsToBigIntWithLengthLimit(
  1. List<int> data,
  2. int qlen
)

Converts a sequence of bits represented as a byte array to a BigInt integer.

Implementation

static BigInt bitsToBigIntWithLengthLimit(List<int> data, int qlen) {
  final BigInt x = BigInt.parse(BytesUtils.toHexString(data), radix: 16);
  final int l = data.length * 8;

  if (l > qlen) {
    return (x >> (l - qlen));
  }
  return x;
}