Created
March 21, 2012 22:14
-
-
Save gsora/2153733 to your computer and use it in GitHub Desktop.
md5 password check in python
This file contains hidden or 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
| #!/usr/bin/python2 | |
| #-*- coding:utf-8 -*- | |
| ########## createdy by Gianguido | |
| ########## gianguidorama at gmail dot com | |
| ########## @PeppeLaKappa on Twitter | |
| import commands | |
| import hashlib | |
| #Facoltativo: questo è codice di test, ovviamente la password non sarà salvata in chiaro all'interno dello script stesso | |
| storedpass = "1a014896e43c48e40cc039d54c7cb24f" | |
| ################################################ | |
| #chiedo la password all'utente | |
| password = raw_input('Password? ') | |
| #implementazione di hashlib, più o meno corretta ma almeno funziona! | |
| h = hashlib.md5('md5') | |
| h.update(password) | |
| passtotest = h.hexdigest() | |
| ######################## | |
| # check statement | |
| if storedpass == inspass: | |
| print 'Password giusta!' | |
| else: | |
| print 'Password errata!' | |
| exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment