I have encoded some user input successfully. But I cannot decode it.
Here is my code:
from PyQt4 import QtGui, QtCore
import sys, os
from PyQt4.Qt import SIGNAL, SLOT, QMainWindow, qApp, QUrl, QImage,\
QStringListModel
import hashlib
import base64
class Dialog_01(QtGui.QMainWindow):
def __init__(self):
super(QtGui.QMainWindow,self).__init__()
myQWidget = QtGui.QWidget()
myBoxLayout = QtGui.QVBoxLayout()
myQWidget.setLayout(myBoxLayout)
self.setCentralWidget(myQWidget)
self.line = QtGui.QLineEdit(self)
self.line.setObjectName("host")
savebutton = QtGui.QPushButton("Print")
savebutton.setMinimumSize(35,30)
savebutton.clicked.connect(self.printtext)
myBoxLayout.addWidget(savebutton)
def printtext(self):
shost = self.line.text()
#shost = "Hello"
#print(self.ComboBox.currentText())
self.md = hashlib.md5()
self.md.update(shost.encode())
str1 = (self.md.hexdigest())
print(str1)
str2 = codecs.decode(s, '5d41402abc4b2a76b9719d911017c592')
print(str2)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
dialog_1 = Dialog_01()
dialog_1.show()
dialog_1.resize(480,320)
sys.exit(app.exec_())
What I want here is to decode the encrypted string (str1
).