All Projects → rafaelsales → Ulid

rafaelsales / Ulid

Licence: mit
Universally Unique Lexicographically Sortable Identifier implementation for Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Ulid

Symfony Demo App
A Symfony demo application with basic user management
Stars: ✭ 122 (-51.78%)
Mutual labels:  uuid
Icicle
A distributed, k-sortable unique ID generation system using Redis and Lua.
Stars: ✭ 159 (-37.15%)
Mutual labels:  uuid
Uuid
Erlang Native UUID Generation
Stars: ✭ 188 (-25.69%)
Mutual labels:  uuid
Electrode Csrf Jwt
Stateless Cross-Site Request Forgery (CSRF) protection with JWT
Stars: ✭ 127 (-49.8%)
Mutual labels:  uuid
Uuid
Kotlin Multiplatform UUID
Stars: ✭ 146 (-42.29%)
Mutual labels:  uuid
Uid Promise
Creates a cryptographically strong UID
Stars: ✭ 179 (-29.25%)
Mutual labels:  uuid
Snowflake
java edition of [Twitter Snowflake](https://github.com/twitter/snowflake), a network service for generating unique ID numbers at high scale with some simple guarantees.
Stars: ✭ 114 (-54.94%)
Mutual labels:  uuid
Ksuid
K-Sortable Globally Unique IDs
Stars: ✭ 3,202 (+1165.61%)
Mutual labels:  uuid
Zkudid
Generate and save permanent UDID with IDFV and keychain in iOS device.
Stars: ✭ 159 (-37.15%)
Mutual labels:  uuid
Nanoid
A tiny, secure, URL-friendly, unique string ID generator for Rust
Stars: ✭ 188 (-25.69%)
Mutual labels:  uuid
Flake
Decentralized, k-ordered unique IDs in Clojure
Stars: ✭ 132 (-47.83%)
Mutual labels:  uuid
Uuid
A PHP library for generating universally unique identifiers (UUIDs).
Stars: ✭ 11,475 (+4435.57%)
Mutual labels:  uuid
Id Generator
生成带校验码的卡号、19位的Long ID、不大于22位的短UUID、短卡号、激活码、数字加密、付款码。分布式、基于内存、安全可靠、性能高。
Stars: ✭ 180 (-28.85%)
Mutual labels:  uuid
Javascript
Universally Unique Lexicographically Sortable Identifier
Stars: ✭ 1,781 (+603.95%)
Mutual labels:  uuid
Python Wechat Itchat
微信机器人,基于Python itchat接口功能实例展示:01-itchat获取微信好友或者微信群分享文章、02-itchat获取微信公众号文章、03-itchat监听微信公众号发送的文章、04 itchat监听微信群或好友撤回的消息、05 itchat获得微信好友信息以及表图对比、06 python打印出微信被删除好友、07 itchat自动回复好友、08 itchat微信好友个性签名词云图、09 itchat微信好友性别比例、10 微信群或微信好友撤回消息拦截、11 itchat微信群或好友之间转发消息
Stars: ✭ 216 (-14.62%)
Mutual labels:  uuid
User Bundle
A new Symfony user bundle
Stars: ✭ 116 (-54.15%)
Mutual labels:  uuid
Lua Resty Jit Uuid
Fast and dependency-free UUID library for LuaJIT/ngx_lua
Stars: ✭ 169 (-33.2%)
Mutual labels:  uuid
Uuid
Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
Stars: ✭ 3,237 (+1179.45%)
Mutual labels:  uuid
Ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Python 3
Stars: ✭ 216 (-14.62%)
Mutual labels:  uuid
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (-28.06%)
Mutual labels:  uuid

Ruby Gem Downloads GitHub License

ulid

Universally Unique Lexicographically Sortable Identifier implementation for Ruby

Official specification page: https://github.com/ulid/spec



ulid


Universally Unique Lexicographically Sortable Identifier

UUID can be suboptimal for many uses-cases because:

  • It isn't the most character efficient way of encoding 128 bits of randomness
  • The string format itself is apparently based on the original MAC & time version (UUIDv1 from Wikipedia)
  • It provides no other information than randomness

Instead, herein is proposed ULID:

  • 128-bit compatibility with UUID
  • 1.21e+24 unique ULIDs per millisecond
  • Lexicographically sortable!
  • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
  • Uses Crockford's base32 for better efficiency and readability (5 bits per character)
  • Case insensitive
  • No special characters (URL safe)

Installation

gem install ulid

Usage

require 'ulid'

ULID.generate # 01ARZ3NDEKTSV4RRFFQ69G5FAV

Specification

Below is the current specification of ULID as implemented in this repository. Note: the binary format has not been implemented.

 01AN4Z07BY      79KA1307SR9X4MV3

|----------|    |----------------|
 Timestamp          Randomness
  10 chars           16 chars
   48bits             80bits
   base32             base32

Components

Timestamp

  • 48 bit integer
  • UNIX-time in milliseconds
  • Won't run out of space till the year 10895 AD.

Randomness

  • 80 bits
  • Cryptographically secure source of randomness, if possible

Sorting

The left-most character must be sorted first, and the right-most character sorted last. The default ASCII order is used for sorting.

Binary Layout and Byte Order

The components are encoded as 16 octets. Each component is encoded with the Most Significant Byte first (network byte order).

0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      32_bit_uint_time_high                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     16_bit_uint_time_low      |       16_bit_uint_random      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       32_bit_uint_random                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       32_bit_uint_random                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

String Representation

ttttttttttrrrrrrrrrrrrrrrr

where
t is Timestamp
r is Randomness

Test Suite

bundle exec rake test

Credits and references:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].