A self-describing binary format for any kind of data. For images, it adds a colour model that says what each one claims.
Every value carries its type. Every file carries its hash. Every number is as wide as it needs to be and no wider. Every colour entry says whether it was measured or assumed, and by whom. Having all of it in one open format, checked by default, is the point.
Readable by people and by AI. Every value carries its type and size, and every section its name, so a file can be printed exactly as it is stored, with no schema and without the program that wrote it. vsfinfo shows each value in VSF's own notation, type and size first (z3⦉9⦊ version, l5⦉96002205⦊ File length), each section by name, offset and size, and whether the hashes verify. A person can read that, and so can a language model, which can then explain or check a file it has never seen.
Crate vsf 0.10.1, format v10, reads v9. GitHub | docs.rs | crates.io
Every colour transform in a VSF file carries a class, saying what it claims: Absolute (the light, as it was), Relative (the object, with the illuminant divided out), Creative (a deliberate look) or Technical (no claim about the scene). It also carries a tier, saying who measured it: this unit, the model, or a convention. A camera JPEG is Creative, because white balance alone decides it.
A camera's spectral response can travel with the file, so the transform can be rebuilt for any light and any observer. Conversions between sRGB, Display P3, Adobe RGB, Rec.2020, ACES and the camera log spaces are colorimetric, with no hidden white balance. The full model, and how it relates to DNG, ICC and ACES, is in idt/README.md.
Every integer on the wire is a type letter, one marker byte, then the bytes, big-endian:
Value 42: 'u' '3' 0x2A 8 bits
Value 4,096: 'u' '4' 0x10 0x00 16 bits
Value 2^32 - 1: 'u' '5' + 4 bytes 32 bits
Value 2^64 - 1: 'u' '6' + 8 bytes 64 bits
Value 2^128 - 1: 'u' '7' + 16 bytes 128 bits
The marker is a base36 digit. 0 to 9 are 0 to 9, A to Z are 10 to 35. A marker of value N means 2N bits follow. So u0 is a bool, u3 a byte, u6 a u64, uA 1024 bits, and uZ 235 bits, which is 4 GiB and more than any single integer will need.
Width markers before an integer have a long history, from ASN.1 BER (1988) to CBOR. VSF makes the marker the exponent directly, holds every width to a power of two, requires the minimal form, and uses the same scheme for every length, offset and count in the file, so nothing in the format has a size limit the data did not bring.
Every value is ⦉letter(s)⦊⦉size⦊⦉data⦊. The second byte says which of three things you are looking at, and the ranges never overlap:
| Second byte | ASCII | Meaning |
|---|---|---|
0 to 9 | 0x30 to 0x39 | size exponent, base36 low |
A to Z | 0x41 to 0x5A | size exponent, base36 high |
a to z | 0x61 to 0x7A | named family member |
| Prefix | Family |
|---|---|
u i f j | unsigned, signed, IEEE float, complex, sized by marker |
s c | Spirix scalar and circle, 25 each, F3 to F7 × E3 to E7 |
t_ q_ | tensor, contiguous and strided, one per element type |
p | bit-packed tensor, 1 to 128 bits per element |
h g k m | hash, signature, key, MAC, each carrying its algorithm |
n | network: address, host, IPv4, IPv6, CIDR, MAC, port, socket, URL, DNS name |
r | colour and raster; ro* drawable objects |
d o l | dictionary key, offset, length: the container's own structure |
a x | ASCII text, Huffman Unicode |
e w | Eagle Time, WorldCoord |
op | opcode |
318 variants today. The enum is the format: add a variant and the encoder, decoder and vsfinfo will not compile until they handle it. The code is Rust, with the usual Rust guarantees and no others; a parser still has to bound what it allocates against what it was handed, and a bug report is the right response to one that does not.
A 14-bit sensor stores 14 bits, not 16. A 4-bit quantised model stores 4. Phred scores store 6. Any rows or tile unpack straight from the bytes without copying the rest.
A hash, signature, key or MAC carries its algorithm in the type, so a SHA-256 hash cannot be handed to code expecting BLAKE3. Implemented today: BLAKE3 hashing (always on), Ed25519 verify in no_std, Ed25519 signing, X25519, ChaCha20-Poly1305 and AES-GCM.
Two's-complement floating point. One zero. One infinity, for actual singularities. Values too small or too large to represent keep their sign. a × b = 0 exactly when a = 0 or b = 0. Undefined results record why they are undefined.
A Dymaxion-projected Earth coordinate, 2.14 mm average and 5.06 mm worst case in 64 bits. Eagle Time is physics-bounded consensus time, optional in the header: a clockless device omits it rather than writing a placeholder.
Every file built by VsfBuilder carries a BLAKE3 hash of the whole file in its header. There is no opt-out. verification::read_verified checks it before handing anything back, on a desktop or in an nRF52840 bootloader.
sign_section signs the document as built, and the per-section content hashes keep each section provable on its own.BLAKE3 hashes at several GB/s per core, so on most storage the hash adds little to the time spent reading or writing the file.
[dependencies]
vsf = "0.10"
use vsf::{VsfType, BitPackedTensor, Tensor};
use vsf::crypto_algorithms::HASH_BLAKE3;
// 12-bit camera RAW, packed at 12 bits
let raw = BitPackedTensor::pack(12, vec![4096, 3072], &pixel_data);
let encoded = VsfType::p(raw).flatten();
// 8-bit greyscale as a tensor
let img = VsfType::t_u3(Tensor::new(vec![1920, 1080], grey));
// Text, Huffman compressed (needs the `text-encode` feature)
let doc = VsfType::x("Kia ora".to_string());
// A hash that knows its algorithm
let hash = VsfType::h(HASH_BLAKE3, hash_bytes);
// Round trip
let decoded = VsfType::parse(&encoded)?;
assert_eq!(original, decoded);
Embedded builds use default-features = false; everything that needs an allocator or atomics is behind a feature. Three binaries ship with the crate: vsfinfo (a 1:1 literal dump of any file), vsflog (read a structured log) and vsfimg (any PNG, JPEG, WebP or TIFF to a canonical VSF image).
From 0.8.0 the crate minor is the format version: vsf 0.10.x writes v10 files. Any breaking change, wire or API, bumps both. The backward-compatibility floor lives in every file header and is enforced by the reader by name, never by misparsing. A release that wrote wrong bytes is yanked; a release that misread valid files but never wrote a bad byte is superseded and left in history. A frozen-wire test pins the exact bytes of the text and key types so a wire break can never ship silently.
VSF is the encoding the rest of it serialises thru: Spirix (arithmetic), TOKEN (identity), Eagle Time (time), Dymaxion (location), ihi, tohu, manifestus and Photon.
Three things, three licenses:
Nobody is asked for money, attribution beyond what MPL requires, or permission. Sell what you build with it. The format itself stays free, for everyone, forever, and the licenses are the mechanism, not a request.
01010010 11000011 10000101
One value, one byte form.