Handbook
Glossary
bytes>ulid ( byte-array -- ulid )
Universally Unique Lexicographically Sortable Identifier
Prev:
ulid>bytes ( ulid -- byte-array )
Next:
normalize-ulid ( str -- str' )
Vocabulary
ulid
Inputs
byte-array
a
byte-array
Outputs
ulid
a
string
Word description
Convert a binary ULID to its string representation using the Crockford's base32
encoding
. The
byte-array
must be exactly 16 bytes long, the resulting
ulid
string is always 26 characters long.
Errors
bytes>ulid-bad-length
( n -- * )
Definition
USING:
endian
kernel
sequences
ulid.private
;
IN:
ulid
:
bytes>ulid
( byte-array -- ulid )
dup
length
dup
16
=
[
drop
]
[
bytes>ulid-bad-length
]
if
be>
26
encode-bits
;