I want to execute hash algorithm. So, I made this code. I also imported hashlib. But, in the last line, an error happened:
KeyError: PyQt4.QtCore.QString(u'sha1')
I don't know what the problem is. Here is the code:
def setupUi(self, MainWindow)
self.radioLabel = 'sha256' #default 256
self.combo.currentIndexChanged.connect(self.OnRadiogroup)
def OnRadiogroup(self,radioLabel)
self.radioLabel = radioLabel
self.radioLabel = self.combo.currentText() #get selected hash string
def create_matchkey(self, row, path, key, radioLabel):
hash_function = {"sha1":hashlib.sha1,
"sha224":hashlib.sha224,
"sha256":hashlib.sha256,
"sha512":hashlib.sha512,
"md5":hashlib.md5}
hash_object = hash_function[radioLabel](self.input_str)