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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! An **ENID** (Encrypted Numeric Identifier) is a 40- or 80-bit value, which can
//! be used as a unique identifier.
//!
//! An example of a 40-bit ENID:
//!
//! ```text
//! m6sc7n75
//! ```
//!
//! And an 80-bit ENID:
//!
//! ```text
//! y3gx5gxm-mpb8ey39
//! ```
//!
//! ENIDs are generated by encrypting plaintext bytes so that they appear
//! pseudo-random. The encrypted bytes are then formatted as a variant of Base32
//! (Crockford's Base32) that excludes the letters `i`, `l`, `o`, and `u`. Each
//! group of 40 bits is represented by 8 characters and separated by a hyphen.
//!
//! This crate does not yet include a method for generating ENIDs, which will be
//! added in a future version.
//!
//! Some features of ENIDs:
//!
//! * Short - ENIDs are 8 or 17 characters long, compared with 36-character UUIDs.
//! * Uniformly distributed - sequentially-generated ENIDs are unlikely to appear
//! similar.
//! * URL-safe - ENIDs can be used in URLs without percent-encoding.
//!
//! # Crate features
//!
//! * `arbitrary` - adds [`Arbitrary`](arbitrary::Arbitrary) implementations for
//! fuzzing.
//! * `borsh` - adds serialization and deserialization via [`borsh`].
//! * `bytemuck` - adds [`Pod`](bytemuck::Pod) implementations for byte
//! manipulation.
//! * `serde` - adds serialization and deserialization via [`serde`].
//! * `slog` - adds [`Value`](slog::Value) implementations for serialization.
extern crate std;
pub use ;
/// Creates an [`Enid40`] by parsing the given string at compile-time.
///
/// An invalid ENID string will cause a compilation error.
///
/// # Examples
///
/// Parsing an ENID at compile-time:
///
/// ```
/// # use enid::{enid40, Enid40};
/// const ENID: Enid40 = enid40!("m6sc7n75");
/// ```
///
/// An invalid ENID will not compile:
///
/// ```compile_fail
/// # use enid::{enid40, Enid40};
/// const ENID: Enid40 = enid40!("iisc7n75");
/// ```
/// Creates an [`Enid80`] by parsing the given string at compile-time.
///
/// An invalid ENID string will cause a compilation error.
///
/// # Examples
///
/// Parsing an ENID at compile-time:
///
/// ```
/// # use enid::{enid80, Enid80};
/// const ENID: Enid80 = enid80!("y3gx5gxm-mpb8ey39");
/// ```
///
/// An invalid ENID will not compile:
///
/// ```compile_fail
/// # use enid::{enid80, Enid80};
/// const ENID: Enid80 = enid80!("iigx5gxm-mpb8ey39");
/// ```
/// Creates an [`Enid`] by parsing the given string at compile-time.
///
/// An invalid ENID string will cause a compilation error.
///
/// # Examples
///
/// Parsing an ENID at compile-time:
///
/// ```
/// # use enid::{enid, Enid};
/// const ENID_40: Enid = enid!("m6sc7n75");
/// const ENID_80: Enid = enid!("y3gx5gxm-mpb8ey39");
/// ```
///
/// An invalid ENID will not compile:
///
/// ```compile_fail
/// # use enid::{enid, Enid};
/// const ENID: Enid = enid!("iisc7n75");
/// ```