Ulid compare
ulid-compare · version 1.0.0 · Identifiers & check digits · free, no key needed
Compare two canonical uppercase ULIDs by their specification-defined lexical order.
Use when you need to: compare canonical ULIDs · sort two ULID values · determine ULID lexical order.
Decide before calling
Read the versioned contract and the supported scope below. Reuse ulid-compare@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use ulid-compare@1.0.0 for compare canonical ULIDs. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- compare canonical ULIDs
- sort two ULID values
- determine ULID lexical order
- order ULIDs chronologically
- compare ULID strings strictly
- rank two canonical ULIDs
Not supported
- sort an unbounded ULID list
- normalize invalid ULIDs
Behavior
- Canonical ULID text is exactly 26 uppercase ASCII Crockford Base32 characters; I, L, O, U, lowercase, whitespace, and first characters 8 through Z are rejected.
- The 48-bit timestamp is represented as a canonical unsigned decimal string, avoiding JSON number precision loss.
- Inputs are never trimmed or normalized; operations are synchronous, pure, offline, bounded, and deterministic.
Input
left(string, required): min length 26; max length 26; pattern^[0-7][0-9A-HJKMNP-TV-Z]{25}$right(string, required): min length 26; max length 26; pattern^[0-7][0-9A-HJKMNP-TV-Z]{25}$
Output
order(integer, required): min -1; max 1
Limits
- max ulid bytes: 26
- max ulids: 2
Example
Request input:
{
"left": "00000000000000000000000000",
"right": "00000000000000000000000001"
}
Response:
{
"result": {
"order": -1
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "ulid-compare",
"version": "1.0.0",
"input": {
"left": "00000000000000000000000000",
"right": "00000000000000000000000001"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/ulid-compare/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"left":"00000000000000000000000000","right":"00000000000000000000000001"}'
The machine-readable contract is at /v1/tools/ulid-compare/versions/1.0.0.
CLI
node cli.mjs run ulid-compare 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Ulid parse canonical: Parse a canonical uppercase ULID into its exact timestamp, randomness, and 16 bytes.
- Ulid timestamp extract: Extract the exact unsigned 48-bit millisecond timestamp from a canonical uppercase ULID.
- Iban compute from bban: Compute the MOD 97-10 check digits and full IBAN for a country code and BBAN, using the pinned IBAN registry.
- Rf creditor reference compute: Compute the MOD 97-10 check digits and full ISO 11649 RF Creditor Reference for a base reference (invoice number).
- Ulid format: Format an explicit 48-bit timestamp and ten random bytes as one canonical uppercase ULID.
- Uuid inspect: Validate a canonical UUID and report its lowercase value, variant, version, and nil status.