bigintToBytesWithPadding static method
Converts a BigInt 'num' into a bytes with a specified 'order'.
Implementation
static List<int> bigintToBytesWithPadding(BigInt x, BigInt order) {
String hexStr = x.toRadixString(16);
final int hexLen = hexStr.length;
final int byteLen = (order.bitLength + 7) ~/ 8;
if (hexLen < byteLen * 2) {
hexStr = '0' * (byteLen * 2 - hexLen) + hexStr;
}
return BytesUtils.fromHexString(hexStr);
}