You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rizzlehash/cryptPassV1.py

39 lines
1.3 KiB

# -*- coding: utf-8 -*-
import hashlib
import random
import sys
tabChar = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
class CryptPass():
def __init__(self):
self.passwordNonCrypte = ""
self.key = ""
self.typeCryptage = ""
self.passwordCrypte = ""
return None
def getHash(self, passwordNonCrypteWithKey, typeCryptage):
self.passwordCrypte = ""
passwordNonCrypteWithKey = passwordNonCrypteWithKey.encode()
if typeCryptage == "md5":
passwordCrypte = hashlib.md5(passwordNonCrypteWithKey).hexdigest()
elif typeCryptage == "sha1":
passwordCrypte = hashlib.sha1(passwordNonCrypteWithKey).hexdigest()
elif typeCryptage == "sha224":
passwordCrypte = hashlib.sha224(passwordNonCrypteWithKey).hexdigest()
elif typeCryptage == "sha256":
passwordCrypte = hashlib.sha256(passwordNonCrypteWithKey).hexdigest()
elif typeCryptage == "sha384":
passwordCrypte = hashlib.sha384(passwordNonCrypteWithKey).hexdigest()
elif typeCryptage == "sha512":
passwordCrypte = hashlib.sha512(passwordNonCrypteWithKey).hexdigest()
self.passwordCrypte = passwordCrypte
return self.passwordCrypte
#si le fichier est lancé seul
if __name__ == '__main__' :
app = CryptPass()
print(app.getHash(sys.argv[1],"md5"))
sys.exit()