base85 1.0.4 copy "base85: ^1.0.4" to clipboard
base85: ^1.0.4 copied to clipboard

Base85 encoder/decoder written in native Dart.

example/base85_example.dart

import 'dart:io';
import 'dart:typed_data';

import 'package:base85/base85.dart';

void main() {
  var codec = Base85Codec(Alphabets.z85);
  var encode = codec.encode(Uint8List.fromList('Hello, world!!!!'.codeUnits));
  print(encode);

  /// =>   nm=QNz.92Pz/PV8aT50L
  print(String.fromCharCodes(codec.decode(encode)));

  /// =>   Hello, world!!!!

  codec = Base85Codec(Alphabets.ascii85, AlgoType.ascii85);
  print(codec.encode(Uint8List.fromList('Hello, world'.codeUnits)));

  /// =>    <~87cURD_*#TDfTZ)~>
  print(String.fromCharCodes(codec.decode('<~87cURD_*#TDfTZ)~>')));

  /// =>    Hello, world

  codec = Base85Codec(Alphabets.IPv6, AlgoType.IPv6);
  var address = InternetAddress(
    '1080::8:800:200c:417a',
    type: InternetAddressType.IPv6,
  );
  print(codec.encode(address.rawAddress));

  /// =>    4)+k&C#VzJ4br>0wv%Yp
  ///
  var decode = codec.decode('4)+k&C#VzJ4br>0wv%Yp');
  address = InternetAddress.fromRawAddress(
    decode,
    type: InternetAddressType.IPv6,
  );
  print(address.address);

  /// =>    1080::8:800:200c:417a
}
7
likes
135
pub points
55%
popularity

Publisher

unverified uploader

Base85 encoder/decoder written in native Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on base85