Пример #1
0
 def test_updates(self):
     a = sha3.SHA3224()
     a.update('\x21')
     a.update('\xf1\x34')
     a.update('\xac\x57')
     assert a.hexdigest(
     ) == '5573da2b02216a860389a581f6e9fb8d805e9e02f6fa911701eee298'
Пример #2
0
 def test_copy(self):
     a = sha3.SHA3224()
     a.update('foo')
     b = a.copy()
     assert a.digest() == b.digest()
     b.update('bar')
     assert a.digest() != b.digest()
Пример #3
0
def plugin_sha3_digesters(include_CRCs=False):
    import sha3  # @UnresolvedImport

    known_digesters['SHA3_224'] = (sha3.SHA3224(),
                                   lambda d: d.hexdigest().decode("utf-8"))
    known_digesters['SHA3_256'] = (sha3.SHA3256(),
                                   lambda d: d.hexdigest().decode("utf-8"))
    known_digesters['SHA3_384'] = (sha3.SHA3384(),
                                   lambda d: d.hexdigest().decode("utf-8"))
    known_digesters['SHA3_512'] = (sha3.SHA3512(),
                                   lambda d: d.hexdigest().decode("utf-8"))
Пример #4
0
 def test_empty_sha3224(self):
     a = sha3.SHA3224()
     assert a.hexdigest(
     ) == 'f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd'
Пример #5
0
 def test_update(self):
     a = sha3.SHA3224()
     a.update('\xcc')
     assert a.hexdigest(
     ) == 'a9cab59eb40a10b246290f2d6086e32e3689faf1d26b470c899f2802'
Пример #6
0
 def test_constructor(self):
     a = sha3.SHA3224('\xcc')
     assert a.hexdigest(
     ) == 'a9cab59eb40a10b246290f2d6086e32e3689faf1d26b470c899f2802'
Пример #7
0
 def test_name(self):
     a = sha3.SHA3224()
     assert a.name == 'sha3-224'
Пример #8
0
 def test_digest_size(self):
     a = sha3.SHA3224()
     assert len(a.digest()) == a.digest_size
Пример #9
0
#ascii_all = digits
#ascii_all = ascii_uppercase[:14]

found = False
nchar = 14
for i in range(len(ascii_all)):	
	if found:
		break
	print("Elements for permutation " + str(i + 1))
	permut = permutations(ascii_all, i + 1)
	permut = list(map("".join, permut))
	print("Number of permutations: " + str(len(permut)))
	for x in permut:
		in_str = "ZHAO0046"
		in_str = in_str + x
		m = sha3.SHA3224()
		m.update(in_str)
		hex_hash = m.hexdigest()
		hex_hash = hex_hash[0:nchar]	
		#print(in_str)
		#print(hex_hash)
		if hex_hash in dict:
			print in_str
			print hex_hash
			print dict[hex_hash]
			found = True
			break
		dict[hex_hash] = in_str
		in_str = "ZHAO0046"

print("Finished")
Пример #10
0
 def test_empty_sha3224(self):
     a = sha3.SHA3224()
     assert a.hexdigest(
     ) == b'6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7'
Пример #11
0
 def test_constructor(self):
     a = sha3.SHA3224('')
     self.assertEquals(
         a.hexdigest(),
         b'6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7')