decodeBigInt function

BigInt decodeBigInt(
  1. List<int> bytes
)

Decode a list of integers (bytes) into a BigInt. This function takes a List of integers representing bytes and converts them into a BigInt, considering byte order.

Implementation

BigInt decodeBigInt(List<int> bytes) {
  BigInt result = BigInt.from(0);
  for (int i = 0; i < bytes.length; i++) {
    /// Add each byte to the result, considering its position and byte order.
    result += BigInt.from(bytes[bytes.length - i - 1]) << (8 * i);
  }
  return result;
}