still support for python2.5

This commit is contained in:
Michele Comitini
2013-09-24 20:01:51 +02:00
parent 18cdade705
commit 9f69b9aa42

View File

@@ -182,7 +182,13 @@ if __name__ == '__main__':
except:
pass
import platform
if platform.python_version_tuple() < ('3', '0', '0'):
def bytes(*args):
return str(args[0])
for h in [hashlib.sha1, hashlib.sha224, hashlib.sha256,
hashlib.sha384, hashlib.sha512]:
print(binascii.hexlify(pkcs5_pbkdf2_hmac(b'secret' * 11, b'salt',
print(binascii.hexlify(pkcs5_pbkdf2_hmac(bytes('secret', 'utf-8') * 11,
bytes('salt', 'utf-8'),
hashfunc=h)))