modo/encoding/mod.rs
1//! # modo::encoding
2//!
3//! Binary-to-text encoding utilities.
4//!
5//! Provides three submodules:
6//!
7//! | Submodule | Standard | Alphabet | Padding | Extra |
8//! | ------------- | -------- | ---------------- | ------- | ---------------- |
9//! | [`base32`] | RFC 4648 | `A–Z`, `2–7` | none | — |
10//! | [`base64url`] | RFC 4648 | `A–Za–z0–9-_` | none | — |
11//! | [`hex`] | — | `0–9`, `a–f` | — | [`hex::sha256`] |
12//!
13//! The [`base32`] and [`base64url`] submodules each expose an `encode` / `decode`
14//! pair. The [`hex`] submodule exposes `encode` (no `decode`) plus a convenience
15//! [`hex::sha256`] function that returns a 64-character hex digest.
16//!
17//! This module is always available and requires no feature flag.
18//!
19//! # Examples
20//!
21//! ```rust
22//! use modo::encoding::{base32, base64url, hex};
23//!
24//! let b32 = base32::encode(b"foobar");
25//! assert_eq!(b32, "MZXW6YTBOI");
26//!
27//! let b64 = base64url::encode(b"Hello");
28//! assert_eq!(b64, "SGVsbG8");
29//!
30//! let h = hex::encode(b"\xde\xad");
31//! assert_eq!(h, "dead");
32//!
33//! let digest = hex::sha256(b"hello world");
34//! assert_eq!(digest.len(), 64);
35//! ```
36
37pub mod base32;
38pub mod base64url;
39pub mod hex;