Skip to content

image encryption CLI tool supports encryption/decryption through AES, one-time pad, Arnold's cat map and also allows hiding of text through LSB steganography.

License

Notifications You must be signed in to change notification settings

Priyanshu-001/imcrypt

Repository files navigation

imcrypt

image encryption cli tool, supports the following operations

AES encrytion/decryption

Encryption/decryption using Arnold's cat map

Encryption/decryption using one time pad

LSB steganography

Installation

Recommended to set up a venv first

pip install -r requirements.txt

USAGE

usage: python imcrypt.py [-h] --image IMAGE [--message MESSAGE] [--key KEY] [--password PASSWORD] MODE

MODE can be any one of these {1time_pad_en,1time_pad_de,arnold_cat,arnold_cat_de,aes_en,aes_de,stegsno_write,stegano_read}

-- image. -i image to encrypted

-- messsage, -m message to be hidden in image(for steganography mode)

-- key, -k address of key image for one time pad or number of iterations for Arnold's cat map

-- password, -p password for aes mode

CLI MODES

1time_pad_en,1time_pad_de - Generates a randomly generated key and performs xor with the orginal image to create encrypted image, the key and the encrypted image both are required for decryption

arnold_cat,arnold_cat_de - a chaotic map that maps a pixel at (x,y) to (2x+y,x+y)mod n the current implementation work only for square images, any rectangular image will be padded as a square.

stegsno_write,stegano_read - Implementation of LSB-steganography.

aes_en,aes_de - standard AES implementation

Examples

arnold_cat

Orignal

Arnold_cat - Copy

Encrypted with k= 37

python imcrypt.py arnold_cat --image Arnold_cat.png -k 37

Arnold_cat

Decrypted back

python imcrypt.py arnold_cat_de --image Arnold_cat.png -k 37

Arnold_cat

One time Pad

Orignal

python imcrypt.py 1time_pad_en --image amg.png

amg

Encrypted key & image(doesn't matter what is consider image or key as xor is communatative op)

amg key-amg

Decryted

python imcrypt.py 1time_pad_de -i amg.png -k key-amg.png

amg

AES

Orignal

lab

Encrypted

python imcrypt.py aes_en -i lab.png -p "woof woof"

lab

Decrypted

python imcrypt.py aes_de -i lab.png -p "woof woof"

lab

LSB Stegano with delimiter

Write

car.png

python imcrypt.py stegano_write -i car.png -m "Hello everyone !!"

Read

car

Image with message encoded.


python imcrypt.py stegano_read -i car.png
> Hello everyone !!
  • Download any image and try decrypted them to see the result *

Using the engine class

for other apps that may use image encryption but don't want to use CLI the engine class provides an easy interface to do so. Where methods of i/o may be different. Eg flask backend, tkinter GUI

Example use

engine = Engine()
engine.setImgRead(read_image).setImgWrite(save_img).setLogger(loggingFun)
engine.loadStratergy(stratergy).exe(operation,**kwargs)

Here stratergy can be

  1. ArnoldCat,
  2. OneTimePad,
  3. AES
  4. Stegano

operation can be

  1. encrypt
  2. decrypt

About

image encryption CLI tool supports encryption/decryption through AES, one-time pad, Arnold's cat map and also allows hiding of text through LSB steganography.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages