diff --git a/README.md b/README.md
index 31939db7..a4c7336e 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,6 @@
-
-
## How to Contribute 🤔
@@ -58,6 +56,7 @@ before making a Pull Request
- Help us to improve script. Report a bug [here](https://github.com/Py-Contributors/awesomeScripts/issues/new?assignees=codePerfectPlus&labels=bug&template=bug_report.md&title=)
## 🤝 Scripts and contributorss 🤝
+
@@ -361,6 +360,11 @@ before making a Pull Request
shubham5351 |
Hangman is a classic word game in which you must guess words and you have given 7 chance for it. |
+
+| simple-image-encryptor |
+mohzulfikar |
+Simply encrypt your image using xor operation |
+
diff --git a/simple-image-encryptor/README.md b/simple-image-encryptor/README.md
new file mode 100644
index 00000000..1d0a7eef
--- /dev/null
+++ b/simple-image-encryptor/README.md
@@ -0,0 +1,16 @@
+# Simple XOR Image encryptor
+
+## Features
+
+0. encrypt and decrypt image with xor bitwise operation
+1. 2 modes of operation, enc and dec
+
+## Usage
+
+You can run it by typing
+
+```
+python script.py
+```
+
+After that, you can enter path to your image you want to encrypt/decrypt, and then select mode of operation.
diff --git a/simple-image-encryptor/example/key.png b/simple-image-encryptor/example/key.png
new file mode 100644
index 00000000..dd57958a
Binary files /dev/null and b/simple-image-encryptor/example/key.png differ
diff --git a/simple-image-encryptor/example/message_enc.png b/simple-image-encryptor/example/message_enc.png
new file mode 100644
index 00000000..9409a999
Binary files /dev/null and b/simple-image-encryptor/example/message_enc.png differ
diff --git a/simple-image-encryptor/example/plainpict.png b/simple-image-encryptor/example/plainpict.png
new file mode 100644
index 00000000..ba006167
Binary files /dev/null and b/simple-image-encryptor/example/plainpict.png differ
diff --git a/simple-image-encryptor/generator.py b/simple-image-encryptor/generator.py
new file mode 100644
index 00000000..0b78b597
--- /dev/null
+++ b/simple-image-encryptor/generator.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# python 3.8.5
+
+import numpy
+from PIL import Image
+
+
+def genImage(img_width=512, img_height=256):
+ # Define img width and height as an integer
+ img_width = int(img_width)
+ img_height = int(img_height)
+
+ # Define key name
+ filename = 'key.png'
+ img_array = numpy.random.rand(img_height, img_width, 3) * 255
+ '''
+ Make image object from array, if u want to get
+ grayscale key, use "L" on convert method.
+ '''
+ image = Image.fromarray(img_array.astype('uint8')).convert('RGB')
+
+ # Save image
+ image.save(filename)
diff --git a/simple-image-encryptor/requirements.txt b/simple-image-encryptor/requirements.txt
new file mode 100644
index 00000000..81fe79ce
--- /dev/null
+++ b/simple-image-encryptor/requirements.txt
@@ -0,0 +1,3 @@
+opencv-python>=4.4.0
+numpy>=1.19.1
+Pillow>=7.2.0
\ No newline at end of file
diff --git a/simple-image-encryptor/script.py b/simple-image-encryptor/script.py
new file mode 100644
index 00000000..8221d22d
--- /dev/null
+++ b/simple-image-encryptor/script.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# python 3.8.5
+
+from cv2 import imread, imwrite, bitwise_xor
+from generator import genImage
+
+
+def xor_cipher(image, key):
+ # simple xor cipher
+ return bitwise_xor(image, key)
+
+
+def encrypt(image):
+ # generate image for the key
+ genImage()
+ key = imread("key.png")
+ # run xor cipher to encrypt image with the key
+ encrypted = xor_cipher(image, key)
+ # write the image to a file
+ imwrite('message_enc.png', encrypted)
+
+
+def decrypt(image):
+ # read the key
+ key = imread("key.png")
+ # run xor cipher to decrypt image with the key
+ decrypted = xor_cipher(image, key)
+ # write the image to a file
+ imwrite('message.png', decrypted)
+
+
+def main():
+ # read the message
+ msg_path = input(">>> Path to your image: ")
+ message = imread(msg_path)
+
+ # select mode
+ mode = input(">>> Enter mode (enc: encrypt, dec: decrypt): ")
+ # Conditional to check if user wants to
+ # encrypt or decrypt the image
+ if (mode == "enc"):
+ encrypt(message)
+ elif (mode == "dec"):
+ decrypt(message)
+
+
+if __name__ == '__main__':
+ import sys
+ status = main()
+ sys.exit(status)