FileWorm encryption

© Francisco Ruiz, 2016

This page extends the Worm cipher, by F. Ruiz, so it can be used to encrypt files. The encryption is done using the base64 encoding of the file, which JavaScript handles easily. it also allows the use of a separate seed for the initial phase, which strengthens security a lot.

For details on how the process goes, refer to the Worm cipher page. Essentially, the plaintext data are added mod 64 to the plaintext after a delay equal to seed length, repetitions of the seed, and the ciphertext after the same delay. The method is reciprocal, so decryption is the same process as decryption.


Step 1. Key input and substitution

We begin by taking the user-supplied keys and seed and converting them to base64 through "btoa" operations. Then we make each base64 substitution key this way: take the base64 key and write the different characters in the order they appear in the key, if a character appears again, write instead the first character before it in the base64 alphabet that is still available (wrap around to the end if needed); if after doing this there are base64 characters that did not appear in the key, write them behind in reverse order.

Key Input

If you want to use a seed different from the main key, write it in this box, otherwise the main key will be used for this purpose:


Key in base64

Alphabet from key

Seed in base64


Step 2. Plain file / encrypted file

Now we input the file to be encrypted as a link using the button below. If the file is encrypted, it will be decrypted instead.

File to be encrypted/decrypted


Step 3. Execution

And now, the all important button, followed by some statistics of the keystream:


Information about output quality will appear here


Step 4. Encrypted / decrypted file

And here is the file after processing. It can be saved by right-clicking on it (in Chrome, only if below 1.5MB).

Encrypted/decrypted file