def test_buffer(self): import _hashlib, array b = array.array('b', 'x' * 10) h = _hashlib.new('md5', b) h.update(b) assert h.digest() == _hashlib.openssl_md5('x' * 20).digest() _hashlib.openssl_sha1(b).digest()
def getHash(self, string, type): if type == "SHA512": return _hashlib.openssl_sha512(string.encode()).hexdigest() elif type == "SHA256": return _hashlib.openssl_sha256(string.encode()).hexdigest() elif type == "SHA1": return _hashlib.openssl_sha1(string.encode()).hexdigest() elif type == "SHA224": return _hashlib.openssl_sha224(string.encode()).hexdigest() elif type == "MD5": return _hashlib.openssl_md5(string.encode()).hexdigest() elif type == "SHA384": return _hashlib.openssl_sha384(string.encode()).hexdigest()
def hash(): hash = '9D08FD0EE2B2CD5A5CCCB97DE9613E7D9ED894D6' salt = 'nO' alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+-=' Time = time.time() res = itertools.product(alpha, repeat=6) print ("starting brute") for i in res: h = _hashlib.openssl_sha1() word = ''.join(i) h.update(salt + word) if h.hexdigest() == hash: print ('word: ',word) print('time it took:', time.time()-Time) return print ("no word") return
def hash(): hash = '9D08FD0EE2B2CD5A5CCCB97DE9613E7D9ED894D6' salt = 'nO' alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+-=' Time = time.time() res = itertools.product(alpha, repeat=6) print("starting brute") for i in res: h = _hashlib.openssl_sha1() word = ''.join(i) h.update(salt + word) if h.hexdigest() == hash: print('word: ', word) print('time it took:', time.time() - Time) return print("no word") return
def hash(): hash = 'CC9E6E4C4CDCAE06C669BDA492981B00929D9AF8' salt = 'hz' f = open('hashes.txt', 'w') Time = time.time() for i in range(0, 9999): h = _hashlib.openssl_sha1() number = str(i).zfill(4) h.update(salt + number) result = h.hexdigest() f.write(result.upper()) f.write('\n') if hash == result.upper(): print('pin: ', i) f.close() print('time it took:', time.time() - Time) return f.close() print('cant find pin') return
def hash(): hash = 'CC9E6E4C4CDCAE06C669BDA492981B00929D9AF8' salt = 'hz' f = open('hashes.txt', 'w') Time = time.time() for i in range(0, 9999): h = _hashlib.openssl_sha1() number = str(i).zfill(4) h.update(salt+number) result = h.hexdigest() f.write(result.upper()) f.write('\n') if hash == result.upper(): print('pin: ', i) f.close() print('time it took:', time.time()-Time) return f.close() print ('cant find pin') return
def hex_hash(self, str): return _hashlib.openssl_sha1(str.encode('utf-8')).hexdigest()