fromSM function

BigInt fromSM(
  1. List<int> buf, {
  2. Endian endian = Endian.big,
})

Implementation

BigInt fromSM(List<int> buf, {Endian endian = Endian.big}) {
  BigInt ret;
  List<int> localBuffer = buf.toList();
  if (localBuffer.length == 0) {
    return decodeBigIntSV([0]);
  }

  if (endian == Endian.little) {
    localBuffer = buf.reversed.toList();
  }

  if (localBuffer[0] & 0x80 != 0) {
    localBuffer[0] = localBuffer[0] & 0x7f;
    ret = decodeBigIntSV(localBuffer);
    ret = (-ret);
  } else {
    ret = decodeBigIntSV(localBuffer);
  }

  return ret;
}