ImageCrypt
Project description
Project AlexGyver on Python by TheK4n
Design by Пашушка
Byte packing in decimal rgb:
this_color = b * 65536 + g * 256 + r
this_char = ord(char)
new_color = (this_color & 0xF80000) # 11111000 00000000 00000000
new_color |= (this_char & 0xE0) << 11 # 00000111 00000000 00000000
new_color |= (this_color & (0x3F << 10)) # 00000000 11111100 00000000
new_color |= (this_char & 0x18) << 5 # 00000000 00000011 00000000
new_color |= (this_color & (0x1F << 3)) # 00000000 00000000 11111000
new_color |= (this_char & 0x7) # 00000000 00000000 00000111
Unpacking byte:
new_color = b * 65536 + g * 256 + r
this_char = 0
this_char |= (new_color & 0x70000) >> 11 # 00000111 00000000 00000000 -> 00000000 00000000 11100000
this_char |= (new_color & 0x300) >> 5 # 00000000 00000011 00000000 -> 00000000 00000000 00011000
this_char |= (new_color & 0x7)
Method for russian symbols:
# Encryption
if this_char > 1000:
this_char -= 890
# Decryption
if this_char > 130:
this_char += 890
Installation:
Clone repository and installing dependencies:
git clone https://github.com/TheK4n/ImageCrypt.git
cd ImageCrypt
make
Usage
GUI:
image-crypt-gui
Bash:
image-crypt --help
Result:
usage: image-crypt [-h] (-e | -d) [-o OUTPUT] images [images ...]
Stenography encryption tool
positional arguments:
images path to image to encrypt of decrypt
optional arguments:
-h, --help show this help message and exit
-e, --encrypt encrypts text in image
-d, --decrypt decrypts text from image
-o OUTPUT, --output OUTPUT
name of output image
For encryption:
image-crypt -e images/test.jpg
Result: saved image with default name image_encrypted.bmp
For decryption:
image-crypt -d test_encrypted.bmp
Result: decrypted text
Example:
echo "test message" | image-crypt -e image.png -o test_image.bmp
image-crypt -d test_image.bmp > res.txt