Hashlib Codecs

plugin version dependencies dart support likes pub points popularity

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)

Supports conversion without padding

Type Available
Class B32Codec
Constants base32, base32lower, base32padded, base32paddedlower
Methods fromBase32, toBase32

Base-64 (RFC-4648)

Supports conversion without padding, and
the URL/Filename-safe Base64 conversion.

Type Available
Class B64Codec
Constants base64, base64padded,base64url, base64urlpadded
Methods fromBase64, toBase64

BigInt

Supports both the Big-Endian and Little-Endian conversion

Type Available
Class BigIntCodec
Constants bigintLE, bigintBE
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('');
}

Libraries

hashlib_codecs
Implementations of fast and error resilient codecs in pure Dart.