infinity = 1000000000
+M=18532395500947174450709383384936679868383424444311405679463280782405796233163977*39688644836832882526173831577536117815818454437810437210221644553381995813014959
+# M clef
+X=18532395500947174450709383384936679868383424444311
+# X clef
+
+
def compute_filter_canny(level,image,MsgLen):
bbs = BlumBlumShub();
- bbs.setN(18532395500947174450709383384936679868383424444311405679463280782405796233163977*39688644836832882526173831577536117815818454437810437210221644553381995813014959)
- bbs.setSeed(18532395500947174450709383384936679868383424444311)
+ bbs.setN(M)
+ bbs.setSeed(X)
level2=level.copy()
level2= array(level2.getdata()).flatten()
def mystego(filein, fileout):
+
+ bbs = BlumBlumShub();
+ bbs.setN(M)
+ bbs.setSeed(X)
+
+
+
dd = im.open(filein)
dd = dd.convert('RGB')
red, green, blue = dd.split()
message="Salut christophe, arrives tu à lire ce message? normalement tu dois lire cela. Bon voici un test avec un message un peu plus long. Bon j'en rajoute pour voir. Ce que j'écris est très original... Bref, je suis un poete Salut christophe, arrives tu à lire ce message? normalement tu dois lire cela."
+ """
+ message = ""
+ for c in [x if x==0 else 1 for x in im.open("invader.png").getdata()]:
+ message +=str(c)
+
+ print message
+ """
- message=message[0:len(message)/1]
leng_msg=len(message)
- message=message+((leng_msg+7)/8*8-leng_msg)*" "
- leng_msg=len(message)
-
- leng='%08d'%len(message)
-
-
-
-
- len_leng=len(leng)
- leng_error=int(len_leng)
- leng_cor=leng
- List_pack=a2b_list(leng_cor)
-
-
-
-
-
- [List_bit_to_change,Weight]=compute_filter_canny(level,dd,leng_msg)
- level= array(level.getdata()).flatten()
-
-
- bit_to_read=1
-
-
-
-
- M=18532395500947174450709383384936679868383424444311405679463280782405796233163977*39688644836832882526173831577536117815818454437810437210221644553381995813014959
- # M clef
- X=18532395500947174450709383384936679868383424444311
- # X clef
-
-
-
-
l=0
List_random=[]
while len(List_random)<len(List_bit_to_change):
- X=(X*X)%M
- List_random.extend(Denary2Binary(X))
+ List_random.extend(Denary2Binary(bbs.next()))
size=0
for i in range(leng_msg/8):
red2, green, blue = dd2.split()
level2=red2.copy()
- [List_bit_to_change2,Weight2]=compute_filter_canny(level2,dd2,len(Message))
+ [List_bit_to_change2,Weight2]=compute_filter_canny(level2,dd2,leng_msg)
level2= array(level2.getdata()).flatten()
print "weight2",len(Weight2)
alpha = float(len(List_bit_to_change2))/len(Message)
- print alpha
assert alpha >= 2
index = min(int(alpha),9)
H_hat2 = {