white paperdraft 0.4

openxor white paper

Draft 0.4 · 29 November 2026 · Jamieson O'Reilly

Status. This is a design draft for review. openxor is being built to this specification in its GitHub repository. At Draft 0.4, the one-time MAC, the message format, the vault, hardware randomness, the health tests and the commands generate, open, send, receive, status, forget, scramble, unscramble and selftest exist, along with the interactive menu, the emergency wipe, shards made from hardware randomness, the test vectors in appendix A and the release workflow. The first release is still in progress. Nothing has been audited, and every format below may change before version 1.0. Changes are listed in the change log at the end. Where the draft makes a choice that is not settled, it says so and lists the question under Open questions.

Contents

1. Summary

openxor is a command-line toolkit and Go library for information-theoretically secure cryptography. Two people share a pad: a large file of random bytes. Each message is encrypted by combining it with unused pad bytes (XOR) and authenticated with a one-time polynomial MAC keyed by further unused pad bytes. Both sides erase the pad bytes once they are used.

Because no part of a message's protection relies on a problem being hard to solve, an attacker who records the encrypted messages learns nothing from them however much computing power they have, now or later. That includes a fast algorithm following a proof that P = NP, and algorithms no one has thought of yet. This is a proof (Shannon 1949), not an assumption about attackers; it holds as long as its conditions do: the pad is truly random, every pad byte is used only once, and the pad stays secret.

The cost is key distribution. The pad must reach the other person physically, on a drive or as a file, and it is used up at one byte per byte sent. openxor makes that practical: it generates pads from hardware randomness, keeps them in locked vaults on removable drives, and handles the bookkeeping so that pad bytes are never used twice.

openxor also provides threshold secret sharing (k of n), for keeping a file safe in several places without any computational assumption.

2. Goals and non-goals

Goals

  1. Confidentiality in transit against unbounded attackers. An attacker who records every message, forever, and has unlimited computation, learns nothing about message contents beyond their rounded length.
  2. Integrity in transit against unbounded attackers. Any change to a message is detected, except with a probability that can be stated and is negligible.
  3. No pad byte is ever used twice, by either party, even after crashes, interrupted writes or messages arriving out of order.
  4. Erasure after use. Once a message has been sent and read, the pad bytes that protected it exist nowhere, so the message can never be decrypted again, even by its sender or recipient.
  5. No network code. openxor never opens a network connection. Users carry the encrypted messages over whatever channel they like.
  6. Portable. One static binary for macOS, Windows and Linux, which can run from the drive holding the vault.
  7. Storage without computational assumptions, using threshold secret sharing.

Non-goals

3. Threat model

The attacker can

The attacker cannot (assumptions)

Out of scope

Malware and compromised hardware on the endpoints, electromagnetic and acoustic side channels, coercion of a party (beyond the emergency wipe in section 8.8), and a contact who deliberately leaks messages.

4. Building blocks

4.1 One-time pad

To encrypt a message m of n bytes, openxor takes n unused pad bytes k and computes c = m XOR k. To decrypt, the recipient computes m = c XOR k with their identical copy of k.

If k is uniformly random, at least as long as m, and never used for anything else, then c is statistically independent of m: every message of length n is equally likely given c (Shannon 1949). No amount of computation changes this, because there is nothing to compute: the information is not in c.

The conditions are strict. Reusing any pad byte leaks the XOR of two plaintexts, which is how the Venona project read Soviet traffic. Pad bytes that are not truly random, such as the output of a deterministic generator, reduce the scheme to the security of that generator (section 5).

4.2 One-time authentication

Encryption alone does not stop an attacker flipping bits in c. openxor authenticates every message with a Wegman–Carter one-time MAC (Wegman and Carter 1981): a polynomial hash over the prime field p = 2^127 − 1, keyed with fresh pad bytes and never reused.

Key. 32 unused pad bytes, split into two 16-byte little-endian integers. The top bit of each is cleared, giving r and s, each in [0, 2^127). A value equal to p is reduced to 0; this changes the distribution by at most 2^−127.

Input encoding. The authenticated data A (section 7.1) is split into 15-byte blocks, the last possibly shorter. Each block b of length ℓ becomes the integer B = LE(b) + 2^(8ℓ) (the block followed by a 0x01 byte, read little-endian), so B < 2^121 < p and different inputs give different polynomials. This is the same encoding Poly1305 uses (Bernstein 2005), with 15-byte blocks to fit the smaller prime.

Tag. For blocks B1 … BL:

h   = (B1·r^L + B2·r^(L−1) + … + BL·r) mod p
tag = (h + s) mod p,  written as 16 bytes little-endian

Security. For any two distinct inputs of at most L blocks, the probability over r that their hashes collide, or differ by any fixed value, is at most L / p. An attacker who sees one tagged message and submits one forgery succeeds with probability at most L / p, about L / 2^127, whatever their computing power. A 100 MB file is about 7 million blocks, giving at most about 2^−104 per attempt. Tags are compared in constant time.

4.3 Threshold secret sharing

For storage, openxor scrambles a file into n shards so that any k rebuild it and any k − 1 reveal nothing about it (Shamir 1979). Each byte is shared independently with a random polynomial of degree k − 1 over GF(2^8), so n is at most 255. The same arithmetic is used for every k and n, including the default of two shards with both required: each shard on its own is uniformly random, as it would be with XOR against a random file. k must be at least 2, because with k = 1 every shard would be a plain copy of the file. Multiplication and inversion in GF(2^8) run in constant time, without lookup tables indexed by secret bytes. As with a pad, this holds only if the random coefficients are truly random, so openxor makes them from hardware randomness, as it makes pads (section 5). Section 10 describes the shard format.

5. Randomness

The one-time pad is only as good as its randomness. A pad made by stretching a short seed with a deterministic generator is not a one-time pad: an attacker who can solve for the seed, which a fast P = NP algorithm could do given some known plaintext, recovers the whole pad. Every operating system's standard generator (getrandom on Linux, BCryptGenRandom on Windows, SecRandomCopyBytes on macOS) works this way. So openxor makes every pad byte, and every random coefficient of a shard (section 10), from physical noise that was never computed from anything, and uses the standard generator only as a backstop.

5.1 Sources

openxor uses every source it finds.

1. Timing jitter, on every computer. Each worker repeats a fixed piece of work: a chain of dependent loads and stores across 4 MiB of memory, mixed with arithmetic. It reads a clock after each repetition. How long the same work takes varies unpredictably, with cache and memory timing, interrupts, and the processor's clock and power management. The low 8 bits of each time difference are one raw sample.

2. The processor's noise instruction, where the processor has one and the operating system says so.

3. A USB hardware random number generator, with --rng PATH: any device that appears as a device file, a serial port or a pipe (/dev/ttyACM0, /dev/cu.usbmodem…, COM3). It is read raw, with no drivers, and a serial port is first switched to raw 8-bit bytes. openxor refuses an ordinary file, which would give the same bytes every time it is read. If the device hasn't opened within 10 seconds, openxor stops before making anything and says why. On a Mac, give a serial port's /dev/cu.* name: opening it by its /dev/tty.* name waits for a signal that USB generators don't send.

5.2 How much randomness openxor counts

openxor credits each raw byte with a fixed, deliberately low min-entropy, and never extracts more than that.

SourceRaw sampleCredited min-entropyNeeded at start-up
Timing jitterlow 8 bits of one timing1/2 bit1 bit
Processor noise instructionone byte of output4 bits4 bits
USB generatorone byte2 bits2 bits

5.3 Health tests

A failure at any point stops openxor generate (section 8.1) or openxor scramble (section 10), and the bytes that failed are never used. These tests catch a source that has broken down, or that measures clearly below what openxor counts. They can't prove that its output is unpredictable.

5.4 Extraction

Raw noise isn't uniformly random, so openxor extracts it with a Toeplitz-matrix universal hash, which needs no computational assumption.

SourceBlockCredited min-entropyOutput
Timing jitter4,096 samples (32,768 bits)2,048 bits1,920 bits
Processor noise instruction1,024 bytes (8,192 bits)4,096 bits3,968 bits
USB generator2,048 bytes (16,384 bits)4,096 bits3,968 bits

The seed is drawn from the operating system's generator each time openxor starts a source. It needs no secrecy, only independence from the noise. Physical noise can't depend on the seed, and a fresh seed means even a device built to defeat one particular matrix can't know which matrix will be used. No hash function is used as the extractor. Known answers are in internal/hwrand/testdata/toeplitz.json, and scripts/check_extractor.py checks them with a second implementation.

5.5 Mixing

Each pad byte is the XOR of the extracted output of every hardware source and the operating system's generator:

pad = E1 XOR E2 XOR … XOR S

XOR with an independent value can't make uniform bytes less uniform. So the pad is uniformly random as long as any one input is, and S guards against a faulty or subverted hardware source.

The vault records "hardware randomness" for a pair of vaults only if at least one hardware source, credited as above, covered every pad byte. Generation stops at the first failure, so this holds whenever a pair is finished with any hardware source. Shards are mixed and labelled the same way, in a flags byte in every shard (section 10).

5.6 When there is no hardware source

If openxor finds no source it can use, openxor generate makes nothing unless the user adds --standard-randomness; the menu asks instead. Pads made that way come from the operating system's generator alone, through the full-entropy health tests. They are permanently labelled in the vault, and openxor status shows them as "standard randomness: not P = NP-proof". In practice this happens only if timing jitter is refused, and it works on every computer openxor is tested on.

openxor scramble works the same way. With no hardware source it makes nothing unless the user adds --standard-randomness, and the menu asks. The shards made that way are labelled in their headers, and openxor unscramble shows them as "standard randomness: not P = NP-proof" (section 10).

5.7 What you have to trust

A pad, or a set of shards, made with hardware randomness is P = NP-proof if all of these hold:

Not needed: the secrecy of the operating system's generator, any hash function, or any unproven mathematical problem. openxor selftest lists each source on the computer, whether it passed the health tests, its measured estimate and its speed.

6. Vaults, containers and pads

6.1 Terms

Alice's vault holds, for each contact Bob, a container with pad(Alice→Bob) and pad(Bob→Alice). Bob's vault holds the same two pads in his container for Alice. Each pad has exactly one sender, so the two parties never need to coordinate which bytes to use.

6.2 Bookkeeping

For each container, the vault records:

6.3 File layout (proposed)

header        magic "OXV1", format version, flags,
              Argon2id parameters and 16-byte salt,
              wrapped vault key (two copies, see 8.8)
table A/B     two slots for the encrypted container table, each with a
              sequence number; the newer valid slot wins (crash safety)
pad chunks    pad bytes in 64 KiB chunks, each encrypted separately

Each pad chunk is encrypted with AES-256-GCM under the vault key, with a random 96-bit nonce stored next to it and the vault ID, container ID, pad ID and chunk index as associated data, so chunks cannot be swapped or moved without detection.

6.4 The lock

A random 32-byte vault key encrypts everything in the vault. The header stores the vault key encrypted (wrapped) under a key derived from the user's password with Argon2id (RFC 9106).

Settings. Every vault uses the same fixed settings: 256 MiB of memory, 3 passes and 4 lanes, so each password guess takes about a second on a typical laptop. Because the settings are fixed, a vault made on a fast computer opens on a slower one; this matters because one person usually makes both vaults.

At these settings, a thief guessing offline at one guess per second per computer needs about three hours to try the 10,000 most common passwords, and longer than any realistic attack to guess a six-word random password.

This lock is ordinary, computational encryption. It protects a lost or stolen drive against guessing today. It does not protect against an attacker who copies the vault and later has a fast P = NP method, because the encrypted pad together with any message sent with it gives such an attacker something to check guesses against. Section 11 states this layer by layer.

6.5 The pickup code

When one person makes both vaults, the other person is not there to choose a password. Their vault is locked with a pickup code instead: four words from the EFF long word list (7,776 words) and a two-digit number, about 58 bits, for example maple orbit river stone 42.

On first use, the recipient types the pickup code, chooses their own password, and openxor wraps the vault key under the new password and overwrites the old wrapped key. The pickup code then no longer opens the vault, and the person who made it never knows the new password.

The pickup code must travel separately from the vault (out loud, in a phone call), so that intercepting one does not give the other. Like the password, it is computational protection only.

6.6 One openxor at a time

While a vault is open, openxor holds an exclusive lock on its file: flock on macOS and Linux, and LockFileEx on Windows, on one byte far past the end of the file so that the header stays readable. A second openxor that tries to open the same vault is told it is open in another window, before any password is asked for, so two programs can't take the same pad bytes at once. The emergency wipe (section 8.8) doesn't wait for the lock. On a file system that can't lock files, such as some network shares, the vault opens without one, and that protection is lost.

7. The message format

7.1 Binary form

A message consumes 32 + B bytes of the sender's outgoing pad, starting at offset o:

pad[o .. o+32)        one-time MAC key (r, s)
pad[o+32 .. o+32+B)   encryption bytes

B is a multiple of 16, so offsets stay 16-byte aligned. The message is:

FieldSizeContents
version10x01
flags1bit 0: content is a file
offset6o, little-endian (pads up to 256 TiB)
ciphertextBpadded plaintext XOR pad[o+32 .. o+32+B)
tag16one-time MAC (section 4.2) of version, flags, offset and ciphertext

The padded plaintext is: a type byte (0x01 for text, 0x02 for a file), the content length as 4 bytes little-endian, for files a name length byte and the file name (UTF-8, at most 255 bytes), then the content, then zero bytes up to B.

The message does not name its recipient or sender. The recipient's openxor checks the tag against each contact's incoming pad at offset o; only the right one verifies. This costs one MAC computation per contact.

7.2 Length rounding

Text up to 256 bytes is rounded up to a multiple of 16 bytes. Longer text and all files are rounded up with the Padmé scheme (Nikitin et al. 2019), which reveals at most O(log log n) bits of the length, then to a multiple of 16.

7.3 Encodings

7.4 What a message reveals

To anyone without the pad: the rounded length, and the offset. The offset reveals roughly how many bytes have been sent in that direction so far. See Open question 4.

8. Procedures

8.1 Generating a pair of vaults

openxor generate creates a pair of vaults holding matching pads: the user's own and one for their contact. If the user's vault already exists, the new pads are added to it alongside the pads for other contacts.

  1. The user plugs in two drives, or names two vault files.
  2. openxor checks every hardware randomness source (section 5) and says which it will use. Without --size, it picks a size that takes about 10 minutes, from a one-second trial of the sources together.
  3. openxor creates or unlocks the user's own vault, and creates a vault for the contact locked with a new pickup code.
  4. openxor generates two pads and writes them, chunk by chunk, to both vaults, showing progress and speed. Nothing is written to the computer's own disk.
  5. openxor reads both vaults back and checks that the pads are identical, then copies the program onto the contact's drive.
  6. openxor shows the pickup code once.

If anything fails, including a health test, openxor stops. It removes every vault file it created in that run: the contact's, and the user's own if that run created it. A vault of the user's that was there before keeps the contacts it had and is cut back to its old size. openxor says which files were removed and which were left as they were.

8.2 Delivering the contact's vault

8.3 Why the first delivery cannot be done safely online

Any way of sending a pad over a network protects it with something smaller than the pad: a key exchange (broken by P = NP), a pre-shared passphrase (a few dozen bytes, which cannot protect a gigabyte against unbounded computation), or multi-party computation (which relies on public-key cryptography or on private channels that would already solve the problem). Splitting the pad across several services only raises the number of recordings an attacker needs. These options are not offered as P = NP-proof.

8.4 Sending

  1. With --out FILE, openxor refuses a file that already exists, or can't be created, before any pad bytes are used.
  2. openxor computes the padded plaintext and B.
  3. In the vault, it advances the next send offset past o + 32 + B and writes the updated table (section 6.3). If openxor stops after this step, those bytes are lost, never reused.
  4. It reads the pad bytes, computes the ciphertext and tag, and erases the pad bytes from the vault (section 9).
  5. It outputs the message.

8.5 Receiving

  1. openxor decodes the message and finds the container whose incoming pad verifies the tag at offset o. If none verifies, it reports a damaged or forged message and changes nothing, so a forger cannot use up pad bytes.
  2. If any byte in [o, o + 32 + B) is in an erased range, it refuses the message as already read. This also prevents replays.
  3. It decrypts in memory, records the range as erased, erases the pad bytes, and only then shows the message. The message stays in memory until the user closes it; it is not written to disk unless the user asks.

Messages may arrive in any order.

8.6 Status and renewal

openxor status shows, for each contact, how much of each pad is left and the provenance flags. openxor warns at 20% and 5% remaining. A new pad is a new container made the same way as the first.

8.7 Forgetting a contact

openxor forget <name> erases the container's pads and bookkeeping, after the vault is unlocked.

8.8 Emergency wipe

openxor forget --no-preserve destroys a vault without its password:

  1. It runs only from an interactive terminal, typed in full; it is not in the menu and not in tab completion.
  2. It names the drive or file it will wipe: the one given with --vault FILE, or, without it, the only vault in the current folder, or one the user picks from those there. Before going on, it checks that the file can be written to, so that a read-only drive is found before the user confirms, even in a practice run.
  3. The user types three random words shown on screen.
  4. A three-second countdown runs; any key cancels.
  5. openxor overwrites both copies of the wrapped vault key and the Argon2id salt with random bytes, syncs, and reads them back to confirm they changed.

Without the vault key nothing in the vault can be decrypted. --practice performs every step except the overwrite, and says at the start and at the end that nothing was deleted. A copy of the vault made before the wipe is unaffected, and flash memory may keep an old copy of the header (section 9).

9. Erasing

Pad bytes. To erase a range, openxor decrypts the affected chunks, sets the range to zero, encrypts each chunk again under a new nonce, writes it in place and syncs.

Limits on flash storage. USB sticks, SSDs and SD cards move data internally for wear levelling, so an overwrite may leave the old encrypted chunk in a spare block that a forensics lab could read. That old chunk is still encrypted under the vault key, so recovering it also requires the password (or a fast P = NP method). Destroying old drives physically is the only complete answer. Open question 3 proposes per-chunk keys to narrow this.

Memory. openxor keeps pad bytes and plaintext in memory locked against swapping where the operating system allows (mlock, VirtualLock), disables core dumps, and zeroes buffers after use. Go's garbage collector can copy data it manages, so memory erasure is best effort; sensitive buffers are allocated outside the collector where possible.

Disk hygiene. openxor refuses to place a vault in a folder synced by iCloud, Dropbox, OneDrive or Google Drive, marks vault folders to be excluded from Time Machine and search indexing, and never writes plaintext or pad bytes to temporary files.

10. Scrambling files for storage

openxor scramble turns a file, a folder or a typed secret into shards; openxor unscramble rebuilds it from enough of them. A folder is packed into a single tar archive first. Links and anything else that isn't an ordinary file or folder are left out, and scramble says so. With no file or folder named, scramble asks for a secret at the terminal, twice, without showing it. Neither command needs a vault, and both are on the first screen of the interactive menu.

The shared block. What is shared is not the bare file but a block that also holds its kind and name, so neither shows in a shard:

FieldSizeContents
kind10x01 a file, 0x02 a folder (its tar archive), 0x03 typed text
name length1m; 0 for typed text
namemthe original file or folder name, UTF-8
content length8c, little-endian
contentcthe file, the folder's tar archive or the typed text
zero bytesup to L − 32
fingerprint32SHA-256 of everything before it

The block's length L is the length of its fields, 42 + m + c bytes, rounded up with Padmé (Nikitin et al. 2019), then to a multiple of 16, and is at least 4096 bytes. So a shard's size shows only roughly how big the file is, and every secret shorter than about 4 KB gives shards of the same size.

Sharing. Each byte of the block is shared on its own (section 4.3). Byte b of shard number x, from 1 to n, is

block[b] + c1[b]·x + c2[b]·x^2 + … + c(k−1)[b]·x^(k−1)

in GF(2^8), where addition is XOR and cj[b] is a random coefficient. So the shards take (k − 1) · L random bytes in all. openxor reads them 65,536 bytes of the block at a time: for a chunk of w bytes, first the w coefficients of x, one for each byte of the chunk in order, then the w coefficients of x^2, and so on. The order matters only for reproducing the test vectors (appendix A.4).

Shard files. Each shard file holds a readable header, the shard's L bytes, and a SHA-256 checksum of everything before it, which catches accidental damage:

FieldSizeContents
magic4OXS1
version10x02
flags1bit 0: made from hardware randomness; the other bits are 0
k1how many shards rebuild the file
n1how many shards were made
number1this shard's number, 1 to n
set ID16random, the same in every shard of one scramble
length8L, little-endian
shard bytesL
checksum32SHA-256 of everything before it

The original name and kind are not in the header. Format version 1, from before the first release, had no flags byte, and openxor no longer reads it. Shard files are named like taxes.pdf.shard-1-of-3.oxs, with a very long name shortened to fit, and can be renamed freely.

Shards from different sets are refused. unscramble checks the fingerprint, so it knows whether the shards it was given fit together; given spare shards, it rebuilds without any that don't fit and names them. Before finishing, scramble checks that every combination of k shards rebuilds the file. When there are at most 1,000 combinations, it rebuilds the file in memory from each one and compares it with the original. When there are more, it rebuilds from shards 1 to k, compares that with the original, and checks that each of the other shards lies on the same polynomials. Then all n shards lie on one set of polynomials whose value at 0 is the file, so every combination of k shards rebuilds it. It then reads each saved shard back to check it. scramble never overwrites a file and never deletes the original. unscramble never overwrites anything, and restores a folder only after checking that no entry is a link or device or would reach outside the folder.

Randomness. The coefficients are made the same way as pads (section 5): from every hardware source that passes its start-up check, extracted, and mixed with the operating system's generator, all through the health tests. The set ID is in every header for anyone to see, so it comes from the operating system's generator alone. With no hardware source, scramble makes nothing unless the user adds --standard-randomness, and the menu asks (section 5.6). Shards made from the standard randomness alone are not P = NP-proof: the generator stretches a short seed, and every block has bytes that can be guessed, such as its kind and its length, so a fast P = NP method with k − 1 shards could solve for the seed and rebuild the file.

Making (k − 1) · L random bytes takes as long as making that much pad. A typed secret or a small file needs 4 KB for each required shard but one, which takes a moment after the start-up check, so openxor doesn't time the sources for up to 16 KB. For more, it times them together for about a second, as generate does, says how long the shards will take if that is more than a few seconds, and shows its progress. The computers openxor is tested on make roughly 10 to 130 KB of hardware randomness a second, less while they are busy, so with k = 2 a 1 MB file takes about 10 seconds to 2 minutes, and a 100 MB file about 15 minutes to 3 hours; each further required shard adds the same again. When it would take more than 10 minutes, the menu offers to wait, to use the standard randomness instead, labelled as below, or to make nothing; the command line says how long and goes on. If a health test fails, a source stops sending, or the user presses Ctrl-C, scramble stops, removes any shard it had already saved, and says that no shard files were saved and the original is untouched.

The label. The flags byte of every shard says whether hardware randomness made it: openxor sets it only if every coefficient byte included a hardware source. unscramble shows it as "made from hardware randomness: P = NP-proof" or "standard randomness: not P = NP-proof", and refuses shards of one set whose labels disagree, as changed after they were made. Whoever holds a shard can change its label and compute the checksum again, so the label is information for whoever rebuilds the file, not protection.

Making a new version of a file always uses fresh randomness. Reusing a sharing polynomial for two versions would reveal how they differ.

Detecting a deliberately altered shard without computational assumptions is harder than detecting accidental damage; see Open question 1. Until then, the fingerprint inside the shared block catches changes made by someone who doesn't know what was scrambled, but that check is computational.

No single-file password mode. openxor does not offer a password-only way to protect a file in one output. A password holds a few dozen bytes of secret; a file holds far more. Information-theoretic secrecy requires a key at least as long as the data (Shannon 1949), so any single-file password scheme is computational and falls to a fast P = NP method. Existing tools do that kind of encryption well; openxor leaves it to them.

11. What survives P = NP, layer by layer

LayerProtectsMechanismHolds against a fast P = NP method?
Message contents in transitconfidentialityone-time padyes
Message integrity in transittampering, forgeryone-time MACyes
Replaysreading a message twiceerased rangesyes
Message lengthcontent sizeroundingpartly: rounded length is visible
Vault at resta stolen or copied driveArgon2id and AES-256-GCMno
Pickup code in transitan intercepted driveArgon2id and AES-256-GCMno
Pad randomnesspredictable padshardware noise (timing jitter, processor noise instruction, USB generator), Toeplitz extraction, XOR with OS generatoryes, if at least one hardware source has the min-entropy openxor credits it with
Downloadstampered binariessignaturesno; rebuilding from source does not depend on them
Shardsstored filesthreshold secret sharing, with coefficients made like padsyes, if at least one hardware source has the min-entropy openxor credits it with; no for shards labelled "standard randomness" (section 10)

In short: what crosses the network stays unreadable forever; what sits on a drive is protected by physical custody first and ordinary encryption second.

12. Comparison with existing tools

Key agreementSurvives quantum computersSurvives fast P = NPNeeds physical exchange
TLS 1.3ECDHE (plus ML-KEM in hybrid modes)with ML-KEM, yesnono
SignalPQXDH and Double Ratchetyes, against current knowledgenono
OpenPGPRSA or ECCnonono
WireGuard with a pre-shared keyNoise plus symmetric PSKyes, with a strong PSKnoyes, for the PSK
Quantum key distributionquantum channelyesyes, if authenticated with a pre-shared keydedicated hardware and fibre
openxornone; pad delivered physicallyyesyes, for messages in transityes

13. Build and release integrity

Signatures and the checksum database are computational. Rebuilding from source and comparing fingerprints is not.

The check that a tag is on main and tested runs inside the workflow, so it catches mistakes; who may create release tags is a repository setting.

14. Limits

Open questions

  1. Robust shards. How should unscramble detect a deliberately altered shard without computational assumptions? Candidates: robust secret sharing schemes with an honest majority of shards, or a one-time MAC whose key is itself shared. The same goes for the label in each shard's header (section 10), which anyone who holds the shard can change.
  2. Hardware randomness on Apple silicon. Answered in Draft 0.3: Apple silicon Macs don't offer programs a hardware random number instruction, so openxor uses timing jitter there, which needs no extra hardware. A USB generator can be added with --rng.
  3. Per-chunk keys. Encrypting each pad chunk under its own key, and destroying that key once the chunk is used up, would make erasure depend on overwriting 32 bytes rather than 64 KiB. Is the extra bookkeeping worth it?
  4. Offset privacy. The offset reveals roughly how much has been sent. Starting each pad at a random offset hides the absolute count; hiding the differences between messages needs more. Is that worth the complexity?
  5. Argon2id parameters. Decided in Draft 0.1.1: fixed settings for every vault, a selftest warning on slow computers, and an optional --harder setting (section 6.4).
  6. Test vectors. Published in appendix A: for the one-time MAC and the message format in Draft 0.2, and for the shard format in A.4.
  7. Credited rate for timing jitter. Is 1/2 bit per sample conservative enough on every processor family? A full SP 800-90B assessment for each family (a million samples, every estimator, restart tests) would tell, and might justify more.

Appendix A. Test vectors

These known-answer tests let anyone check an implementation of the one-time MAC (section 4.2), the message format (section 7) and the shard format (section 10) against openxor's. Every byte of every MAC and message vector is in internal/vectors/testdata/vectors.json in the repository, and every byte of every shard vector is in shard/testdata/vectors.json, also in the repository. openxor's Go tests check them on every change, and so do scripts/check_vectors.py and scripts/check_shard_vectors.py, second implementations in Python written from this paper alone; openxor selftest checks the MAC and message vectors on the user's own computer. Byte strings are hexadecimal, and numbers stored in several bytes are little-endian, as everywhere in openxor.

A.1 The test pad

Real pads are random, so they can't be written down. For the vectors, the pad is SHA-256 in counter mode, which anyone can recompute:

block(i)  = SHA-256("openxor test pad" || i as 8 bytes, little-endian)
test pad  = block(0) || block(1) || block(2) || …

"openxor test pad" is the 16 ASCII bytes of that text, with nothing after them. Byte o of the test pad is byte o mod 32 of block(⌊o / 32⌋). Its first 64 bytes are:

d53d03b9c516526b33f0da8419dcd113fa513609e61ee5fc5306d7d4309db3d9
003a105c97615b93667c7c16a323a915de05a5707aff7aead5890ad7eab4c9d9

The test pad is not random. It is only for testing, and must never be used for real messages.

A.2 One-time MAC

The first 16 bytes of each key give r and the last 16 give s (section 4.2). Keys 1 to 5 are test pad bytes; keys 6 and 7 are edge cases for the field arithmetic. An empty message has no blocks, so its tag is s.

1  empty message
   key      d53d03b9c516526b33f0da8419dcd113fa513609e61ee5fc5306d7d4309db3d9   (test pad bytes 0 to 31)
   message  (empty)
   tag      fa513609e61ee5fc5306d7d4309db359

2  one zero byte
   key      003a105c97615b93667c7c16a323a915de05a5707aff7aead5890ad7eab4c9d9   (test pad bytes 32 to 63)
   message  00
   tag      0a06df80d696dc4569f086530158ed02

3  15 bytes: one full block
   key      021cea8fad0a7e4801f305d928799d3160dc3a66871791744a504df345a1126e   (test pad bytes 64 to 95)
   message  000102030405060708090a0b0c0d0e
   tag      0a30c15fbecbc54b285a2e9ed9ba7374

4  16 bytes: a full block and a block of one byte
   key      d1fa7ebe321d141650be6f2078b0b6ac938b35ae2026756fe16e2b16d103f128   (test pad bytes 96 to 127)
   message  000102030405060708090a0b0c0d0e0f
   tag      03ea260c87ff796fdbe4c13ff0f7b413

5  35 bytes of text: three blocks
   key      c5e05463568f43ee19a6feb815e82f5f730f614be7ce6e29ddfde6c92e9ef774   (test pad bytes 128 to 159)
   message  4861737461206c612076697374612c20626162792e2049276c6c206265206261636b2e
            ("Hasta la vista, baby. I'll be back.")
   tag      9a8ad33388ef35564d38fcc2ae383214

6  key of all ff bytes: after the top bits are cleared, r and s are both p, so both become 0 and every tag is 0
   key      ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
   message  ffffffffffffffffffffffffffffffff
   tag      00000000000000000000000000000000

7  r = s = p − 1, with three full blocks of ff bytes
   key      fefffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffff
   message  ff repeated 45 times
   tag      ffffffffffffffffffffffffffffff7d

A.3 Messages

Each message uses the test pad's bytes from its offset: first the 32-byte MAC key, then B encryption bytes (section 7.1). In the padded plaintext the type byte is 01 for text and 02 for a file, and the content length is 4 bytes, little-endian. The tag covers the version, flags, offset and ciphertext.

Text at offset 0. The content is Hasta la vista, baby, 20 bytes.

content           4861737461206c612076697374612c2062616279
padded plaintext  01 14000000 4861737461206c612076697374612c2062616279 00000000000000
                  (type 01 for text, length 20, the content, zero bytes up to B = 32)
pad               test pad bytes 0 to 63
  MAC key         d53d03b9c516526b33f0da8419dcd113fa513609e61ee5fc5306d7d4309db3d9
  encryption      003a105c97615b93667c7c16a323a915de05a5707aff7aead5890ad7eab4c9d9
message           56 bytes:
  version, flags  01 00
  offset          000000000000
  ciphertext      012e105c97293ae0121d5c7ac203df7cad71c45c5a9d1b88ac890ad7eab4c9d9
  tag             16737c23e6a4afddcf2bd1eae9038e2d
one line          oxr:AQAAAAAAAAABLhBclyk64BIdXHrCA998rXHEXFqdG4isiQrX6rTJ2RZzfCPmpK_dzyvR6ukDji0

As a block:

-----BEGIN OPENXOR MESSAGE-----
AQAAAAAAAAABLhBclyk64BIdXHrCA998rXHEXFqdG4isiQrX6rTJ2RZzfCPmpK/d
zyvR6ukDji0=
-----END OPENXOR MESSAGE-----

The same text at offset 0x0123456789b0 (1,250,999,896,496). This offset starts halfway through a test pad block, and uses all six bytes of the offset field.

content           4861737461206c612076697374612c2062616279
padded plaintext  01 14000000 4861737461206c612076697374612c2062616279 00000000000000
                  (the same as above)
pad               test pad bytes 0x0123456789b0 to 0x0123456789ef
  MAC key         c8f7aa7c3c19d2f6a0ba8ea360736fa70a323ed120939dafdba6d7bcd9a34672
  encryption      65b3a450db5af387750d30c2da3ef2ef5626b1b165bed362af352b78e841686d
message           56 bytes:
  version, flags  01 00
  offset          b08967452301
  ciphertext      64a7a450db1292f4016c10aebb1e84862552d09d45dcb200d6352b78e841686d
  tag             a073e0abdd149a29b8e5f7c597bb2774
one line          oxr:AQCwiWdFIwFkp6RQ2xKS9AFsEK67HoSGJVLQnUXcsgDWNSt46EFobaBz4KvdFJopuOX3xZe7J3Q

A file at offset 64. The file is called notes.txt, and holds I'll be back. and a line feed, 14 bytes.

content           49276c6c206265206261636b2e0a
padded plaintext  02 0e000000 09 6e6f7465732e747874 49276c6c206265206261636b2e0a 000000
                  (type 02 for a file, length 14, name length 9, "notes.txt", the content,
                  zero bytes up to B = 32; the flags byte is 01)
pad               test pad bytes 64 to 127
  MAC key         021cea8fad0a7e4801f305d928799d3160dc3a66871791744a504df345a1126e
  encryption      d1fa7ebe321d141650be6f2078b0b6ac938b35ae2026756fe16e2b16d103f128
message           56 bytes:
  version, flags  01 01
  offset          400000000000
  ciphertext      d3f47ebe32147a7924db1c0e0cc8c2e5b4e7598e4243550d800d4038db03f128
  tag             6b5a77ba2ce9b829a7f6b91acf71587d
one line          oxr:AQFAAAAAAADT9H6-MhR6eSTbHA4MyMLltOdZjkJDVQ2ADUA42wPxKGtad7os6bgpp_a5Gs9xWH0

1,100 bytes of text at offset 128. The content is Hasta la vista, baby. (with a space at the end) repeated 50 times. Before padding, the plaintext is 1,105 bytes. That is more than 256, so Padmé rounds it (section 7.2): E = ⌊log2 1105⌋ = 10 and S = ⌊log2 E⌋ + 1 = 4, so the last E − S = 6 bits are rounded up, giving 1,152, already a multiple of 16. So B = 1152, and the message uses 1,184 pad bytes. Rounding to a multiple of 16 alone would have given 1,120. The message is 1,176 bytes long, too long to list here; all its bytes are in the JSON file, and these are the SHA-256 hashes:

content           SHA-256 1786b96fe1d5aebe9457fbc1f8b2412f68a124df655111d203819a5e6c1326b6
padded plaintext  SHA-256 1917316259c2003baacc21827e48a432deab149f092f5652c0d145507a1c8c59
message           SHA-256 21852739bc8fc60e5af2eea6a0e9ba5a78a445358b78a3798b48670780d0931c
  starts          01008000000000002fcbf0b2af5d857c
  tag             1ac061189cb8603814220f816d376819

A.4 Shards

Four vectors scramble a typed secret and a small file, each into 2 shards with both required and into 5 shards with any 3 rebuilding it. Real coefficients are random; here they are the test pad's first (k − 1) · L bytes (A.1), in the order section 10 gives. The set ID of every vector is 000102030405060708090a0b0c0d0e0f. Both blocks are 4,096 bytes, so coefficient j of byte b is test pad byte (j − 1) · 4096 + b: a 2-of-2 vector uses test pad bytes 0 to 4,095, and a 3-of-5 vector bytes 0 to 8,191.

The blocks. In the typed secret's block the kind is 03 and there is no name; in the file's, the kind is 01.

typed secret      "Hasta la vista, baby" (20 bytes)
  kind, name      03 00
  content length  1400000000000000
  content         4861737461206c612076697374612c2062616279
  zero bytes      4,034
  fingerprint     aa738930366f2378c0bc87bbc067047b73123ba7d6031c4fefe77627084ab97f

file notes.txt    "I'll be back.\n" (14 bytes)
  kind, name      01 09 6e6f7465732e747874
  content length  0e00000000000000
  content         49276c6c206265206261636b2e0a
  zero bytes      4,031
  fingerprint     301f3788df4b740d3b78370c89f658d5a453373d5d40ddfa201f7dfce18c37dc

One byte, worked through. Byte 0 of the typed secret's block is 03. In the 2-of-2 vector its coefficient is test pad byte 0, d5, so shard 1 holds 03 + d5·1 = d6, and shard 2 holds 03 + d5·2 = 03 + b1 = b2, where + is XOR. In the 3-of-5 vector it also has the coefficient of x^2, test pad byte 4,096, fa, so shard 3 holds 03 + d5·3 + fa·3^2 = 03 + 64 + fa·05 = 03 + 64 + 3f = 58.

The shards. Each shard file is 4,161 bytes: the 33-byte header, the 4,096 shard bytes and the checksum. Within a vector the headers differ only in the shard's number, shown here as nn: magic, version, flags, k, n, number, set ID and L. The file 2-of-2 vector is labelled standard randomness (flags 00); the others are labelled hardware randomness (flags 01). These are the first bytes of each shard, after the header, and the SHA-256 of each whole file.

typed secret, 2 of 2  4f585331 02 01 02 02 nn 000102030405060708090a0b0c0d0e0f 0010000000000000
  shard 1  d63d17b9c516526b33f092e56aa8b033  fa9b2a0f4146908724aeef3b448269402accebc0dcae2787c261bee1e78cb274
  shard 2  b27a1269912ca4d666fbe77241d7d806  f368c4d90646047d44cf7f7550a60a0f5d916564332f78aa9a8a0eab86c8f056

typed secret, 3 of 5  4f585331 02 01 03 05 nn 000102030405060708090a0b0c0d0e0f 0010000000000000
  shard 1  2c6f0bfd659925fc49e3349d56b6400d  5497cb995b772848fbf05335f8498ad8cec667a9c6ff79d83f0a8578ec2ee2b3
  shard 2  77296262272663bc95b74989b1af35fe  794e836f630f9504612bc5080d28523adba9113169a3baabc90bb8b86fc1e3de
  shard 3  58467d9f42bf4640dc543575946d14d3  2c66c95c0a42fcf1fa6b9736d6381f92da5863f28babe0f125d8e525aac99eb0
  shard 4  43a3c3fed77062042dc68386fad291a1  d0a4a1a7e14715de85ef3be21628c1192bcc36a0cc36ee398a1aaf6719af6d93
  shard 5  6cccdc03b2e947f86425ff7adf10b08c  e4094a50c3e7cf6b27322ffd2742578f6ca1a7768bd21fcfcd2cbefc1e4feee5

file notes.txt, 2 of 2  4f585331 02 00 02 02 nn 000102030405060708090a0b0c0d0e0f 0010000000000000
  shard 1  d4346dd6b17321454788ae8a19dcd113  074968b93fcc80397b16d8e8435188843311d56832eb22aa2df38d01da762d4b
  shard 2  b0736806e549d7f81283db1d32a3b926  3fb0b6cbedc9e0bb07352be0a1a00fa864fb640bf86fec51154ee49d53f79664

file notes.txt, 3 of 5  4f585331 02 01 03 05 nn 000102030405060708090a0b0c0d0e0f 0010000000000000
  shard 1  2e66719211fc56d23d9b08f225c2212d  d338c852e0ccecefaf66437a50b5f15c8303e0db1d253308e69cc0240a07e904
  shard 2  7520180d53431092e1cf75e6c2db54de  16cd7a7c8f12858279cd790701ba3558579b479c756524370c254a373757a710
  shard 3  5a4f07f036da356ea82c091ae71975f3  23754390ca59f7a8ddcb925a6b4eff833e7b074adf32a9c055c961ce548916f7
  shard 4  41aab991a315112a59bebfe989a6f081  31ecc3c54d60932f33dd491a681e1d760eb5307f662f7bdf9d088d9a47dc5860
  shard 5  6ec5a66cc68c34d6105dc315ac64d1ac  830458ec8aa4234aef229f78a37febbf9b03f4ed44a76275c66e143c2251dceb

Any 2 of the 2 shards, or any 3 of the 5, rebuild the block exactly, and the block's fingerprint matches.

References

Change log