Crates.io | rust-base62 |
lib.rs | rust-base62 |
version | 0.2.0 |
source | src |
created_at | 2024-11-07 11:16:51.33532 |
updated_at | 2024-11-15 06:47:49.277283 |
description | A simple library base62 encode/decode, no dependencies other libraries. |
homepage | https://github.com/hongweipeng/rust-base62 |
repository | https://github.com/hongweipeng/rust-base62 |
max_upload_size | |
id | 1439683 |
size | 45,967 |
A simple library base62 encode/decode, no dependencies other libraries.
Use big endian and support leading zeros.
It supports the standard [0-9A-Za-z]
: https://en.wikipedia.org/wiki/Base62
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
use rust_base62;
fn main() {
let plaintext = "hello";
let ciphertext = rust_base62::encode(plaintext.as_bytes());
let decode = rust_base62::decode(ciphertext.as_bytes()).unwrap();
println!("cipher text: {}", ciphertext);
println!("decode text: {}", String::from_utf8(decode).unwrap())
}