# -*- coding: utf-8 -*- import hashlib import random from BF_Constants import * tabChar = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") class Encryption(): def __init__(self): self.passwordNonCrypte = "" self.key = "" self.typeCryptage = "" self.passwordCrypte = "" return None def getRandKey(self, keySize): keyRand = "" i = 0 while i < keySize: keyRand = keyRand + round(randrange(0, len(tabChar)),0) return keyRand def md5(self, string): return hashlib.md5(string.encode('utf-8')).hexdigest() def sha1(self, string): return hashlib.sha1(string.encode('utf-8')).hexdigest() def sha224(self, string): return hashlib.sha224(string.encode('utf-8')).hexdigest() def sha384(self, string): return hashlib.sha384(string.encode('utf-8')).hexdigest() def sha256(self, string): return hashlib.sha256(string.encode('utf-8')).hexdigest() def sha512(self, string): return hashlib.sha512(string.encode('utf-8')).hexdigest() def none(self, string): return string def hashForLambda(self, functionLambda, string): return functionLambda(string) #si le fichier est lancé seul if __name__ == '__main__' : sys.exit()