def get_tests(config={}): from Crypto.Hash import MD4 from common import make_hash_tests return make_hash_tests(MD4, "MD4", test_data, digest_size=16, oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x04")
def get_tests(config={}): from Crypto.Hash import SHA224 from common import make_hash_tests return make_hash_tests(SHA224, "SHA224", test_data, digest_size=28, oid='\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04')
def get_tests(config={}): from Crypto.Hash import RIPEMD from common import make_hash_tests return make_hash_tests(RIPEMD, "RIPEMD", test_data, digest_size=20, oid="\x06\x05\x2b\x24\x03\02\x01")
def get_tests(config={}): from Crypto.Hash import SHA384 from common import make_hash_tests return make_hash_tests(SHA384, "SHA384", test_data, digest_size=48, oid='\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02')
def get_tests(config={}): from Cryptodome.Hash import SHA1 from common import make_hash_tests tests = [] test_vectors = load_tests(("Cryptodome", "SelfTest", "Hash", "test_vectors", "SHA1"), "SHA1ShortMsg.rsp", "KAT SHA-1", { "len" : lambda x: int(x) } ) test_data = test_data_various[:] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b("") test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="1.3.14.3.2.26") return tests
def get_tests(config={}): from Crypto.Hash import SHA512 from common import make_hash_tests return make_hash_tests(SHA512, "SHA512", test_data, digest_size=64, oid="\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03")
def get_tests(config={}): from Crypto.Hash import SHA from common import make_hash_tests return make_hash_tests(SHA, "SHA", test_data, digest_size=20, oid="\x06\x05\x2B\x0E\x03\x02\x1A")
def get_tests(config={}): # Test vectors from FIPS PUB 180-2 # This is a list of (expected_result, input[, description]) tuples. test_data = [ # FIPS PUB 180-2, B.1 - "One-Block Message" ('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', 'abc'), # FIPS PUB 180-2, B.2 - "Multi-Block Message" ('248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'), # FIPS PUB 180-2, B.3 - "Long Message" ('cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0', 'a' * 10**6, '"a" * 10**6'), # Test for an old PyCrypto bug. ('f7fd017a3c721ce7ff03f3552c0813adcc48b7f33f07e5e2ba71e23ea393d103', 'This message is precisely 55 bytes long, to test a bug.', 'Length = 55 (mod 64)'), ] from Crypto.Hash import SHA256 from common import make_hash_tests tests = make_hash_tests(SHA256, "SHA256", test_data) if config.get('slow_tests'): tests += [LargeSHA256Test()] return tests
def get_tests(config={}): from Crypto.Hash import SHA1 from common import make_hash_tests tests = [] test_vectors = load_tests(("Crypto", "SelfTest", "Hash", "test_vectors", "SHA1"), "SHA1ShortMsg.rsp", "KAT SHA-1", { "len" : lambda x: int(x) } ) test_data = test_data_various[:] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b("") test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="1.3.14.3.2.26") return tests
def get_tests(config={}): from Cryptodome.Hash import SHA224 from common import make_hash_tests return make_hash_tests(SHA224, "SHA224", test_data, digest_size=28, oid='2.16.840.1.101.3.4.2.4')
def get_tests(config={}): from Crypto.Hash import SHA3_224 from common import make_hash_tests test_data = load_tests("ShortMsgKAT_SHA3-224.txt") return make_hash_tests(SHA3_224, "SHA3_224", test_data, digest_size=SHA3_224.digest_size, oid="2.16.840.1.101.3.4.2.7")
def get_tests(config={}): from Crypto.Hash import SHA1 from common import make_hash_tests return make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="1.3.14.3.2.26")
def get_tests(config={}): from Cryptodome.Hash import MD4 from common import make_hash_tests return make_hash_tests(MD4, "MD4", test_data, digest_size=16, oid="1.2.840.113549.2.4")
def get_tests(config={}): from Crypto.Hash import RIPEMD160 from common import make_hash_tests return make_hash_tests(RIPEMD160, "RIPEMD160", test_data, digest_size=20, oid="1.3.36.3.2.1")
def get_tests(config={}): from Crypto.Hash import SHA3_256 from common import make_hash_tests test_data = load_tests("ShortMsgKAT_SHA3-256.txt") return make_hash_tests(SHA3_256, "SHA3_256", test_data, digest_size=SHA3_256.digest_size, oid="2.16.840.1.101.3.4.2.8")
def get_tests(config={}): from Crypto.Hash import SHA384 from common import make_hash_tests return make_hash_tests(SHA384, "SHA384", test_data, digest_size=48, oid='2.16.840.1.101.3.4.2.2')
def get_tests(config={}): from Crypto.Hash import SHA512 from common import make_hash_tests return make_hash_tests(SHA512, "SHA512", test_data, digest_size=64, oid="2.16.840.1.101.3.4.2.3")
def get_tests(config={}): from Crypto.Hash import SHA1 from common import make_hash_tests return make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="\x06\x05\x2B\x0E\x03\x02\x1A")
def get_tests(config={}): from common import make_hash_tests tests = make_hash_tests(MD5, "MD5", test_data, digest_size=16, oid="1.2.840.113549.2.5") if config.get('slow_tests'): tests += [ Md5IterTest() ] return tests
def get_tests(config={}): from common import make_hash_tests tests = [] test_data = load_tests("SHA3", "ShortMsgKAT_SHA3-512.txt") tests += make_hash_tests(SHA3, "SHA3_512", test_data, digest_size=SHA3.digest_size, oid="2.16.840.1.101.3.4.2.10") tests += list_test_cases(APITest) return tests
def get_tests(config={}): from common import make_hash_tests tests = [] test_vectors = load_tests(("Cryptodome", "SelfTest", "Hash", "test_vectors", "SHA3"), "ShortMsgKAT_SHA3-384.txt", "KAT SHA-3 384", { "len" : lambda x: int(x) } ) test_data = [] for tv in test_vectors: if tv.len == 0: tv.msg = b("") test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests += make_hash_tests(SHA3, "SHA3_384", test_data, digest_size=SHA3.digest_size, oid="2.16.840.1.101.3.4.2.9") tests += list_test_cases(APITest) return tests
def get_tests(config={}): from common import make_hash_tests tests = [] test_vectors = load_tests(("Cryptodome", "SelfTest", "Hash", "test_vectors", "SHA3"), "ShortMsgKAT_SHA3-512.txt", "KAT SHA-3 512", { "len" : lambda x: int(x) } ) test_data = [] for tv in test_vectors: if tv.len == 0: tv.msg = b("") test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests += make_hash_tests(SHA3, "SHA3_512", test_data, digest_size=SHA3.digest_size, oid="2.16.840.1.101.3.4.2.10") tests += list_test_cases(APITest) return tests
def get_tests(config={}): # Test vectors from FIPS PUB 180-2 # This is a list of (expected_result, input[, description]) tuples. test_data = [ # FIPS PUB 180-2, B.1 - "One-Block Message" ('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', 'abc'), # FIPS PUB 180-2, B.2 - "Multi-Block Message" ('248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'), # FIPS PUB 180-2, B.3 - "Long Message" ('cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0', 'a' * 10 ** 6, '"a" * 10**6'), # Test for an old PyCrypto bug. ('f7fd017a3c721ce7ff03f3552c0813adcc48b7f33f07e5e2ba71e23ea393d103', 'This message is precisely 55 bytes long, to test a bug.', 'Length = 55 (mod 64)'), # Example from http://de.wikipedia.org/wiki/Secure_Hash_Algorithm ('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', ''), ('d32b568cd1b96d459e7291ebf4b25d007f275c9f13149beeb782fac0716613f8', 'Franz jagt im komplett verwahrlosten Taxi quer durch Bayern'), ] from Crypto.Hash import SHA256 from common import make_hash_tests tests = make_hash_tests(SHA256, "SHA256", test_data, digest_size=32, oid="\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01") if config.get('slow_tests'): tests += [LargeSHA256Test()] return tests
def get_tests_SHA512(): test_vectors = load_tests(("Cryptodome", "SelfTest", "Hash", "test_vectors", "SHA2"), "SHA512ShortMsg.rsp", "KAT SHA-512", { "len" : lambda x: int(x) } ) test_data = test_data_512_other[:] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b"" test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA512, "SHA512", test_data, digest_size=64, oid="2.16.840.1.101.3.4.2.3") return tests
def get_tests_SHA512_224(): test_vectors = load_tests(("Cryptodome", "SelfTest", "Hash", "test_vectors", "SHA2"), "SHA512_224ShortMsg.rsp", "KAT SHA-512/224", { "len" : lambda x: int(x) } ) test_data = [] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b"" test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA512, "SHA512/224", test_data, digest_size=28, oid="2.16.840.1.101.3.4.2.5", extra_params={ "truncate" : "224" }) return tests
def get_tests_SHA512(): test_vectors = load_tests( ("Crypto", "SelfTest", "Hash", "test_vectors", "SHA2"), "SHA512ShortMsg.rsp", "KAT SHA-512", {"len": lambda x: int(x)}) test_data = test_data_512_other[:] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b"" test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA512, "SHA512", test_data, digest_size=64, oid="2.16.840.1.101.3.4.2.3") return tests
def get_tests_SHA512_224(): test_vectors = load_tests( ("Crypto", "SelfTest", "Hash", "test_vectors", "SHA2"), "SHA512_224ShortMsg.rsp", "KAT SHA-512/224", {"len": lambda x: int(x)}) test_data = [] for tv in test_vectors: try: if tv.startswith('['): continue except AttributeError: pass if tv.len == 0: tv.msg = b"" test_data.append((hexlify(tv.md), tv.msg, tv.desc)) tests = make_hash_tests(SHA512, "SHA512/224", test_data, digest_size=28, oid="2.16.840.1.101.3.4.2.5", extra_params={"truncate": "224"}) return tests
def get_tests(config={}): from Crypto.Hash import MD4 from common import make_hash_tests return make_hash_tests(MD4, "MD4", test_data)
def get_tests(): from CryptoPlus.Hash import MD2 from common import make_hash_tests return make_hash_tests(MD2, "MD2", test_data)
def get_tests(config={}): from Cryptodome.Hash import SHA512 from common import make_hash_tests return make_hash_tests(SHA512, "SHA512", test_data, digest_size=64, oid="2.16.840.1.101.3.4.2.3")
def get_tests(): from CryptoPlus.Hash import SHA256 from common import make_hash_tests return make_hash_tests(SHA256, "SHA256", test_data)
def get_tests(config={}): from Crypto.Hash import MD2 from common import make_hash_tests return make_hash_tests(MD2, "MD2", test_data)
def get_tests(config={}): from Crypto.Hash import SHA224 from common import make_hash_tests return make_hash_tests(SHA224, "SHA224", test_data)
def get_tests(): from CryptoPlus.Hash import RIPEMD from common import make_hash_tests return make_hash_tests(RIPEMD, "RIPEMD", test_data)
def get_tests(config={}): from Crypto.Hash import RIPEMD from common import make_hash_tests return make_hash_tests(RIPEMD, "RIPEMD", test_data)
def get_tests(config={}): from Crypto.Hash import SHA384 from common import make_hash_tests return make_hash_tests(SHA384, "SHA384", test_data)
def get_tests(config={}): from Cryptodome.Hash import SHA1 from common import make_hash_tests return make_hash_tests(SHA1, "SHA1", test_data, digest_size=20, oid="1.3.14.3.2.26")
def get_tests(config={}): from Cryptodome.Hash import RIPEMD160 from common import make_hash_tests return make_hash_tests(RIPEMD160, "RIPEMD160", test_data, digest_size=20, oid="1.3.36.3.2.1")
def get_tests(): from CryptoPlus.Hash import MD4 from common import make_hash_tests return make_hash_tests(MD4, "MD4", test_data)