开发者

Please recommend some Python hashing algorithms [closed]

开发者 https://www.devze.com 2023-01-18 16:35 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 1开发者_如何转开发2 years ago.

I'm doing a password hashing program in python. I need to make my hashing dynamic, i.e. each time I need to get different hashed code. I am using md5 library.


The information that you want can be found in Python's hashlib module. From the documentation:

This module implements a common interface to many different secure hash and message digest algorithms. Included are the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 (defined in FIPS 180-2) as well as RSA’s MD5 algorithm (defined in Internet RFC 1321). The terms secure hash and message digest are interchangeable. Older algorithms were called message digests. The modern term is secure hash.


You can use salt for that.

import hashlib
string = "password"
strsalt = "anyrandomvalue" #this can be generated.. etc.
hashlib.md5(string + strsalt).hexdigest()
0

精彩评论

暂无评论...
验证码 换一张
取 消