Crates.io | rspamd-base32 |
lib.rs | rspamd-base32 |
version | 0.1.1 |
source | src |
created_at | 2024-10-23 10:35:10.506695 |
updated_at | 2024-11-03 21:23:10.991666 |
description | encodes and decodes base32 bug-to-bug compatible with Rspamd |
homepage | |
repository | https://github.com/vstakhov/rust-base32 |
max_upload_size | |
id | 1419954 |
size | 38,728 |
This is a conversion module from and to zbase32 encoding. It also supports RFC 4648 and Bech32 alphabets.
The main purpose of zbase32 is to provide human readable encoding that is more efficient than hex
encoding.
zbase32
utilizes up to len * 5 / 8
of space for encoded date and contains no padding (and hence no error control, like base64
).
However, it seems to be much readable for a human when an encoding does not contain padding.
This module is intended to be compatible with Rspamd base32 encoding, so it has bug-to-bug compatibility with Rspamd C implementation including:
This is my first experiment with Rust, so many things might be ugly/broken.
extern crate base32;
use base32::{encode, decode};
fn main() {
let a = b"hello world";
let b = "em3ags7py376g3tprd";
assert_eq!(encode(a), b);
assert_eq!(a, &decode(b).unwrap()[..]);
}
This project is licensed under Apache 2.0 license.