how it works
openxor is built on one old idea, the one-time pad. This page shows everything it does, in pictures.
Short answers
- 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 big file of random bytes, called a pad, and saves an identical copy of it on both drives. A byte is the space one letter takes up; a 1 GB pad holds about a billion bytes. 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.
- Create. Run openxor, pick “New contact” 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 make both drives and post or courier one.
- Make both drives. Jamie sets up the contact at 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.
- 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 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
- 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 drive it is about to wipe. If more than one openxor drive is plugged in, you pick one.
- 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.