Uuider
Tool for generating and manipulating UUIDs
Install / Use
/learn @coproduto/UuiderREADME
uuider
A command-line tool for generating UUIDs (v4 and v7) with fine-grained control over their components.
Features
- Generate random UUIDv4 and UUIDv7
- Create deterministic UUIDs from hex constants
- Control UUIDv7 timestamps precisely
- Set random portions to min/max values for range queries
Installation
From Source
Requires Rust 1.85 or later.
# Clone the repository
git clone https://github.com/yourusername/uuider.git
cd uuider
# Install globally
cargo install --path .
The binary will be installed to ~/.cargo/bin/uuider. Make sure this directory is in your PATH.
Usage
UUIDv4
Generate a random UUIDv4:
uuider v4
# Output: 550e8400-e29b-41d4-a716-446655440000
Generate a UUIDv4 from a hex constant (up to 122 bits):
uuider v4 --from-hex 1
# Output: 00000000-0000-4000-8000-000000000001
uuider v4 --from-hex 0xdeadbeef
# Output: 00000000-0000-4000-8000-0000deadbeef
UUIDv7
Generate a UUIDv7 with the current timestamp:
uuider v7
# Output: 019c6287-bdcc-7a3f-8b2d-4e5f6a7b8c9d
Generate a UUIDv7 with a specific timestamp (milliseconds since Unix epoch):
uuider v7 --time 1700000000000
# Output: 018b8f5a-8c00-7a3f-8b2d-4e5f6a7b8c9d
Generate a UUIDv7 with minimum random bits (useful for range query lower bounds):
uuider v7 --min
# Output: 019c6287-bdcc-7000-8000-000000000000
uuider v7 --time 0 --min
# Output: 00000000-0000-7000-8000-000000000000
Generate a UUIDv7 with maximum random bits (useful for range query upper bounds):
uuider v7 --max
# Output: 019c6287-bdcc-7fff-bfff-ffffffffffff
uuider v7 --time 0 --max
# Output: 00000000-0000-7fff-bfff-ffffffffffff
Generate a UUIDv7 with a specific hex constant for the random portion (up to 74 bits):
uuider v7 --from-hex abc123
# Output: 019c6287-bdcc-7000-8000-000000abc123
Options Reference
uuider v4
| Option | Description |
|--------|-------------|
| --from-hex <HEX> | Use a hex constant (up to 122 bits) instead of random data |
uuider v7
| Option | Description |
|--------|-------------|
| --time <MILLIS> | Unix timestamp in milliseconds (defaults to current time) |
| --from-hex <HEX> | Use a hex constant (up to 74 bits) for the random portion |
| --min | Set all random bits to 0 |
| --max | Set all random bits to 1 |
Note: --from-hex, --min, and --max are mutually exclusive.
UUID Structure
UUIDv4 (RFC 4122)
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
│ │
│ └── Variant (2 bits): 10
└─────── Version (4 bits): 0100
- 122 bits of random/constant data
- 4-bit version field (always
4) - 2-bit variant field (always
10)
UUIDv7 (RFC 9562)
tttttttt-tttt-7xxx-yxxx-xxxxxxxxxxxx
│ │ │
│ │ └── Variant (2 bits): 10
│ └─────── Version (4 bits): 0111
└──────────────────── Timestamp (48 bits)
- 48-bit Unix timestamp in milliseconds
- 4-bit version field (always
7) - 12-bit random field (rand_a)
- 2-bit variant field (always
10) - 62-bit random field (rand_b)
License
MIT
