import hashlib obj = hashlib.md5(bytes('adfasfasdfsfasf',encoding = 'utf-8')) obj.update(bytes('123',encoding='utf-8')) result = obj.hexdigest() print(result)