1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use StringIO to feed md5 calculation to prevent unicode issues

Fixes #4014
This commit is contained in:
James Cammarata 2013-09-06 09:11:10 -05:00
parent 2a47f72139
commit 4e9dee6093

View file

@ -393,8 +393,9 @@ def merge_hash(a, b):
def md5s(data): def md5s(data):
''' Return MD5 hex digest of data. ''' ''' Return MD5 hex digest of data. '''
buf = StringIO.StringIO(data)
digest = _md5() digest = _md5()
digest.update(data.encode('utf-8')) digest.update(buf.read())
return digest.hexdigest() return digest.hexdigest()
def md5(filename): def md5(filename):