Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antosser/base94-rs
Base94 Encoding Library: Convert binary data to a compact text-based format using Base94 encoding. Effortlessly encode and decode data for a wide range of use cases. 🔐🔍
https://github.com/antosser/base94-rs
algorithm base94 binary-to-text cryptography development encoding rust rust-library security text-format utility
Last synced: about 23 hours ago
JSON representation
Base94 Encoding Library: Convert binary data to a compact text-based format using Base94 encoding. Effortlessly encode and decode data for a wide range of use cases. 🔐🔍
- Host: GitHub
- URL: https://github.com/antosser/base94-rs
- Owner: Antosser
- Created: 2023-08-11T22:42:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-02T19:47:36.000Z (over 1 year ago)
- Last Synced: 2024-08-10T08:17:05.931Z (6 months ago)
- Topics: algorithm, base94, binary-to-text, cryptography, development, encoding, rust, rust-library, security, text-format, utility
- Language: Rust
- Homepage: https://crates.io/crates/base94
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Base94 Encoding Library
Convert binary data to a compact text-based format using Base94 encoding. Effortlessly encode and decode data for a wide range of use cases. 🔐🔍
## Features
- Encode binary data into a Base94-encoded string.
- Decode Base94-encoded strings back to their original binary form.## Usage
### As a libraryTo use this library, add it as a dependency in your `Cargo.toml`:
```toml
[dependencies]
base94 = "0.1.0"
```
Then, in your Rust code:
```rust
use base94::{encode, decode};fn main() {
let data = b"Hello, World!";
let base = 94;// Encode data
let encoded = encode(data, base);
println!("Encoded: {}", encoded);// Decode data
let decoded = decode(&encoded, base).unwrap();
println!("Decoded: {:?}", decoded);
}
```### As a CLI
To install the CLI, run `cargo install base94`. This will install the `base94cli` binary to your system.
```
Base94 encoding/decoding libraryUsage: base94cli.exe [OPTIONS]
Arguments:
Whether to encode or decode the input [possible values: encode, decode]
The input file to encode or decode
The output file to write the result toOptions:
-b, --base The base to use for encoding or decoding. Must be between 2 and 94 (inclusive) [default: 94]
-h, --help Print help
-V, --version Print version
```## 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
Encoding and decoding example with a base of 50:
```rust
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);
```