FiboFile encryption

© Francisco Ruiz, 2016

This page extends the FibonaRNG 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. Essentially, the key set is used to generate a pseudo-random sequence of equal length as the plaintext data in base64, which is then subtracted from it using a Tabula Recta where the keys apply substitutions to input and output. In this implementation, the user can write an entirely separate seed of arbitrary length. The process for decryption is the same as for encryption.

 

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 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. Bear in mind that the keys and seed are case-sensitive. If you leave the key 2 box empty, the straight base64 alphabet will be used as key 2.

Key 1

Key 2

If you want to use for the seed phase a key different from key 1, write it in this box, otherwise key 1 will be used also as seed:

Seed

Key 1 in base64

Key 2 in base64

Seed in base64

Here we tell the program whether or not to use a random seed of the same length instead, which is prepended to the plaintext before the keystream is added:

     Random seed     Straight seed

Since the process is slightly different for encryption and decryption, we have to tell the program what we want to do:

     Encrypt     Decrypt

 

Step 2. Plain file / encrypted file

Now we input the file to be encrypted or decrypted as a link, using the button below.

File to be encrypted/decrypted

 

Step 3. Execution

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

   

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