Menu

Encrypting files

Ryan Babb
Attachments
fobs_2.png (13882 bytes)
fobs_4.png (14152 bytes)

Encrypting files with File Obfuscator

Encrypting files is really easy with File Obfuscator's GUI (Graphical User Interface).

All you have to do is follow 3 simple steps:

1 Find the file you wish to protect and type it's path in the File text entry
2 Choose a good password you will rember and type it in the Key text entry
3 Click the Scramble button

img:Encrypting a file with the File Obfuscator GUI

See how easy it is!

When the programme completes the scramble, you will have a file in the same folder with the same name, but an .obf extension.
A green info bar will tell you that all went well. If, for whatever reason, File Obfuscator was unable to read/write the file, a red info bar will notify you of the error.

img:Errors are notified with red info bars

Note:
  • The Scramble button will only become active when both the File and Key entrys have text in them!

How it works

File Obfuscator uses a simple xor bit comparison operator to re-arrange the bytes in the file, thus rendering it a useless and nonsensical collection of binary garbage.

The following table illustrates the xor operator:

Bit 1 Bit 2 Bit 1 XOR Bit 2
1 1 0
1 0 1
0 1 1
0 0 0

xor stands for eXclusive OR, a logical operation that produces a value of true if one and only one of its operands is true.

The code that implements the encryption is a C++ for loop:

for (int i = 0, k = 0; i < file_data.size(); ++i, ++k)
{
    if (k >= key.size()) k = 0;

    file_data[b] ^= key[k]; // xor is denoted by '^'
}
Note:
  • The full code is available at the GitHub and SourceForge git repositories for the project. This code is more like pseudo-code to illustrate the xor process.

The programme steps through the file's contents a byte at a time, xoring each one with a corresponding byte from the key/password.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.