Crates.io | base62-uuid |
lib.rs | base62-uuid |
version | 2.1.0 |
source | src |
created_at | 2022-04-09 13:02:10.118357 |
updated_at | 2024-10-24 19:52:06.873224 |
description | Minimalist crate to generate Base62 UUIDs |
homepage | |
repository | https://github.com/qtfkwk/base62-uuid |
max_upload_size | |
id | 564759 |
size | 18,832 |
Minimalist crate to generate Base62 UUIDs
GitHub Crates.io Lib.rs Docs.rs
$ base62-uuid -h
Base62 UUID
Usage: base62-uuid [OPTIONS]
Options:
-c, --count <COUNT> Number of Base62 UUIDs to generate [default: 1]
-d, --decode Decode Base62 UUIDs from STDIN to standard UUIDs
-e, --encode Encode standard UUIDs from STDIN to Base62 UUIDs
-p, --pad Pad UUIDs with leading zeroes
-u Generate/encode/decode u128 UUIDs instead of Base62 UUIDs
-h, --help Print help
-V, --version Print version
$ base62-uuid -V
base62-uuid 2.1.0
$ base62-uuid
tTO7UXTILC2AxQKVfhYzY
$ base62-uuid -c 5 |tee temp
93a4HCalhVgXvozMQRDr8
25C7tS3B328zS834bz8uKV
6oTb2BzS78IkwZ5KoIFICl
qiqFIXOgI1kH1By16pEQ8
6iTib0KGX7T2Ufzy96sr09
$ base62-uuid -d <temp |tee temp-decoded
04ccd736-750d-4267-9227-c775e4ff045a
447794f9-3c0b-4eef-adc3-458d0dd7f447
dfe43ed0-bb89-44c0-b014-30344d7ada47
1bf0cf03-bd86-40da-9011-f0e64645fcb4
dcb68298-8985-42ed-b569-6b308a943ced
$ base62-uuid -e <temp-decoded
93a4HCalhVgXvozMQRDr8
25C7tS3B328zS834bz8uKV
6oTb2BzS78IkwZ5KoIFICl
qiqFIXOgI1kH1By16pEQ8
6iTib0KGX7T2Ufzy96sr09
$ base62-uuid -u
334097669669744452419346251695304589440
$ base62-uuid -uc 5
102389129306729026457559545738165059053
123439036126540706879880865806094135301
47167294684750739628554038748303803555
109767566098941365192457432125994458840
96887169780596865642054468111915816866
$ base62-uuid -puc 5
128261614896343900523819685522305651328
263761526135930347639857319273958851714
303028256450039093740502152749362106721
190922064000881212597367172505050002457
148939742810114933100997314791914918665
use base62_uuid::{base62_uuid, decode, encode};
let id = base62_uuid();
let id_decoded = decode(&id);
let id_encoded = encode(&id_decoded);
assert_eq!(id_encoded, id);
See also the API documentation.