idgen
is a .NET Core global tool that supports the bulk generation of various types of unique identifiers:
- Versions 3 and 5 GUID/UUID: reproducible hashed namespace + name IDs
- Note: use version 5 (SHA-1) over version 3 (MD5) unless compatibility is required.
- Version 4 GUID/UUID: secure random IDs
- Hashid: Stable, short, unique, non-sequential, insecure IDs from integer array input
- Nano ID: secure random IDs of configurable size and alphabet
- Xcode Storyboard/XIB IDs
It can also encode strings for 3x4 numeric keypad/phone entry. This feature was implemented for and tested on Fidelity's antiquated phone authentication system, wherein they ask for an account password to be entered on a phone keypad.
$ dotnet tool install -g IdentifierGenerator
$ dotnet tool update -g IdentifierGenerator
Run idgen --help
after installing for detailed options.
NOTE: any argument that expects a number my be specified in decimal, binary (
0b1001
), or hex (0xabcd
andab123h
) notation. Numbers may also contain digit separators (_
and,
) and arbitrary whitespace.
$ idgen
0b0d5b33-b5e9-45cb-8f14-9bdab594cc98
$ idgen -upper
8E350BC7-FF37-4E96-A5F7-CD945C9BDC33
$ idgen -f base64
JWn2giJJhUePnVzrCAK8JQ==
$ idgen -f short
9lsQ5-h1nEy9uS3DMbLoeg
$ idgen hashid 3 100 45 11
Q0i67ixxir
$ idgen hashid 3 100 45 11 -salt bojangles -a aBcDeFgHiJkLmNoPqRsTuV -s 32
BPDNPBNqkgLJVRsVaFLBsVJRVDmaeaLm
$ seq 1 100 | idgen hashid
jR
k5
l5
...
vgm
wjR
g56
$ idgen nanoid -n 5
Fm82ZL3eyabMeVAgDGF7k
LlrnWI3YrhUbQY3zHiyYc
JUExm8eTVmLjLBjVeabZd
1bNIDlndN6W~chHMDq2y9
izaokjb4E9ft6~rAgINEy
$ idgen nanoid -s 32 -alphabet abcdefghijklmnopqrstuvwxyz
aqmtbhpgomnpvudpmtesoooakyrrdrap
$ idgen v5 bojangles
11de2b26-984e-56b4-aa25-b3bd28ea5ac2
$ idgen v5 bojangles 11de2b26-984e-56b4-aa25-b3bd28ea5ac2
de9425a4-e8dd-510b-8e00-b6ac890c733a
$ idgen v5 - < /usr/share/dict/words
e54b4418-5a27-5bdb-a1e8-24a89e2a8634
$ idgen xcode
KoW-8m-wjo
Encode a string suitable for 3x4 numeric keypad/phone entry
$ idgen phone "hello world"
43556*96753#
For GUID/UUIDs, a number of representation formats are supported via the -f
or -format
-format |
Description |
---|---|
Base64 |
The binary representation of the GUID encoded in base 64. This format ignores the -upper option if specified. |
Short |
Like Base64, but with padding (== ) stripped, / changed to _ , and + changed to - . |
N |
32 digits:00000000000000000000000000000000 |
D |
32 digits separated by hyphens:00000000-0000-0000-0000-000000000000 |
B |
32 digits separated by hyphens, enclosed in braces:{00000000-0000-0000-0000-000000000000} |
P |
32 digits separated by hyphens, enclosed in parentheses:(00000000-0000-0000-0000-000000000000) |
X |
Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces:{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} |