hashlib_codecs 1.1.1
hashlib_codecs: ^1.1.1 copied to clipboard
Fast and error resilient codecs. Currently supporting Binary(Base2), Hexadecimal(Base16), Base32 and Base64.
Hashlib Codecs #
This library contains implementations of fast and error resilient codecs in pure Dart.
Features #
Binary (Base-2) #
Type | Available |
---|---|
Class | BinaryCodec |
Constants | base2 |
Methods | fromBinary , toBinary |
Hexadecimal (Base-16) #
Type | Available |
---|---|
Class | B16Codec |
Constants | base16 , base16lower |
Methods | fromHex , toHex |
Base-32 (RFC-4648) #
Type | Available |
---|---|
Class | B32Codec |
Constants | base32 , base32lower , base32padded , base32paddedlower |
Methods | fromBase32 , toBase32 |
Base-64 (RFC-4648) #
Type | Available |
---|---|
Class | B64Codec |
Constants | base64 , base64padded |
Methods | fromBase64 , toBase64 |
Base-64 URL-safe (RFC-4648) #
Type | Available |
---|---|
Class | B64URLCodec |
Constants | base64url , base64urlpadded |
Methods | fromBase64Url , toBase64Url |
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('');
}