81 lines
2.1 KiB
Markdown
81 lines
2.1 KiB
Markdown
# XORCIPHER
|
|
|
|
Simple code for encrypt/decrypt files with xorcipher.
|
|
|
|
# ZAŠTO OVO?
|
|
|
|
Zato sta svugdi online svi nude enceypt/decrypt text sa xor cipher, a malo tko nudi za encrypt files...
|
|
|
|
Jednostavan `.c` kod lagan i esy for usage.
|
|
|
|
## Here's how to compile **xorcrypt.c** file to a Win32 executable using **gcc**:
|
|
|
|
**Method 1**: Using MinGW-w64 (Recommended)
|
|
|
|
```bash
|
|
# Compile as 32-bit Windows executable
|
|
gcc -m32 -o xorcrypt.exe xorcrypt.c
|
|
|
|
# Or with more specific options
|
|
gcc -m32 -O2 -s -o xorcrypt.exe xorcrypt.c
|
|
```
|
|
|
|
**Method 2**: Using Specific Architecture
|
|
|
|
```bash
|
|
# If you have multiple gcc targets
|
|
i686-w64-mingw32-gcc -o xorcrypt.exe xorcrypt.c
|
|
|
|
# Or for standard MinGW
|
|
mingw32-gcc -o xorcrypt.exe xorcrypt.c
|
|
```
|
|
|
|
**Method 3**: With Additional Compiler Flags
|
|
|
|
```bash
|
|
# Compile with optimizations and stripped debug info
|
|
gcc -m32 -O2 -s -Wall -o xorcrypt.exe xorcrypt.c
|
|
|
|
# Or for a smaller executable
|
|
gcc -m32 -Os -s -ffunction-sections -fdata-sections -Wl,--gc-sections -o xorcrypt.exe xorcrypt.c
|
|
```
|
|
|
|
**Installation Options for GCC:**
|
|
|
|
**Option A**: Install MinGW-w64
|
|
|
|
* Download from: `https://www.mingw-w64.org/`
|
|
* Or use Chocolatey: `choco install mingw`
|
|
* Or use MSYS2: `pacman -S mingw-w64-i686-gcc`
|
|
|
|
**Option B**: Using Visual Studio Developer Command Prompt
|
|
|
|
```bash
|
|
# Open "Developer Command Prompt for VS" then:
|
|
cl /Fe:xorcrypt.exe xorcrypt.c
|
|
```
|
|
|
|
**Usage after compilation:**
|
|
|
|
```bash
|
|
# Encrypt/decrypt a file
|
|
xorcrypt.exe input.txt output.txt mypassword
|
|
|
|
# Example
|
|
xorcrypt.exe document.txt encrypted.bin secretkey
|
|
```
|
|
|
|
**Important Notes**:
|
|
|
|
* `-m32` flag: Forces 32-bit compilation (remove for 64-bit)
|
|
* `-O2`: Optimization level 2
|
|
* `-s`: Strip debug symbols (smaller executable)
|
|
* `-Wall`: Enable all warnings
|
|
|
|
If you get "**architecture not supported**" error:
|
|
|
|
* Install **32-bit** development **libraries**
|
|
|
|
* Use **i686-w64-mingw32-gcc** specifically for 32-bit Windows
|
|
|
|
The compiled executable will be a standalone **Win32** console application that can encrypt/decrypt files using **XOR encryption** with the provided key. |