Xenon: an unbreakable XOR file encryption tool

March 11, 2012

Idea

The idea of unbreakable encryption is quite intriguing. I wanted to implement the algorithm for unbreakable encryption to be able to use its power and better understand how it works. This algorithm is mathematically unbreakable - even with the best supercomputers or quantum computers or anything else, the best anyone without the key can do is take a guess at what the encrypted message holds. By comparison with other algorithms used today it is awesomely simple and elegant. The reason it is not used widely is because the key has to be larger than the message - meaning a physical exchange of keys is necessary. Yet I believe the ability to send secure messages should be available to the public which is why I created this tool.

Description

The encryption algorithm in its entirety is going through the file byte-by-byte and performing a XOR operation on a byte of the file with a byte of the key. As a result, the encrypted message is a collection of bit-wise differences between the key and the plaintext message. Without knowing the key it is quite useless to try to gain anything from the encrypted message. I think it is interesting to consider a parallel to quantum encryption, since the XOR algorithm is symmetric. Exchanging keys can be seen as exchanging all future messages and then sending the keys to open them.

The XOR algorithm itself may be simple but it is not easy to find a readily usable implementation for real-world communications. This tool is self-contained and has all features necessary for use of secure communications. It has a secure random key generator to create an encryption key, since this is a significant factor in message security (if there is a pattern in the key, this pattern may be identifiable from the encrypted messages). It adds to the simple XOR algorithm by calculating a file signature (to verify the file has not been tampered with during transmission), automating the process of using keys for multiple communications, and most importantly by updating keys to allow for continuing communications. Traditionally, XOR keys are one-use since using the same key multiple times can increase the chances of breaking a message because the encryption algorithm is so direct. The power of Xenon is in using the fact that the transmitted message is unknown to update the used portion of the key for future correspondences for both sender and receiver. Thus a single key can be used for multiple messages, even exceeding the size of the key, without losing message security.

The algorithms used have all been designed specifically to work with XOR encryption and have all been cryptographically tested to be secure and prevent patterns from arising. To give an example, even if an attacker knows one half of the encrypted message with full assurance they still cannot get a single byte of the updated key (which will be used if a key is used for multiple communications). If a key is not used more than once, there is no chance of the attacker even having a lead. Using a file filled only with repeating character 'a' for the secure key generator still gives a random key. That being said, I am not a professional cryptographer so the paranoid may want to take a look at the source code.

About Xenon Keys

Important Note

Xenon keys are different from encryption keys you may be used to because the key is updated after each encrypt or decrypt operation.

The same key cannot be used to encrypt and decrypt the same message. Order of file encryption matters.

In order to encrypt and decrypt files using Xenon you will need two copies of the same key, one to use for encryption and the other for decryption. It does not matter which one is used for which operation, only that the one used to decrypt a file is exactly the same as the one used to encrypt it. The key used to encrypt the file will be updated during encryption and will not be the same, so to decrypt the copy of the original must be used.

If you encrypt two files in a row, they need to be decrypted in the same order. If you encrypt the same file twice in a row it cannot be decrypted since this requires a reverse order (also this is pointless to do, unbreakable is unbreakable).

Real World Suggestions

If using for encrypting private information (not intended for exchange), keep two copies of a private key for each private file. Use one copy for encryption, another for decryption. This way files can be encrypted/decrypted multiple times as long as the proper keys are used. The keys should not be used for anything else.

If using encryption for two-way communication, have one copy of a key and give the other to the receiver. This works best with sparse communication, as all encrypted messages must be decrypted on both sides in order for the keys to match. Encrypt the message using your key and send to receiver, who will have a copy of "the original encryption key" same as you used, and the receiver's key will change to match yours after decrypting the message.

If a lot of communication needs to take place, have two copies of two keys - you have two keys and a partner has the copies of the two keys. One of the keys is used by you to encrypt and by the partner to decrypt, the other is used by the partner to encrypt and by you to decrypt. This will prevent a problem if you encrypt a message before decrypting one from your partner, which would make your keys entirely mismatched.

Instructions

Creating a key

Before using Xenon you will need to create one or more encryption keys.

  1. Run Xenon.exe
  2. Go to the Keygen tab
  3. Select a random file - here is a guide. Your key will be one-half of the size of this file, and maximum message size is one-half of the key size (but multiple messages can be sent). It must be at least 50 bytes. Recommended size is at least 20x approximate size of single message - this means 20 messages can be sent securely, and indefinitely many more if you trust my key update algorithms.
  4. Pick a name for the key file. The default extension for key files is .key, you can change if you want.
  5. Type in random characters (or leave blank)
  6. Press Go
  7. Click OK on time delay dialog
  8. You should get a success dialog
  9. In windows explorer, make a copy of the new key for it to be useful (read above)

Encrypting/Decrypting

Now that you have a key, the rest is pretty self-explanatory.

  1. Run Xenon.exe
  2. Go to Crypto tab (default)
  3. Select an input file, this is the file you want to encrypt or decrypt, it must be at least 12 bytes
  4. Select key to use, it must be at least twice the file size
  5. Select output file, this is by default same as input file (overwrite) but can be changed to anything
  6. Select encrypt or decrypt
  7. Press Go
  8. If decrypting, you may get a notice that signature verification did not pass - this means encrypted file is not valid or your keys are mismatched, in that case all files are left unchanged (key is still in original state)
  9. If encrypting, the key will be updated for future communications. Now it cannot be used to decrypt the same message. The copy of the key which has not been updated will need to be used to decrypt the message.
  10. If decrypting, the key will be updated for future communications. Now it will exactly match the updated key that resulted from encrypting the message.

Download

Download executable here: Xenon.exe. It has been tested on Windows 7 and should work on Windows XP as well. 32-bit

Download code here: code.zip. I know it is messy beyond belief but it works.