Crate base94

source ·
Expand description

Base94 Encoding Library

This crate provides functions for encoding and decoding data using Base94 encoding. Base94 encoding is a method of converting binary data into a text-based format using a larger character set than Base64. The encoding and decoding functions in this crate allow you to convert data between its original binary form and a Base94-encoded string representation.

Usage

To use this library, you can include it as a dependency in your Cargo.toml:

[dependencies]
base94 = {current_version}

Then, you can use the provided functions in your Rust code:

use base94::{encode, decode};

let data = b"Hello, World!";
let base = 94;
let encoded = encode(data, base);
let decoded = decode(&encoded, base).unwrap();

assert_eq!(decoded, data);

Supported Bases

The encoding and decoding functions support various bases within the range of 2 to 94. The specified base must be consistent between encoding and decoding operations.

Examples

use base94::{encode, decode};

let data = b"Example data for encoding.";
let base = 50;

let encoded = encode(data, base);
let decoded = decode(&encoded, base).unwrap();

assert_eq!(decoded, data);

Enums

Statics

Functions

  • Decodes a Base94-encoded string back to its original byte representation using the specified base.
  • Encodes a slice of bytes into a Base94-encoded string using the specified base.