我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用common.make_hash_tests()。
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 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 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={}): # 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(config={}): from Crypto.Hash import MD2 from common import make_hash_tests return make_hash_tests(MD2, "MD2", test_data, digest_size=16, oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x02")
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 Crypto.Hash import MD5 from common import make_hash_tests return make_hash_tests(MD5, "MD5", test_data, digest_size=16, oid="\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05")
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')