hashlib_codecs 2.0.0
hashlib_codecs: ^2.0.0 copied to clipboard
Fast and error resilient codecs. Currently supporting Binary(Base2), Hexadecimal(Base16), Base32, Base64, BigInt.
Hashlib Codecs #
This library contains implementations of fast and error resilient codecs in pure Dart.
Features #
Binary (Base-2) #
| Type | Available |
|---|---|
| Class | Base2Codec |
| Methods | fromBinary, toBinary |
Octal (Base-8) #
| Type | Available |
|---|---|
| Class | Base8Codec |
| Methods | fromOctal, toOctal |
Hexadecimal (Base-16) #
| Type | Available |
|---|---|
| Class | Base16Codec |
| Methods | fromHex, toHex |
Base-32 (RFC-4648) #
Supports conversion without padding
| Type | Available |
|---|---|
| Class | Base32Codec |
| Methods | fromBase32, toBase32 |
Base-64 (RFC-4648) #
Supports conversion without padding, and
the URL/Filename-safe Base64 conversion.
| Type | Available |
|---|---|
| Class | Base64Codec |
| Methods | fromBase64, toBase64 |
BigInt #
Supports both the Big-Endian and Little-Endian conversion
| Type | Available |
|---|---|
| Class | BigIntCodec |
| Methods | fromBigInt, toBigInt |
Getting Started #
The following import will give you access to all of the algorithms in this package.
import 'package:hashlib_codecs/hashlib_codecs.dart';
Check the API Reference for details.
Usage #
Examples can be found inside the example folder.
import 'package:hashlib_codecs/hashlib_codecs.dart';
void main() {
var input = [0x3, 0xF1];
print("input => $input");
print('');
print("binary => ${toBinary(input)}");
print("binary (no padding) => ${toBinary(input, padding: false)}");
print('');
print("hexadecimal => ${toHex(input)}");
print("hexadecimal (uppercase) => ${toHex(input, upper: true)}");
print('');
print("base32 => ${toBase32(input)}");
print("base32 (lowercase) => ${toBase32(input, lower: true)}");
print("base32 (no padding) => ${toBase32(input, padding: false)}");
print('');
print("base64 => ${toBase64(input)}");
print("base64url => ${toBase64(input, url: true)}");
print("base64 (no padding) => ${toBase64(input, padding: false)}");
print('');
}