Skip to content

ULID is not strictly compatible with UUID #103

Description

@johnperry-math

Suppose I generate a ULID, then convert it to a UUID.

Question

With which version of UUID is the result compatible?

Answer

Possibly none! Every UUID requires a variant and a version. This is also true of the original OSF DCE specification (page 586 gives the format, indicating version and variant).

A correctly-generated ULID will have random values in those fields. Thus, converting a ULID can result in a UUID that thinks its version number is anything from 0 to 15.

Why is this a problem?

I prefer to use ULID's internally, but to interact with other systems I need to generate UUID's that satisfies the requirements of a certain version. That means I'm basically out of luck, unless I want to bit-meddle. ...which I can do for the time being, but it seems like a suboptimal solution.

Proposals

  1. Add a caveat to the ULID spec that indicates this is a potential problem.
  2. Add a method that generates ULIDs compatible with a given UUID version. This probably shouldn't be allowed for UUIDs that have specific requirements.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions