HOW To
Data Protection With Imcrypt
By Learn Universe Team
Imcrypt is a CLI tool written in JavaScript used to re-shape images by using the key in a certian type of algorithm.
Imcrypt works by you putting in a key from a file and through JavaScript, its generate an image that can not be understood. An image generated by imcrypt looks like this:
In this course, you'll learn how to encrypt and decrypt those images with the key. Which helps in more privacy control.
Install Imcrypt
We can use Imcrypt in two ways:
- By running it virtually: Using npx- A JavaScript library(But we're not actually installing it).
- Using npm- Also a JavaScript library (We&quto;re actually installing it).
For the purpose of this course we will run it virtually to save time.
Pick your iamge and set your key
Now you have to pick your files. We in this course, will use an image called bike.png and our ke will be stored in the file key.txt. You might be wondering why we're using a PNG file why couldn't we use a better image format like JPG. Well, the reason is because, when files are encrypted and decrypted back in JPG with Imcrypt, some pixels are loss and it is not the best options. So that's why we used a PNG format. Anyway, this is the image we will use:
So to encrypt we type this command
root@kali : ~# imcrypt -e <iamge_to_encrypt> -k <location_to_key_file> -i <output_of_iamge>
imcrypt v1.0.1 by theninza
An image encryption node-js cli
✔ Image read successfully
✔ Output image file name is valid
✔ Output key file name is valid
✔ Image data read successfully
✔ Key generated successfully
✔ Image encrypted successfully
✔ Image saved successfully
✔ Key saved successfully
✔ Image encrypted successfully Image encrypted successfully:
Encrypted Image: bike_e.png
Key: bike_key.txt
Give it a star on github: https://github.com/theninza/imcrypt
~ $
If you check, your find out in the output that imcrypt generated another key, this key is required to decrypt the image. Let's take a look at the image.
Just note gat the key is an excessive large combination. If you have iamge of 35 Kilobytes, the key can the 213 Kilobytes.
Decode the Image back
Now we've encrypted the image lets decode it back. But note, the size of the iamge might change after decryption. So this is how to decompile the image:
root@kali : ~# npx imcrypt -d bike_e.png -k bike_key.txt -i <output_of_iamge>
imcrypt v1.0.1 by theninza
An image encryption node-js cli
✔ Image read successfully
✔ Key read successfully
✔ Decryption successful
✔ Image saved successfully
✔ Success Image decrypted successfully
Decrypted Image: bike_d.png
Give it a star on github: https://github.com/theninza/imcrypt
~ $
And this is how it looks now.).
Conculsion
In this course, you learnt how to encrypt your images. This could help when trying to send a secret data to someone and even when intercepted, it can't be view. See you in the next course.