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 45 46 47 48 49 50 51 52 53 54 55 56
| #-*- coding:utf-8 -*-
import md5
from sys import *
from Tkinter import *
lignes=[]
dicoMots_md5 = {}
def Interface():
fen = Tk()
entree = Entry(fen)
entree.grid(row=0, column = 1)
text=Label(fen, text="Mot")
text.grid(row = 0, column=0)
entree2 = Entry(fen)
entree2.grid(row=0, column = 2)
text2=Label(fen, text="Hash")
text2.grid(row=0, column=3)
Button(fen, text="Commencer", command = Test).grid(row = 1,column=1)
fen.mainloop()
def commencer():
file = open("Mots_md5.txt","r")
ligne = file.readlines()
ligne="".join(ligne)
ligne=ligne.split(" ")
for mot in ligne:
m=md5.new(mot)
m= m.hexdigest()
dicoMots_md5[mot]=m
Interface()
def Test():
entree = entree.get()
entree2 = entree2.get()
if entree == None:
Dhash()
else:
Hash()
def Hash():
entree = str(entree)
m = md5.new(entree)
m = m.hexdigest()
print m
def Dhash():
for i in dicoMots_md5:
m = md5.new(i)
m = hexdigest()
if m == dicoMots_md5.has_key(i):
print i, m
break
commencer() |
Partager