- Notifications
You must be signed in to change notification settings - Fork1
A tool to debug unique identifiers (UUID, ULID, Snowflake, etc).
License
Racum/uuinfo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A tool to debug unique identifiers (UUID, ULID, Snowflake, etc).
This is a simple CLI program to parse and debug compound unique identifiers, that means, ID’s with built-in structure to achieve uniqueness, like randomness, hashed data, timestamp, node or sequence. It understands most 128 and 64-bit IDs, and some other obscure lengths, including text-only representations.
Just input some ID anduuinfo will try to infer as much information as possible from it:
If the ID formats allows for it,uuinfo also shows its bits, color-coded by type; the key of the color doubles as the values from the left column in the rendered card. The colors on your system may differ, since those are ANSI colors instead of hardcoded ones.
- UUID: versions 1 to 8, Nil, Max, NCS and Microsoft GUID.
- UUID wrappers:ShortUUD,Base64,Uuid25 and integer
- ULID
- UPID
- MongoDB ObjectId
- KSUID
- Xid
- CUID1 /CUID2
- SCRU128 /SCRU64
- Timeflake
- Flake (Boundary)
- Nano ID
- TSID
- Sqids
- Hashids
- YouTube Video ID
- Stripe ID
- Datadog Trace ID
- NUID (NATS)
- TypeID (Jetify)
- Breeze ID
- Puid
- PushID (Firebase)
- TID (AT Protocol, Bluesky)
- Thread ID (Meta Threads)
- 128-bit formats encoded as UUID: ULID, UPID, Flake, Timeflake and SCRU128
- Snowflake variants:
- Unix timestamp (seconds, ms, μs and ns)
- Hex-encoded Hash
- IPFS CID (v0 and v1)
- Network:IPv4,IPv6,MAC Address andIMEI
- ISBN (10 and 13)
- Geo:H3 Index
Uuinfo was developed inRust, thus it requiresits toolchain; if you already have it available, you can install it withcargo
:
$ cargo install uuinfo
$ docker run racum/uuinfo {ID}...
For a complete list of options, just run the help:uuinfo --help
.
If you just input an ID without any options,uuinfo will try to detect its format using very basic heuristics on its length and popularity; and this may work for most cases.
$ uuinfo 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa...
If you are not sure about the ID format, you can see the cards for all formats that it got parsed successfully with-e
/—everything
; and with that, you can see what result makes more sense.
Note: this argument disables the output options.
Sometimes an ID could be valid for more than one format, if this happens and the auto-detection above picks the wrong one, you can disambiguate using the-f
(of--force
) parameter.
For example, the ID12345678901234567890
is automatically detected as aSnowflake, but, it could also be a validXid. If you want to forceuuinfo to parse it as Xid, call it like this:
$ uuinfo -f xid 12345678901234567890...
Check the--help
for a complete list of values of-f
/--force
.
Snowflake isnot an “ID format”, but rather acategory of formats; since it is just a number,uuinfo can’t detect what variation was used to generate it, thus, specifying the variant with-f
/—force
is required to be able to get anything useful from it.
Fortunately,uuinfo can compare time-aware IDs and sort them by date; for example:
$ dateSun Mar 16 15:54:30 CET 2025$ uuinfo --compare 1777150623882019211Date/times of the valid IDs parsed as:- 1983-02-11T01:32:03.000Z Snowflake: Frostflake- 1983-06-06T00:02:06.595Z Snowflake: LinkedIn- 1983-06-06T00:02:06.595Z Snowflake: Flake ID- 2018-05-11T21:08:05.018Z Thread ID (Meta Threads)- 2018-05-11T21:08:05.018Z Snowflake: Instagram- 2024-04-08T01:45:01.252Z Snowflake: Twitter- 2025-03-16T14:54:32.000Z --- Now ---- 2026-04-25T20:57:03.000Z Unix timestamp: Assuming nanoseconds- 2028-06-05T00:02:06.595Z Snowflake: Discord- 2028-06-05T00:02:06.595Z Snowflake: Spaceflake- 2033-06-05T00:02:06.595Z TSID- 2048-03-26T00:05:16.480Z Snowflake: Sony- 2829-04-23T02:15:02.106Z Snowflake: Mastodon
In this case, the ID1777150623882019211
is probably from Twitter, since it is the most recent value from the list that is not in the future.
Once identified the variant, just run it again enforcing its type:
$ uuinfo -f sf-twitter 1777150623882019211...
Use a dash (-
) instead of the ID to get the value from STDIN piped from another program:
$ echo 8ff95663-c8ee-48b9-a236-a2f29a991001 | uuinfo -...
This is the pretty-printed output, with all the extracted data, plus a hexadecimal and binary representation of the bits at the end:
$ uuinfo 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa┏━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃ ID Type │ UUID (RFC-9562) ┃┃ Version │ 7 (sortable timestamp and random) ┃┠───────────┼─────────────────────────────────────────────┨┃ String │ 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa ┃┃ Integer │ 2098319972277167143349324748782480042 ┃┃ ShortUUID │ 2J2YViS7khb9taUUPULmrj ┃┃ Base64 │ KR-UAQB8qnqqqqqqqqqqqg== ┃┠───────────┼─────────────────────────────────────────────┨┃ Size │ 128 bits ┃┃ Entropy │ 74 bits ┃┃ Timestamp │ 1735689600.000 (2025-01-01T00:00:00.000Z) ┃┃ Node 1 │ - ┃┃ Node 2 │ - ┃┃ Sequence │ - ┃┠───────────┼─────────────────────────────────────────────┨┃ 0194 1f29 │ 0000 0001 1001 0100 0001 1111 0010 1001 ┃┃ 7c00 7aaa │ 0111 1100 0000 0000 0111 1010 1010 1010 ┃┃ aaaa aaaa │ 1010 1010 1010 1010 1010 1010 1010 1010 ┃┃ aaaa aaaa │ 1010 1010 1010 1010 1010 1010 1010 1010 ┃┗━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
This is just the 2 first lines of the card in one, with the ID type and version:
$ uuinfo -o short 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaaID Type: UUID (RFC-9562), version: 7 (sortable timestamp and random).
In case you need to integrateuuinfo with some other commands, there is a JSON output available:
$ uuinfo -o json 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa | jq{ "id_type": "UUID (RFC-9562)", "version": "7 (sortable timestamp and random)", "standard": "01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa", "integer": 2098319972277167143349324748782480042, "short_uuid": "2J2YViS7khb9taUUPULmrj", "base64": "KR-UAQB8qnqqqqqqqqqqqg==", "uuid_wrap": null, "size": 128, "entropy": 74, "datetime": "2025-01-01T00:00:00.000Z", "timestamp": "1735689600.000", "sequence": null, "node1": null, "node2": null, "hex": "01941f297c007aaaaaaaaaaaaaaaaaaa"}
You can also return just the raw binary representation of the ID, but, be careful, this can mess up your terminal:
$ uuinfo -o binary 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa�)|z���������%
I recommend to pipe into a command that can handle binary, likexxd
:
$ uuinfo -o binary 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa | xxd00000000: 0194 1f29 7c00 7aaa aaaa aaaa aaaa aaaa ...)|.z.........
You can even see the same bits from the card withxxd -b
:
$ uuinfo -o binary 01941f29-7c00-7aaa-aaaa-aaaaaaaaaaaa | xxd -b00000000: 00000001 10010100 00011111 00101001 01111100 00000000 ...)|.00000006: 01111010 10101010 10101010 10101010 10101010 10101010 z.....0000000c: 10101010 10101010 10101010 10101010 ....
Hunting for ID formats is a rabbit-hole! I published the first version ofuuinfo with the formats I found on my research. If you want to add more formats, please create aGitHub issue containing the following:
- Reference link
- Size in bits and the map of bits
- ID examples (more than one if possible) with its encoded data (timestamp, node, sequence, etc)
- Alphabet (if applicable)
- Epoch (if custom)
- Source-code (if available)
The more information I get, the easier will be for me to implement it!
Just create a PR, but try to follow some basic guidelines:
- Look at the current structure and try to emulate it.
- One format per file, unless they are related.
- Run
cargo fmt
andCargo clippy
before committing.
Uuinfo is under the 3-Clause BSD License.
About
A tool to debug unique identifiers (UUID, ULID, Snowflake, etc).