has12zen commited on
Commit
10ce6b2
1 Parent(s): de48b2d

final fantasy

Browse files
Files changed (2) hide show
  1. __pycache__/utils2.cpython-39.pyc +0 -0
  2. utils2.py +48 -8
__pycache__/utils2.cpython-39.pyc CHANGED
Binary files a/__pycache__/utils2.cpython-39.pyc and b/__pycache__/utils2.cpython-39.pyc differ
 
utils2.py CHANGED
@@ -81,8 +81,29 @@ def encrypt(text,key, image):
81
  skips = 0;
82
  new_pixels = []
83
  for rgb in pixels:
84
- tcr = []
85
- for clr in rgb:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  if skips == 0:
87
  skips+=iterateSecret(binary_secret)
88
  gidxlog1+=[gidx]
@@ -91,16 +112,15 @@ def encrypt(text,key, image):
91
  arr1+=[skips]
92
  if i < len(binary_msg):
93
  if binary_msg[i]=='0':
94
- if clr%2!=0:
95
- clr-=1
96
  else:
97
  if clr%2==0:
98
- clr+=1
99
  i+=1
100
  else:
101
  skips-=1;
102
- tcr+=[clr]
103
- new_pixels += [tuple(tcr)]
104
  new_image = Image.new(image.mode, image.size)
105
  new_image.putdata(new_pixels)
106
  return new_image
@@ -121,7 +141,27 @@ def decrypt(key,image):
121
  binary_msg = ""
122
  flag =0
123
  for rgb in pixels:
124
- for clr in rgb:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  if skips ==0:
126
  cnt = clr%2;
127
  if cnt ==1:
 
81
  skips = 0;
82
  new_pixels = []
83
  for rgb in pixels:
84
+ if type(rgb) == tuple:
85
+ tcr = []
86
+ for clr in rgb:
87
+ if skips == 0:
88
+ skips+=iterateSecret(binary_secret)
89
+ gidxlog1+=[gidx]
90
+ base_log1+=[p_base]
91
+ msglog1+=[binary_secret[gidx]]
92
+ arr1+=[skips]
93
+ if i < len(binary_msg):
94
+ if binary_msg[i]=='0':
95
+ if clr%2!=0:
96
+ clr-=1
97
+ else:
98
+ if clr%2==0:
99
+ clr+=1
100
+ i+=1
101
+ else:
102
+ skips-=1;
103
+ tcr+=[clr]
104
+ new_pixels += [tuple(tcr)]
105
+ elif type(rgb) == int:
106
+ clr = rgb
107
  if skips == 0:
108
  skips+=iterateSecret(binary_secret)
109
  gidxlog1+=[gidx]
 
112
  arr1+=[skips]
113
  if i < len(binary_msg):
114
  if binary_msg[i]=='0':
115
+ if clr%2!=0:
116
+ clr-=1
117
  else:
118
  if clr%2==0:
119
+ clr+=1
120
  i+=1
121
  else:
122
  skips-=1;
123
+ new_pixels+=[clr]
 
124
  new_image = Image.new(image.mode, image.size)
125
  new_image.putdata(new_pixels)
126
  return new_image
 
141
  binary_msg = ""
142
  flag =0
143
  for rgb in pixels:
144
+ if type(rgb) == tuple:
145
+ for clr in rgb:
146
+ if skips ==0:
147
+ cnt = clr%2;
148
+ if cnt ==1:
149
+ ones+=1;
150
+ else:
151
+ ones=0;
152
+ binary_msg += str(cnt);
153
+ if ones ==8:
154
+ flag =1;
155
+ break
156
+ skips+=iterateSecret(binary_secret)
157
+ gidxlog2+=[gidx]
158
+ base_log2+=[p_base]
159
+ msglog2+=[binary_secret[gidx]]
160
+ arr2+=[skips]
161
+ else:
162
+ skips-=1
163
+ elif type(rgb) == int:
164
+ clr = rgb
165
  if skips ==0:
166
  cnt = clr%2;
167
  if cnt ==1: