Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

passcod/rust-base85

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Base85

Like Base64, but encodes four bytes of binary into five characters of ASCII, achieving a 25% increase instead of 33%. Unlike Base64, though, it doesn't have a single most-used variant. This crate implements the four most common, plus a variant suitable for use as filenames, and has an option for a custom character set.

Usage

The crate is designed following the Base64 implementation in the Standard Library. Because it is outside the stdlib, though, it provides methods on the base85::Config struct:

extern crate base85;

let codec = base85::Z85; // See below for variants, or construct your own:
let custom = base85::Config {
  char_set: base85::Filename,
  all_zero: None,
  line_length: Some(123)
};

let plain = "Hello world";
let encoded = codec.from_str(&plain_text);
let decoded = codec.to_str(&encoded);
assert_eq!(plain, decoded);

Variants

  • ASCII85 - Adobe's variant for PostScript
  • BTOA - Original by Paul E. Rutter
  • FILENAME - Z85 variant for use in filenames
  • RFC1924 - Esoteric variant "for IPv6"
  • Z85 - Variant used in ZeroMQ

Sources and specs

Etc

  • Public Domain
  • Pull requests welcome
  • Say hi! :D

About

Base85 in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published