A free and open-source encryption tool.
SDBF Encryption is a personal project to explore encryption methods. The name SDBF stands for String Dependent Bit Flipping, a concept I've been thinking about and wanted to test its feasibility.
This tool was created for educational purposes and to experiment with a own encryption algorithm. There are many established and more robust encryption programs available that are suitable for securing important data. I am not liable for any data loss, corruption, or security breaches that may occur from using this software. Using this program could potentially expose unencrypted data chunks within the encrypted file.
- Encrypts and Decrypts files of any type using a password.
SDBF has no graphical user interface; it's entirely terminal-based. To use it, open the terminal and navigate to the directory where you downloaded the file. To open the directory, run this command in your terminal:
Windows
Command:
cd <pathToDirectory>Example:
cd C:\stonie\DownloadsLinux
Command:
cd <pathToDirectory>Example:
cd /home/stonie/DownloadsOn Linux, you may need to grant the file execution permission with this command:
chmod +x sdbf-linuxTo encrypt or decrypt a file, execute this command:
Windows
Encrypting a file:
.\sdbf-windows.exe en <filePath>Decrypting a file:
.\sdbf-windows.exe de <filePath>Example:
.\sdbf-windows.exe en C:\stonie\Documents\text.txtLinux
Encrypting a file:
./sdbf-linux en <filePath>Decrypting a file:
./sdbf-linux de <filePath>Example:
./sdbf-linux en /home/stonie/Documents/text.txtAfter executing this command, you will be prompted to input a password. This will be used for encrypting or decrypting your file.
If you don’t want to navigate to the directory and type ./sdbf-linux or .\sdbf-windows.exe every time, you can add the program to your system’s PATH. After doing this, you can simply run sdbf ... from any location in your terminal.
Windows
-
Move
sdbf-windows.exeto a permanent folder (for example:C:\Program Files\SDBF). -
Press Win + R, type
sysdm.cpl, and press Enter. -
Go to the Advanced tab → click Environment Variables.
-
Under System variables, find and select
Path, then click Edit. -
Click New and add the folder where you placed
sdbf-windows.exe(e.g.,C:\Program Files\SDBF). -
Click OK to save and close all dialogs.
-
Open a new terminal (PowerShell or CMD) and test:
sdbf en C:/stonie/Documents/text.txt
Linux
-
Move
sdbf-linuxto your local folder:sudo mv sdbf-linux /usr/local/bin
(
/usr/local/binis a standard place for custom executables). -
Ensure it is executable:
sudo chmod +x /usr/local/bin/sdbf-linux
-
Now you can run it directly from anywhere:
sdbf en /home/stonie/Documents/text.txt
If you don’t want to move the file, you can instead add its current folder to your PATH by editing your shell config file (
~/.bashrc,~/.zshrc, etc.):echo 'export PATH="$PATH:/home/stonie/Downloads"' >> ~/.bashrc source ~/.bashrc
This is a simple program, but I think it implements a reasonable level of security. The program stores both the file and the password in binary form, then cycles through the bits of the file. Based on the bits of the password, it flips certain bits in the file, producing a corrupted and encrypted version.
for (int bit = 7; bit >= 0; bit--) {
int currentBit = (byte >> bit) & 1;
//Flip bits based on the password
int modifiedBit = 0;
if (passwordBits[i % bitCount] == 1) {
modifiedBit = currentBit ^ 1;
}else {
modifiedBit = currentBit;
}
newByte |= (modifiedBit << bit);
i++;
}- The program cycles through every bit of the file, which can result in long processing times for larger files.
- Since only some bits are flipped while others remain unchanged, some patterns from the original file may still be exposed in the encrypted output.
I defined my own file format for encrypted files, using the .sdbf extension.
The header consists of three parts:
- Magic number: The first 4 bytes. I chose
"SDBF"as the magic number for.sdbffiles. - Version: A single byte indicating the version of the encryption algorithm used, ensuring compatibility with future changes.
- Original file extension: 5 bytes reserved to store the original file extension (e.g.,
.txt,.png). If the extension is shorter than 5 bytes, the remaining bytes are padded with zeros.
I welcome all contributions!
Feel free to open an issue, suggest a feature, or submit a pull request.
To build the project from source, you’ll need a C compiler such as gcc or clang.
Example build command:
gcc -o sdbf main.cStable builds will be published regularly in the Releases tab for download.