#!/usr/bin/python3.4 # -*- coding: utf-8 -*- # Copyright © 2015 Matthieu DUVAL, Rudy DUCHE # This file is part of RizzleHash. # RizzleHash is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # RizzleHash is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with RizzleHash. If not, see 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()