-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstego.py
44 lines (34 loc) · 802 Bytes
/
stego.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import cv2
img = cv2.imread("mypic.jpg") # Replace with the correct image path
msg = input("Enter secret message:")
password = input("Enter a passcode:")
d = {}
c = {}
for i in range(255):
d[chr(i)] = i
c[i] = chr(i)
m = 0
n = 0
z = 0
for i in range(len(msg)):
img[n, m, z] = d[msg[i]]
n = n + 1
m = m + 1
z = (z + 1) % 3
cv2.imwrite("encryptedImage.jpg", img)
os.system("start encryptedImage.jpg") # Use 'start' to open the image on Windows
message = ""
n = 0
m = 0
z = 0
pas = input("Enter passcode for Decryption:")
if password == pas:
for i in range(len(msg)):
message = message + c[img[n, m, z]]
n = n + 1
m = m + 1
z = (z + 1) % 3
print("Decryption message:", message)
else:
print("YOU ARE NOT authorized")