26 字符 Crockford-base32,可按毫秒时间戳字典序排序。本地生成,绝不传输。
功能说明
生成
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
:26 个字符的标识符,把毫秒级时间戳与 80 位随机数配对。工具在加载的瞬间就会自动填充结果,并且每次更改选项都会重新生成,因此屏幕上始终有结果可用。**数量(Count)**可设置为 1 到 1,000。单个值以大号字体显示;批量则以列表呈现。**复制(Copy)**会取走整批结果。一切都在本地通过crypto.getRandomValues 运行。
使用方法
- 设置数量(Count)(1 到 1,000)。更改时结果会随之重新生成。
- 读取结果:一个值以大号字体显示,两个或更多则以列表呈现。
- 按下**复制(Copy)**取走整批结果。
- 把任意
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
粘贴到**解码 ULID(Decode a ULID)**中进行检查:工具会把时间部分与随机部分拆开,并以毫秒和 ISO-8601 UTC 显示时间戳。无效输入(长度错误、非 Crockford 字符、或时间部分超出 48 位上限)会显示确切的原因。
示例
一个
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
有 26 个字符。这个拆分正是它的核心价值:01ARZ3NDEKTSV4RRFFQ69G5FAV
└──┬──┘└───────┬────────┘
timestamp randomness
(10 chars) (16 chars)
01ARZ3NDEKTSV4RRFFQ69G5FAV— 规范中的标准示例01ARZ3NDEK...排在01ARZ3NDF...之前,因为 10 个字符的时间戳引领整个字符串- 把
01ARZ3NDEKTSV4RRFFQ69G5FAV粘贴进解码器会读出时间戳2016-07-30T23:54:10.259Z— 规范的这个标准示例铸造于 2016-07-30
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
的工作原理一个
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
是 128 位,切成两半:| 部分 | 位数 | 字符数 | 承载内容 |
|---|---|---|---|
| 时间戳 | 48 | 前 10 | 自 Unix 纪元以来的毫秒数 |
| 随机数 | 80 | 后 16 | 随机位 |
两半都用 Crockford base32 编码:32 个符号,每字符 5 位。字母表是 0-9 加上 A-Z 去掉 I、L、O、U。这让
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
大小写不敏感,并去掉了人们容易看错的字母(把I 看成 1、把 O 看成 0)。26 字符乘以 5 位是 130,所以最高的 2 位闲置不用。
时间戳才是你选择它的理由。 它占据值的最高有效端,因此字符串顺序等于创建顺序:把一列
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
当作纯文本排序,就能免费得到插入顺序。与 UUIDv4 对比:| 属性 | ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read. |
UUIDv4 |
|---|---|---|
| 字符数 | 26 | 36(含 4 个连字符) |
| 按创建时间排序 | 是,字典序 | 否 — 完全随机的顺序 |
| 随机位数 | 80 | 122 |
当标识符只需要唯一时,UUIDv4 就够用。当它们还需要排序时 — 数据库键、事件日志、任何需要分页浏览的东西 — 时间戳前缀能把索引扫描变成范围读取。48 位毫秒时钟可以用到 10889 年,因此在实践中不会溢出。
同一毫秒、不同 ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
补充说明
- 可排序,非有序。
ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read.
按毫秒排序;同一毫秒内的两个 ID 没有保证的先后顺序。 - 大小写不敏感。
01arz3ndektsv4rrffq69g5fav与大写形式解析为同一个值。 - 私密: 在你的浏览器中本地生成。不向任何地方发送数据。
- 相关工具:
UUIDUUIDA 128-bit identifier generated to be practically unique without coordination, most commonly in version-4 (fully random) form.
Generator、Token Generator。