Skip to content

Instantly share code, notes, and snippets.

@gsora
Created March 21, 2012 22:14
Show Gist options
  • Select an option

  • Save gsora/2153733 to your computer and use it in GitHub Desktop.

Select an option

Save gsora/2153733 to your computer and use it in GitHub Desktop.
md5 password check in python
#!/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