1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Constants and lookup tables for the ORION-192 wire format.
//!
//! These values are normative — they MUST NOT diverge from
//! [`SPEC.md`](https://github.com/lh0x00/orion-192/blob/main/SPEC.md).
/// The sortable64 alphabet used by ORION-192.
///
/// Ordered strictly by ASCII codepoint so that bytewise lexicographic
/// ordering of fixed-width encoded strings preserves binary numeric
/// ordering of the underlying 192-bit value.
pub const ALPHABET: &str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~";
/// Size in bytes of an ORION-192 binary identifier.
pub const ID_SIZE_BYTES: usize = 24;
/// Size in characters of the canonical ORION-192 string.
pub const ID_SIZE_CHARS: usize = 32;
/// Size in bytes of the cryptographic random tail.
pub const RANDOM_SIZE_BYTES: usize = 14;
/// Default CSPRNG pool size in bytes.
pub const DEFAULT_RANDOM_POOL_BYTES: usize = 65_536;
/// Hard lower bound on the random pool (must fit one random tail).
pub const MIN_RANDOM_POOL_BYTES: usize = RANDOM_SIZE_BYTES;
/// Hard upper bound on the random pool: 16 MiB.
pub const MAX_RANDOM_POOL_BYTES: usize = 16 * 1024 * 1024;
/// Maximum value for the 20-bit per-generator counter.
pub const MAX_COUNTER: u32 = 0x000F_FFFF;
/// Maximum value for the 48-bit `relative_ms` field.
pub const MAX_RELATIVE_MS: u128 = - 1;
/// Nanoseconds per millisecond.
pub const NS_PER_MS: u128 = 1_000_000;
/// Minimum forward gap (in nanoseconds) between the wall and monotonic
/// clocks before the hybrid clock starts following the wall clock.
pub const FORWARD_JUMP_NS: u128 = 2 * NS_PER_MS;