码迷,mamicode.com
首页 > 编程语言 > 详细

Security and Cryptography in Python - Hash Functions(3)

时间:2021-03-03 12:13:31      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:class   enc   pre   http   html   org   ase   result   word   

Security and Cryptography in Python - Hash Functions(3)

How password are Verified

https://docs.python.org/3/library/hashlib.html

https://en.wikipedia.org/wiki/PBKDF2

import hashlib
import base64

iterations = 45454
salt = base64.b64decode("6VuJKkHVTdDelbNMPBxzw7INW2NkYlR/LoW40L7kVAI=".encode())
#SALTED-SHA512-PBKDF2

password = "password".encode()

value = hashlib.pbkdf2_hmac("sha512", password, salt, iterations, dklen=128)
print(base64.b64encode(value))

Running Result:

技术图片

Security and Cryptography in Python - Hash Functions(3)

标签:class   enc   pre   http   html   org   ase   result   word   

原文地址:https://www.cnblogs.com/keepmoving1113/p/14471154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!