1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 00:40:11 +01:00

publish: fix hashing of strings

This commit is contained in:
Daniel Martí 2016-01-04 18:46:51 +01:00
parent a78341d8e5
commit b31e20ee8b

View File

@ -91,7 +91,7 @@ def main():
allaliases = [] allaliases = []
for appid in allapps: for appid in allapps:
m = hashlib.md5() m = hashlib.md5()
m.update(appid) m.update(appid.encode('utf-8'))
keyalias = m.hexdigest()[:8] keyalias = m.hexdigest()[:8]
if keyalias in allaliases: if keyalias in allaliases:
logging.error("There is a keyalias collision - publishing halted") logging.error("There is a keyalias collision - publishing halted")
@ -156,11 +156,11 @@ def main():
keyalias = config['keyaliases'][appid] keyalias = config['keyaliases'][appid]
if keyalias.startswith('@'): if keyalias.startswith('@'):
m = hashlib.md5() m = hashlib.md5()
m.update(keyalias[1:]) m.update(keyalias[1:].encode('utf-8'))
keyalias = m.hexdigest()[:8] keyalias = m.hexdigest()[:8]
else: else:
m = hashlib.md5() m = hashlib.md5()
m.update(appid) m.update(appid.encode('utf-8'))
keyalias = m.hexdigest()[:8] keyalias = m.hexdigest()[:8]
logging.info("Key alias: " + keyalias) logging.info("Key alias: " + keyalias)