python hmac加密

import hashlib
import hmac
def get_base64_hashed(password, salt, iterations, dklen=0, digest=None):
    gotten = pbkdf2(password, salt, iterations, dklen=0, digest=None)
    gotten = base64.b64encode(gotten).decode('ascii').strip()
    return gotten
iter = 10000
salt = "2oSso7OkArZM"
mima=get_base64_hashed('12345678', salt, iter, hashlib.sha256)

输出结果如下:

nlISZoI7D7LEN4G/tnhT7mzmb/0SNlMJf54pDigtrRU=

具体可查看:https://github.com/xros/py_django_crack

 

你可能感兴趣的:(技术积累)