bitsToOctetsWithOrderPadding static method

List<int> bitsToOctetsWithOrderPadding(
  1. List<int> data,
  2. BigInt order
)

Converts a sequence of bits represented as a byte array to octets.

Implementation

static List<int> bitsToOctetsWithOrderPadding(List<int> data, BigInt order) {
  final BigInt z1 = bitsToBigIntWithLengthLimit(data, order.bitLength);
  BigInt z2 = z1 - order;
  if (z2 < BigInt.zero) {
    z2 = z1;
  }
  final bytes = bigintToBytesWithPadding(z2, order);
  return bytes;
}