Specification · Draft v1.0 · 2026-08-17

UUID256

A 256-bit (32-byte), purely random unique identifier, formatted 16-8-8-8-24 — the standard UUID's 8-4-4-4-12 with every group doubled.

128-bit UUIDf47ac10b-58cc-4372-a567-0e02b2c3d479
UUID2560001020304050607-08090a0b-4c0d0e0f-90111213-1415161718191a1b1c1d1e1f
256 bits / 32 bytes 250 random bits CSPRNG only, stateless no timestamp or machine id binary ≡ text ≡ numeric order birthday bound ≈ 2¹²⁵ ids 39 reference implementations

Introduction

The 256-bit analogue of UUIDv4 — same idea, twice the random bits, same visual shape.

UUID256 is a fixed-size, globally unique, purely random identifier meant for use as a primary or unique key in databases, message systems, and APIs. It carries 250 bits of cryptographically random data (versus 122 for UUIDv4), so collisions are unreachable in practice at any generation rate, with no coordination, clocks, or node identifiers required. Nothing about when, where, or how fast an id was generated can be recovered from it — there is nothing embedded to leak.

The text format is deliberately kin to the standard UUID: every field of 8-4-4-4-12 is doubled to 16-8-8-8-24, so the version digit still opens the third group and the variant digit still opens the fourth — exactly where a UUID reader already expects them — while the extra length makes it impossible to mistake for a real 128-bit UUID.

Generation

32 bytes from the OS CSPRNG, then two bytes are touched to stamp version (4) and variant (10). Nothing else changes.

Stateless

No clock, counter, or machine identity. Any number of generators — threads, processes, machines — run forever without coordinating.

Ordering

Numeric order of the 256-bit value, byte order of the encoding, and code-point order of the canonical text are identical — but carry no meaning, since the value is uniform random.

Parsing

Accepts the 68-char hyphenated canonical form or the 64-char compact form, any letter case; strict mode also checks version/variant.

Storage

BYTEA / BINARY(32) / BLOB preferred; CHAR(68) where text is required.

Specification

The normative spec lives in README.md — text format, binary layout, generation, parsing, storage, and test vectors.

Reference implementations

All 39 implement the same API — generate, to_canonical, parse (strict/lenient), is_strict — and self-check against the spec's test vectors on start-up. Sources live flat in reference/; only sources are kept there. Build/run commands assume you're inside that directory.

Native & systems

C uuid256.c cc -O3 -pthread -o uuid256 uuid256.c && ./uuid256
C++ uuid256.cpp c++ -std=c++20 -O3 -o uuid256-cpp uuid256.cpp
Rust uuid256.rs rustc --edition 2021 -O -o uuid256-rs uuid256.rs
Zig uuid256.zig zig run -OReleaseFast uuid256.zig
Go uuid256.go go run uuid256.go
Swift uuid256.swift swift uuid256.swift -g

JVM

Java uuid256.java java uuid256.java
Kotlin uuid256.kt kotlinc uuid256.kt -include-runtime -d uuid256.jar
Scala uuid256.scala scala run uuid256.scala -- -g
Clojure uuid256.clj clojure -M uuid256.clj

.NET

C# uuid256.cs dotnet run uuid256.cs
F# uuid256.fsx dotnet fsi --optimize+ uuid256.fsx

Web & app

JavaScript uuid256.js node uuid256.js
TypeScript uuid256.ts node uuid256.ts
WebAssembly uuid256.wat + uuid256-wasm-host.js node uuid256-wasm-host.js hand-written WAT; Node host supplies CSPRNG bytes + I/O only
Dart uuid256.dart dart run uuid256.dart

Scripting

Python uuid256.py python3 uuid256.py
Ruby uuid256.rb ruby uuid256.rb
Perl uuid256.pl perl uuid256.pl
PHP uuid256.php php uuid256.php
Lua uuid256.lua lua uuid256.lua
Bash uuid256.sh ./uuid256.sh
PowerShell uuid256.ps1 pwsh uuid256.ps1

Data & numeric

R uuid256.R Rscript uuid256.R
Julia uuid256.jl julia uuid256.jl
Fortran uuid256.f90 gfortran -O2 -o uuid256-f90 uuid256.f90

Functional

Haskell uuid256.hs ghc -O2 -o uuid256-hs uuid256.hs
OCaml uuid256.ml ocaml uuid256.ml -g
Elixir uuid256.exs elixir uuid256.exs

Legacy

COBOL uuid256.cob cobc -x -O2 -o uuid256-cob uuid256.cob

Database

SQLite uuid256.sqlite.sql sqlite3 :memory: < uuid256.sqlite.sql
PostgreSQL uuid256.postgres.sql psql -f uuid256.postgres.sql
MySQL uuid256.mysql.sql mysql -N -B db < uuid256.mysql.sql
SQL Server uuid256.mssql.sql sqlcmd -b -S localhost -d tempdb -i uuid256.mssql.sql

Assembly & hardware

AArch64 uuid256.aarch64.s cc -o uuid256-asm uuid256.aarch64.s runs natively on Apple silicon
x86-64 uuid256.x86_64.S cc -arch x86_64 -o uuid256-x64 uuid256.x86_64.S macOS via Rosetta 2, or native on Linux
i386 uuid256.i386.s python3 emulate.py uuid256-i386 5 no native macOS target — run under emulate.py (Unicorn)
RISC-V 64 uuid256.riscv64.s python3 emulate.py uuid256-rv64 5 same emulate.py harness
Verilog uuid256.v + _tb.v iverilog -o uuid256.vvp uuid256.v uuid256_tb.v && vvp uuid256.vvp +selftest