bug 1593883 fix - switch from qmd5_hash to md5_hash

This commit is contained in:
Ken Roberts 2016-06-17 16:48:32 -07:00
parent aaba690c97
commit d1ff2385ae
2 changed files with 8 additions and 8 deletions

View File

@ -206,9 +206,9 @@ def md5_hash(salt, data=None):
"""
log.debug('md5_hash(salt="{text}")'.format(text=salt))
hash_obj = hashlib.new('md5')
hash_obj.update(salt)
hash_obj.update(salt.encode('ascii'))
if data:
hash_obj.update(data)
hash_obj.update(data.encode('ascii'))
hash_value = hash_obj.hexdigest()
log.debug('md5_hash() returning "{text}"'.format(text=hash_value))
return hash_value
@ -225,11 +225,11 @@ def qmd5_hash(salt, data=None):
"""
log.debug('qmd5_hash(salt="{text}"'.format(text=salt))
hash_obj = QHash(QHash.Md5)
hash_obj.addData(salt)
hash_obj.addData(data)
hash_obj.addData(salt.encode('ascii'))
hash_obj.addData(data.encode('ascii'))
hash_value = hash_obj.result().toHex()
log.debug('qmd5_hash() returning "{text}"'.format(text=hash_value))
return hash_value.data()
log.debug('qmd5_hash() returning "{hash}"'.format(hash=hash_value))
return hash_value
def clean_button_text(button_text):

View File

@ -49,7 +49,7 @@ from codecs import decode
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtNetwork import QAbstractSocket, QTcpSocket
from openlp.core.common import translate, qmd5_hash
from openlp.core.common import translate, md5_hash
from openlp.core.lib.projector.constants import *
# Shortcuts
@ -362,7 +362,7 @@ class PJLink1(QTcpSocket):
else:
log.debug('({ip}) Setting hash with salt="{data}"'.format(ip=self.ip, data=data_check[2]))
log.debug('({ip}) pin="{data}"'.format(ip=self.ip, data=self.pin))
salt = qmd5_hash(salt=data_check[2].encode('ascii'), data=self.pin.encode('ascii')).encode('utf-8')
salt = md5_hash(salt=data_check[2], data=self.pin)
else:
salt = None
# We're connected at this point, so go ahead and do regular I/O