I want to hash my password many times but it's hard to repeat codes many times depends on exponent.
So, for example in this code for exponent 2 and base 3:
3**2= 9
So I need to hash my password nine times!
I scanned all the web to find any code for help in Python but all found in C language.
Is there an easy way to hash my password many times in Python with hashlib.sha356
not pbkdf2_hmac
?
Here is code for example:
Hello World!
Result:
c079473ced8ca65d5ce59cabf451ab7a513db97ab4d2266b9cb0c4d13383fb81
from hashlib import sha256
pw = input('Enter Password: ')
h1 = sha256(pw.encode('utf-8')).digest()
h2 = sha256(h1).digest()
h3 = sha256(h2).digest()
h4 = sha256(h3).digest()
h5 = sha256(h4).digest()
h6 = sha256(h5).digest()
h7 = sha256(h6).digest()
h8 = sha256(h7).digest()
h9 = sha256(h8).hexdigest()
print(h9)
from hashlib import sha256
pw = input('Enter Password: ')
h = sha256(pw.encode('utf-8')).digest()
N = 10
for i in range(N):
if i != N-1:
h = sha256(h).digest()
else:
h = sha256(h).hexdigest()
print(h)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.