You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #36074 [Uid] add AbstractUid and interop with base-58/32/RFC4122 encodings (nicolas-grekas)
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Uid] add AbstractUid and interop with base-58/32/RFC4122 encodings
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR provides a base `AbstractUid` class that is shared by `Uuid` and `Ulid`.
It adds new methods that provide interoperability between all types of UIDs but also between different encodings of UIDs:
- `toBase58()` using the [bitcoin alphabet](https://en.wikipedia.org/wiki/Base58) - that's 22 chars aka "short-ids" - case sensitive
- `toBase32()` using [Crockford's alphabet](https://www.crockford.com/base32.html) - 26 chars ids - case insensitive
- `toRfc4122()` to represent as a UUID-formatted string - 36 chars
This adds to `toBinary()` and to `fromString()`, the latter being able to cope with any of the 4 representations to create any kind of UIDs.
Commits
-------
d8479ad [Uid] add AbstractUid and interop with base-58/32/RFC4122 encodings
0 commit comments