util/bytes library
Bytes utilities: conversion, generation, etc.
Extensions
- BigIntToByteList on BigInt
- Extension to convert BigInt values to byte arrays.
-
ByteListToBigInt
on List<
int> - Extension to convert byte arrays to BigInt values.
- StringToBytes on String
- Extension for converting strings to bytes for secure handling.
Functions
-
convertBigIntToByteList(
BigInt number) → Uint8List - Convert a BigInt to a byte list. Source: https://github.com/dart-lang/sdk/issues/32803#issuecomment-1228291047
-
convertByteListToBigInt(
List< int> bytes) → BigInt - Convert a byte list to a BigInt. Source: https://github.com/dart-lang/sdk/issues/32803#issuecomment-1228291047
-
convertByteListToInt(
List< int> bytes) → int - Convert byte list to int.
-
convertIntToByteList(
int number) → Uint8List - Convert 64-bit int to byte list. Source: https://stackoverflow.com/a/57536472/376497
-
generateRandomBigInt(
BigInt min, BigInt max) → BigInt -
Generates a random BigInt in the range
min, max
. -
generateRandomBytes(
int bytesCount) → Uint8List - Generates random bytes using a cryptographically secure PRNG.