how it works
openxor is built on one old idea, the one-time pad. This page explains how it works.
Short answers
- What is a pad?
- A big file of random bytes that only you and one other person have. A byte is the space one letter takes up, and a 1 GB pad holds about a billion of them. openxor scrambles each message using the next unused bytes of the pad. Only someone with the same pad can unscramble it, and once a message has been read, the bytes it used are erased so they are never used again.
- When you set up a contact, what does openxor actually create? A key?
- Yes, but not the kind of key you're used to. openxor creates a pad and saves an identical copy of it on both drives. Then, for every message:
- Scramble. openxor takes the next unused bytes of the pad, about one for each letter of your message, and combines each letter with one of them (fig. 3 shows how). The result is scrambled text.
- Erase on your drive. openxor erases those pad bytes from your drive straight away. Your contact still has their copy of them.
- Send. You send the scrambled text any way you like: email, chat, a public post. The pad itself never leaves your drive.
- Unscramble. Your contact pastes the scrambled text into openxor. Their drive has the same pad bytes in the same place, so openxor uses them to turn it back into your message.
- Erase on their drive. openxor erases those bytes from your contact's drive too. No copy of them exists any more, so that scrambled text can never be unscrambled again.
- Is it asymmetric, like the keys behind HTTPS or Signal?
- No. There is no public key and no private key, and nothing is published that anyone could work backwards from. That is why P = NP has no effect on it.
- Does each person get their own key?
- No. openxor actually makes two pads, and both drives get identical copies of both. One pad is only for messages Jamie sends to Sam. The other is only for messages Sam sends to Jamie. That way each of you can read what the other sends. The only thing that's yours alone is the password that locks your own drive.
- When you set up a contact, do both drives have to be plugged in at the same time?
- No, but it's the easiest way. Setting up is the only time both drives are involved, because that's when openxor saves the pads onto them. With only one USB port, openxor asks you to swap drives as it goes (fig. 5).
- To send or read a message, what do I need plugged in?
- Only your own drive. It holds your copy of the pads. Plug it in, send or read, then unplug it. The other person's drive is never needed again after setup.
- If someone steals my drive, can P = NP help them?
- Yes. Unlike the messages you post, the drive is locked with ordinary encryption. See if someone gets hold of your drive.
- Can I add more contacts to the same drive later?
- Yes. Each contact gets their own container on your drive: a separate section holding the two pads for just the two of you (fig. 7). To add one:
- Plug in. Plug in your drive and a drive for the new contact: a blank one, or their own openxor drive if they already have one.
- Generate. Run openxor, pick “Generate a pair of vaults” and type their name. openxor creates two new pads for the two of you and saves them in a new container on both drives. Nothing already on either drive changes.
- Lock. A blank drive gets a pickup code. If it's their own openxor drive, they type their password to unlock it.
- Hand over. Give them the drive in person, or post it (see the next question).
- Can the two drives be set up on different days?
- Yes, if the second drive is copied from the first. Set up your drive on Monday, then on Tuesday plug it in next to a blank drive and copy it across. No, if each drive is set up separately from scratch: two pads made separately never match, so neither of you could read the other's messages.
- Do we have to meet?
- No. One person can generate both vaults and post or courier one of the drives.
- Generate both vaults. Jamie runs
openxor generateat home, as usual. - Seal it. Jamie puts Sam's drive in a tamper-evident bag, writes down the bag's serial number, and posts or couriers it.
- Send the code separately. Jamie gives Sam the pickup code and the bag's serial number in a phone call, never in the same parcel.
- Check before opening. Sam checks the seal is intact and the serial number matches. If either looks wrong, Sam doesn't use the drive, and Jamie makes a new pair.
- Unlock. Sam plugs the drive in, types the pickup code and chooses a password.
- Generate both vaults. Jamie runs
- What's the pickup code?
- A temporary password for your contact's drive while it travels to them. The person setting up both drives can't choose the other person's password, but the drive still has to be locked on the way (fig. 8).
- Made. When Jamie sets up the contact, openxor locks Sam's drive with a random code, such as
maple orbit river stone 42. - Told separately. Jamie gives Sam the code out loud or in a phone call, never in the same parcel or message as the drive. Anyone who intercepts the drive gets a locked drive and no code.
- Used once. On first use, Sam types the code and openxor unlocks the drive.
- Replaced. Sam chooses their own password straight away. openxor locks the drive with it and destroys the old lock, so the pickup code never works again, and Jamie never knows Sam's password.
- Made. When Jamie sets up the contact, openxor locks Sam's drive with a random code, such as
- Which computers can make P = NP-proof pads?
- Any Mac, Windows PC or Linux computer openxor runs on, with nothing extra plugged in. openxor makes every pad byte from physical noise that no algorithm can recompute, and mixes in the computer's own randomness as a backstop:
- Timing jitter, on every computer. openxor times the same small task over and over. Each run takes a slightly different time, because of tiny, unpredictable effects inside the processor and memory, and those differences are the noise. This is what Apple silicon Macs use, since they don't offer programs a hardware random number circuit.
- The processor's noise circuit, where there is one. Intel processors since 2014 and AMD processors since 2017 have one, called RDSEED, and openxor uses it too. Some Arm processors have one, called RNDRRS, which openxor uses where the system reports that it works.
- A USB random number generator, if you have one. Give its path with
--rng, such as/dev/ttyACM0orCOM3. openxor reads it directly, with no drivers. On a Mac, use the port's/dev/cu.*name, not/dev/tty.*. On Windows, if openxor says Windows wouldn't open it, another program usually has the port open; if it says the generator sent too little, it is usually the wrong port.
openxor selftestto see which sources your computer has and how fast it makes pads. On the computers openxor is tested on, that is roughly 10 to 130 KB a second, less while the computer is busy, so ten minutes makes enough pad for about 20,000 to 250,000 short messages each way. If openxor can't use any source, it makes pads only if you add--standard-randomness, and labels them "standard randomness: not P = NP-proof". - Can I scramble a file just for myself, without a contact?
- Yes, with
openxor scramble. It turns your file into two shards:- Scramble. openxor turns your file into two shards. Each one on its own is random bytes, a little bigger than your file. openxor makes those random bytes from hardware randomness, as it does for pads, one for each byte of your file. A typed secret or a small file takes a moment. For a big file, openxor says how long it will take before it starts: on the computers openxor is tested on, between a few seconds and two minutes for 1 MB, and between about 15 minutes and three hours for 100 MB, longer while the computer is busy. Before saving the shards, openxor checks that the two together rebuild your file exactly.
- Keep them apart. Store the two shards in different places, for example a USB stick in a drawer and your cloud storage. Either shard alone is just random bytes, and because they come from hardware randomness, one shard on its own stays unreadable even with P = NP. Never keep both in the same folder or the same cloud account. openxor doesn't delete your original: once the shards are stored, delete it yourself, including copies in backups, the trash and cloud sync.
- Unscramble. Bring both shards together and run
openxor unscramble taxes.pdf.shard-1-of-2.oxs taxes.pdf.shard-2-of-2.oxs, or runopenxoron its own and choose unscramble, to get your file back under its original name.
openxor unscrambletells you. Anyone who holds a shard could change that label, so it is a note of how the shards were made, not a guarantee. If openxor can't use any hardware source, it makes shards only if you add--standard-randomness, and labels them "standard randomness: not P = NP-proof". If anything stops it before it has finished, including Ctrl-C, it saves no shards and leaves your file as it was. Why not one file and a password? A password is a few dozen characters and your file is millions of bytes. Only a key at least as big as the file can protect it against unlimited computing, so protection that survives P = NP always means at least two shards. One file with a password is ordinary encryption, which P = NP breaks. - Can I make spare shards, or share a file among several people?
- Yes, with
--shardsand--required.openxor scramble taxes.pdf --shards 3 --required 2makes three shards, any two of which rebuild the file, so losing one place isn't fatal.--shards 5 --required 3gives five people one shard each: any three of them together can open it, and any two learn nothing. Each byte needs one random byte for each required shard but one, so--required 3takes twice as long to make as--required 2. If a shard is damaged, openxor leaves it out and says so; with a spare you still get your file back. If you give too few, it tells you how many more it needs. - Can the pad be sent over the internet instead, using multi-party computation or by splitting it across several services?
- Not safely. It only makes more work for an attacker. Multi-party computation (MPC) protocols either rely on the same public-key maths that P = NP breaks, or need private connections between the people involved before they start, which is exactly what the pad exchange is meant to create. Splitting the pad into pieces sent over different services (say email, Signal and a cloud folder) means an attacker needs every piece. But each piece still travels under ordinary encryption. Anyone who recorded all of them, or later gets the logs from every service, can decrypt them with a fast P = NP method and rebuild the pad. That's more effort, not more safety. Only moving the pad physically closes this off. If you can't meet, post or courier a drive instead (see the question above).
Fig. 1 · Making the drives
Jamie plugs two drives into a laptop: USB sticks, SSDs, hard drives or SD cards all work. openxor creates two pads, each a big file of random bytes, and saves identical copies of both on each drive. One pad is for messages Jamie sends to Sam, the other for messages Sam sends to Jamie. Nothing is kept on the laptop. Each drive is locked with its own password, and Sam's gets a pickup code until Sam sets one.
Fig. 2 · A shared pad, not a key pair
Most encryption on the internet starts with a key pair. One half is published, the other is kept secret, and the maths linking them is believed too hard to undo. A fast P = NP algorithm would undo it. openxor publishes nothing: both drives simply hold the same random bytes, and there's no maths to undo.
Fig. 3 · One message, start to finish
Each square is one byte. The filled and empty squares in the pads are its random bytes. ⊕ is XOR: wherever the pad has a 1, the message's bit is flipped, and doing it again with the same pad bytes flips it back. The scrambled line is safe to post anywhere, even publicly, because without those exact pad bytes every message of that length is equally likely. Once both sides have erased them, nobody can ever read that post again, including Sam and Jamie.
Fig. 4 · Two pads, one sender each
If both people sent from one pad, they could pick the same bytes at the same moment, and reusing pad bytes is the one mistake that breaks a one-time pad. So Jamie only ever sends with one pad, and Sam only ever sends with the other. Nobody has to coordinate, and no server keeps track: each message says where in the pad it starts.
Fig. 5 · Setting up: do both drives have to be plugged in?
Making a pad from a shared password doesn't work either. A pad made from a password isn't truly random: it can be rebuilt from the password, and working out the password is exactly what P = NP would make easy.
Fig. 6 · What's on each drive
The left part of the drive holds the openxor program itself, one copy for each operating system, so Sam can run it straight from the drive on any computer without installing anything. It isn't locked: the program isn't secret, and it has to start before it can ask for a password. The right part holds everything secret (the contact's name, both pads, and how much of each pad has been used), locked with Sam's password.
That password lock is ordinary encryption. It stops someone who finds your drive today, but not someone with a fast P = NP method. The section on stolen drives below explains what that means.
Fig. 7 · Several contacts on one drive
Each contact gets a container on the drive: a separate section holding the two pads for that pair of people. Jamie's drive holds Sam's container and Alex's container side by side. Sam's drive and Alex's drive hold the matching copies. Alex's drive also has a container for Kai, someone Jamie has never met: Jamie can't read Alex and Kai's messages, and Alex can't read Jamie and Sam's. Adding a contact adds a new container; nothing already on the drive changes.
Fig. 8 · The layers around a pad
From the outside in: while it travels, a drive can be in a tamper-evident bag, and a vault file is inside a message. The drive or file holds a locked area. Until first use the lock opens with the pickup code, and after that only with the owner's own password. Inside the lock, each contact has a container, and inside each container are the two pads. Only the pads at the centre are safe against a fast P = NP method. Every layer around them protects the pads while they are stored and carried, using ordinary means.
If someone gets hold of your drive
P = NP can't read the scrambled lines you post. It can help someone who has your actual drive, because the password lock on the drive is ordinary encryption.
| today | if P = NP | |
|---|---|---|
| What the thief has to do | Guess your password on their own computers. openxor makes every guess slow, so a long random password would take longer than anyone can wait. | No guessing. A fast P = NP method could work out the drive's lock from what's stored on the drive, however strong your password is. |
| Messages already read or sent | safe | safe their pad bytes are erased |
| Unread and future messages | safe without your password | readable |
| Fake messages sent as you | not possible without your password | possible |
Why can't a stronger password fix this? A password is a few dozen letters; the pad on your drive is about a billion bytes. The only lock no computer can ever open is one as long as the thing it locks, which is another one-time pad. Anything shorter leaves something to work out.
- Keep the drive with you or locked away, and unplug it when you're not using it.
- If it's lost or taken, tell your contact in person or by phone to stop.
openxor forgeterases their copy of your pads. - Use a long password made of random words. Today, that's what stops a thief.
- The worst case is someone copying your drive and putting it back, because you won't know it happened. Keep it where nobody can borrow it.
- USB sticks, SSDs and SD cards can keep stray old copies of erased bytes. A forensics lab might recover some of them, which could expose some past messages. Destroy old drives physically.
Emergency wipe. If you expect your drive to be taken, you can destroy everything on it in a few seconds, without your password:
- Type the full command
openxor forget --no-preserve. It isn't in the menu, has no shortcut and is left out of tab completion, so it can't be run by accident. A misspelling just shows an error. - Check the drive. openxor names the vault it is about to wipe: the one in the folder you run it from, or the one you pick if there are several. You can also name it yourself:
openxor forget --no-preserve --vault FILE. - Type the three random words openxor shows. They change every time, so a stray keypress, a habit or a script can't confirm the wipe.
- Wait three seconds. A countdown runs, and any key cancels it.
- openxor destroys the key that unlocks the drive, then checks it's gone. Nothing on the drive can be read again, by anyone, including you.
- Tell your contacts in person or by phone to run
openxor forgetwith your name, so they stop using the pads they share with you.
Practise once with openxor forget --no-preserve --practice, which goes through every step without deleting anything. Two limits: a copy of the drive made before the wipe is unaffected, and a flash drive can keep an old copy of the key in spare memory, which a forensics lab might recover (they would still need your password, or a fast P = NP method). Physically destroying the drive is the only complete answer.