Last active
February 7, 2019 16:52
-
-
Save themonti/789edcd4e9b41e2db023b74fc800abd0 to your computer and use it in GitHub Desktop.
check symfony2 password with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib,base64 | |
def checkPass(password,salt): | |
salted=(password+'{'+salt+'}').encode('utf-8') | |
if not salt: | |
salted=password.encode('utf-8') | |
m=hashlib.sha512() | |
m.update(salted) | |
digest=m.digest() | |
for i in range(4999): | |
m=hashlib.sha512() | |
m.update(digest+salted) | |
digest=m.digest() | |
return base64.b64encode(digest).decode('utf-8') | |
print (checkPass('password123','salt1223')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment