base_x 1.0.1

Dart native js
Flutter Android iOS web

Fast base encoding / decoding of any given alphabet dart implementation library.

base-x #

Fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.

WARNING: This module is NOT RFC3548 compliant, it cannot be used for base16 (hex), base32, or base64 encoding in a standards compliant manner.

Example #

Base58

import 'package:base_x/base_x.dart';


var base58 = BaseXCodec('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');

var hash = Uint8List.fromList([14, 251, 24, 220, 202, 235, 97, 232, 85, 229, 109, 188, 53, 146, 43, 36, 246, 238, 110, 55, 202, 163, 160, 123, 169, 35]);

print(base58.encode(hash));
///TcASfmyoFiNobNaCHeiPMkWgGmovoxk1sqk

print(base58.decode('TcASfmyoFiNobNaCHeiPMkWgGmovoxk1sqk'));
///[14, 251, 24, 220, 202, 235, 97, 232, 85, 229, 109, 188, 53, 146, 43, 36, 246, 238, 110, 55, 202, 163, 160, 123, 169, 35]

Alphabets #

See below for a list of commonly recognized alphabets, and their respective base.

BaseAlphabet
201
801234567
110123456789a
160123456789abcdef
320123456789ABCDEFGHJKMNPQRSTVWXYZ
32ybndrfg8ejkmcpqxot1uwisza345h769 (z-base-32)
360123456789abcdefghijklmnopqrstuvwxyz
58123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
620123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
64ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
66ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~

LICENSE MIT #

A direct derivation of the base58 implementation from bitcoin/bitcoin, generalized for variable length alphabets.

3
likes
100
pub points
71%
popularity

Fast base encoding / decoding of any given alphabet dart implementation library.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

istrangem@gmail.com

License

MIT (LICENSE)

More

Packages that depend on base_x