diff --git a/src/modules/_Crypto/testsuite.in b/src/modules/_Crypto/testsuite.in index 5b9a36a2ecb50e2557e917de6f51e6d61e1dcce5..7edd9684b64d76873d496e763823fe1c23c24414 100644 --- a/src/modules/_Crypto/testsuite.in +++ b/src/modules/_Crypto/testsuite.in @@ -5,18 +5,19 @@ test_true([[objectp(Crypto)]]) define(AVOID,[[]]) AVOID([[ // END NATIONAL SECURITY -test_do(add_constant("Crypto",master()->resolv("_Lobotomized_Crypto"))) +test_do(add_constant("xCrypto",master()->resolv("_Lobotomized_Crypto"))) // BEGIN NATIONAL SECURITY ]]) +test_do(add_constant("xCrypto",_Crypto)) // END NATIONAL SECURITY // C-programs -test_true([[programp(Crypto.cbc)]]) -test_true([[programp(Crypto.crypto)]]) -test_true([[programp(Crypto.invert)]]) -test_true([[programp(Crypto.md5)]]) -test_true([[programp(Crypto.pipe)]]) -test_true([[programp(Crypto.sha)]]) +test_true([[programp(xCrypto.cbc)]]) +test_true([[programp(xCrypto.crypto)]]) +test_true([[programp(xCrypto.invert)]]) +test_true([[programp(xCrypto.md5)]]) +test_true([[programp(xCrypto.pipe)]]) +test_true([[programp(xCrypto.sha)]]) // BEGIN NATIONAL SECURITY test_true([[programp(Crypto.des)]]) @@ -26,9 +27,9 @@ test_true([[programp(Crypto.rc4)]]) // END NATIONAL SECURITY // Functions -test_true([[functionp(Crypto.des_parity)]]) -test_true([[functionp(Crypto.hex_to_string)]]) -test_true([[functionp(Crypto.string_to_hex)]]) +test_true([[functionp(xCrypto.des_parity)]]) +test_true([[functionp(xCrypto.hex_to_string)]]) +test_true([[functionp(xCrypto.string_to_hex)]]) // BEGIN NATIONAL SECURITY cond( [[ master()->resolv("Gmp")->mpz ]], @@ -50,24 +51,24 @@ test_true([[functionp(Crypto.randomness.really_random)]]) // DES test_true([[objectp(Crypto.des())]]) -test_eq([[Crypto.string_to_hex(Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0101010101010180")) - ->crypt_block(Crypto.hex_to_string("0000000000000000")))]], +test_eq([[xCrypto.string_to_hex(Crypto.des()->set_encrypt_key(xCrypto.hex_to_string("0101010101010180")) + ->crypt_block(xCrypto.hex_to_string("0000000000000000")))]], [["9cc62df43b6eed74"]]) -test_eq([[Crypto.string_to_hex(Crypto.des()->set_encrypt_key(Crypto.hex_to_string("8001010101010101")) - ->crypt_block(Crypto.hex_to_string("0000000000000040")))]], +test_eq([[xCrypto.string_to_hex(Crypto.des()->set_encrypt_key(xCrypto.hex_to_string("8001010101010101")) + ->crypt_block(xCrypto.hex_to_string("0000000000000040")))]], [["a380e02a6be54696"]]) -test_eq([[Crypto.string_to_hex(Crypto.des()->set_encrypt_key(Crypto.hex_to_string("08192a3b4c5d6e7f")) - ->crypt_block(Crypto.hex_to_string("0000000000000000")))]], +test_eq([[xCrypto.string_to_hex(Crypto.des()->set_encrypt_key(xCrypto.hex_to_string("08192a3b4c5d6e7f")) + ->crypt_block(xCrypto.hex_to_string("0000000000000000")))]], [["25ddac3e96176467"]]) -test_eq([[Crypto.string_to_hex(Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef")) +test_eq([[xCrypto.string_to_hex(Crypto.des()->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef")) ->crypt_block("Now is t"))]], [["3fa40e8a984d4815"]]) -test_eq([[Crypto.string_to_hex(Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef")) - ->crypt_block(Crypto.hex_to_string("0123456789abcde7")))]], +test_eq([[xCrypto.string_to_hex(Crypto.des()->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef")) + ->crypt_block(xCrypto.hex_to_string("0123456789abcde7")))]], [["c95744256a5ed31d"]]) -test_eq([[Crypto.des()->set_decrypt_key(Crypto.hex_to_string("0123456789abcdef")) - ->crypt_block(Crypto.hex_to_string("3fa40e8a984d4815"))]], +test_eq([[Crypto.des()->set_decrypt_key(xCrypto.hex_to_string("0123456789abcdef")) + ->crypt_block(xCrypto.hex_to_string("3fa40e8a984d4815"))]], [["Now is t"]]) ]]) @@ -78,65 +79,65 @@ cond( [[ master()->resolv("Gmp")->mpz ]], // IDEA test_true([[objectp(Crypto.idea())]]) test_eq([[Crypto.idea() - ->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef" + ->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef" "0123456789abcdef")) - ->crypt_block(Crypto.hex_to_string("0123456789abcde7"))]], - [[Crypto.hex_to_string("2011aacef6f4bc7f")]]) + ->crypt_block(xCrypto.hex_to_string("0123456789abcde7"))]], + [[xCrypto.hex_to_string("2011aacef6f4bc7f")]]) // CAST test_true([[objectp(Crypto.cast())]]) // encryption test_eq([[Crypto.cast() - ->set_encrypt_key(Crypto.hex_to_string("0123456712345678" + ->set_encrypt_key(xCrypto.hex_to_string("0123456712345678" "234567893456789A")) - ->crypt_block(Crypto.hex_to_string("0123456789ABCDEF"))]], - [[Crypto.hex_to_string("238B4FE5847E44B2")]]) + ->crypt_block(xCrypto.hex_to_string("0123456789ABCDEF"))]], + [[xCrypto.hex_to_string("238B4FE5847E44B2")]]) test_eq([[Crypto.cast() - ->set_encrypt_key(Crypto.hex_to_string("0123456712345678" + ->set_encrypt_key(xCrypto.hex_to_string("0123456712345678" "2345")) - ->crypt_block(Crypto.hex_to_string("0123456789ABCDEF"))]], - [[Crypto.hex_to_string("EB6A711A2C02271B")]]) + ->crypt_block(xCrypto.hex_to_string("0123456789ABCDEF"))]], + [[xCrypto.hex_to_string("EB6A711A2C02271B")]]) test_eq([[Crypto.cast() - ->set_encrypt_key(Crypto.hex_to_string("0123456712")) - ->crypt_block(Crypto.hex_to_string("0123456789ABCDEF"))]], - [[Crypto.hex_to_string("7AC816D16E9B302E")]]) + ->set_encrypt_key(xCrypto.hex_to_string("0123456712")) + ->crypt_block(xCrypto.hex_to_string("0123456789ABCDEF"))]], + [[xCrypto.hex_to_string("7AC816D16E9B302E")]]) // decryption test_eq([[Crypto.cast() - ->set_decrypt_key(Crypto.hex_to_string("0123456712345678" + ->set_decrypt_key(xCrypto.hex_to_string("0123456712345678" "234567893456789A")) - ->crypt_block(Crypto.hex_to_string("238B4FE5847E44B2"))]], - [[Crypto.hex_to_string("0123456789ABCDEF")]]) + ->crypt_block(xCrypto.hex_to_string("238B4FE5847E44B2"))]], + [[xCrypto.hex_to_string("0123456789ABCDEF")]]) test_eq([[Crypto.cast() - ->set_decrypt_key(Crypto.hex_to_string("0123456712345678" + ->set_decrypt_key(xCrypto.hex_to_string("0123456712345678" "2345")) - ->crypt_block(Crypto.hex_to_string("EB6A711A2C02271B"))]], - [[Crypto.hex_to_string("0123456789ABCDEF")]]) + ->crypt_block(xCrypto.hex_to_string("EB6A711A2C02271B"))]], + [[xCrypto.hex_to_string("0123456789ABCDEF")]]) test_eq([[Crypto.cast() - ->set_decrypt_key(Crypto.hex_to_string("0123456712")) - ->crypt_block(Crypto.hex_to_string("7AC816D16E9B302E"))]], - [[Crypto.hex_to_string("0123456789ABCDEF")]]) + ->set_decrypt_key(xCrypto.hex_to_string("0123456712")) + ->crypt_block(xCrypto.hex_to_string("7AC816D16E9B302E"))]], + [[xCrypto.hex_to_string("0123456789ABCDEF")]]) // RC4 test_true([[objectp(Crypto.rc4())]]) -test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef")) - ->crypt(Crypto.hex_to_string("0123456789abcdef"))]], - [[Crypto.hex_to_string("75b7878099e0c596")]]) -test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef")) - ->crypt(Crypto.hex_to_string("0000000000000000"))]], - [[Crypto.hex_to_string("7494c2e7104b0879")]]) -test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("0000000000000000")) - ->crypt(Crypto.hex_to_string("0000000000000000"))]], - [[Crypto.hex_to_string("de188941a3375d3a")]]) -test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("ef012345")) - ->crypt(Crypto.hex_to_string("00000000000000000000"))]], - [[Crypto.hex_to_string("d6a141a7ec3c38dfbd61")]]) +test_eq([[Crypto.rc4()->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef")) + ->crypt(xCrypto.hex_to_string("0123456789abcdef"))]], + [[xCrypto.hex_to_string("75b7878099e0c596")]]) +test_eq([[Crypto.rc4()->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef")) + ->crypt(xCrypto.hex_to_string("0000000000000000"))]], + [[xCrypto.hex_to_string("7494c2e7104b0879")]]) +test_eq([[Crypto.rc4()->set_encrypt_key(xCrypto.hex_to_string("0000000000000000")) + ->crypt(xCrypto.hex_to_string("0000000000000000"))]], + [[xCrypto.hex_to_string("de188941a3375d3a")]]) +test_eq([[Crypto.rc4()->set_encrypt_key(xCrypto.hex_to_string("ef012345")) + ->crypt(xCrypto.hex_to_string("00000000000000000000"))]], + [[xCrypto.hex_to_string("d6a141a7ec3c38dfbd61")]]) ]]) cond( [[ master()->resolv("Gmp")->mpz ]], [[ -test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef")) - ->crypt(Crypto.hex_to_string( +test_eq([[Crypto.rc4()->set_encrypt_key(xCrypto.hex_to_string("0123456789abcdef")) + ->crypt(xCrypto.hex_to_string( "0101010101010101010101010101010101010101010101010101010101010101" "0101010101010101010101010101010101010101010101010101010101010101" "0101010101010101010101010101010101010101010101010101010101010101" @@ -153,7 +154,7 @@ test_eq([[Crypto.rc4()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef") "0101010101010101010101010101010101010101010101010101010101010101" "0101010101010101010101010101010101010101010101010101010101010101" "0101010101010101010101010101010101010101010101010101010101010101"))]], - [[Crypto.hex_to_string( + [[xCrypto.hex_to_string( "7595c3e6114a09780c4ad452338e1ffd9a1be9498f813d76533449b6778dcad8" "c78a8d2ba9ac66085d0e53d59c26c2d1c490c1ebbe0ce66d1b6b1b13b6b919b8" "47c25a91447a95e75e4ef16779cde8bf0a95850e32af9689444fd377108f98fd" @@ -177,44 +178,44 @@ cond( [[ master()->resolv("Gmp")->mpz ]], [[ // MD5 -test_true([[objectp(Crypto.md5())]]) -test_eq([[Crypto.md5()->update("")->digest()]], - [[Crypto.hex_to_string("d41d8cd98f00b204e9800998ecf8427e")]]) -test_eq([[Crypto.md5()->update("a")->digest()]], - [[Crypto.hex_to_string("0cc175b9c0f1b6a831c399e269772661")]]) -test_eq([[Crypto.md5()->update("abc")->digest()]], - [[Crypto.hex_to_string("900150983cd24fb0d6963f7d28e17f72")]]) -test_eq([[Crypto.md5()->update("message digest")->digest()]], - [[Crypto.hex_to_string("f96b697d7cb7938d525a2f31aaf161d0")]]) -test_eq([[Crypto.md5()->update("abcdefghijklmnopqrstuvwxyz")->digest()]], - [[Crypto.hex_to_string("c3fcd3d76192e4007dfb496cca67e13b")]]) -test_eq([[Crypto.md5()->update("ABCDEFGHIJKLMNOPQRSTUVWXYZ" +test_true([[objectp(xCrypto.md5())]]) +test_eq([[xCrypto.md5()->update("")->digest()]], + [[xCrypto.hex_to_string("d41d8cd98f00b204e9800998ecf8427e")]]) +test_eq([[xCrypto.md5()->update("a")->digest()]], + [[xCrypto.hex_to_string("0cc175b9c0f1b6a831c399e269772661")]]) +test_eq([[xCrypto.md5()->update("abc")->digest()]], + [[xCrypto.hex_to_string("900150983cd24fb0d6963f7d28e17f72")]]) +test_eq([[xCrypto.md5()->update("message digest")->digest()]], + [[xCrypto.hex_to_string("f96b697d7cb7938d525a2f31aaf161d0")]]) +test_eq([[xCrypto.md5()->update("abcdefghijklmnopqrstuvwxyz")->digest()]], + [[xCrypto.hex_to_string("c3fcd3d76192e4007dfb496cca67e13b")]]) +test_eq([[xCrypto.md5()->update("ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz0123456789")->digest()]], - [[Crypto.hex_to_string("d174ab98d277d9f5a5611c2c9f419d9f")]]) -test_eq([[Crypto.md5()->update("1234567890123456789012345678901234567890" + [[xCrypto.hex_to_string("d174ab98d277d9f5a5611c2c9f419d9f")]]) +test_eq([[xCrypto.md5()->update("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890")->digest()]], - [[Crypto.hex_to_string("57edf4a22be3c955ac49da2e2107b67a")]]) + [[xCrypto.hex_to_string("57edf4a22be3c955ac49da2e2107b67a")]]) // SHA -test_true([[objectp(Crypto.sha())]]) -test_eq([[Crypto.sha()->update("abc")->digest()]], - [[Crypto.hex_to_string("a9993e364706816aba3e25717850c26c9cd0d89d")]]) +test_true([[objectp(xCrypto.sha())]]) +test_eq([[xCrypto.sha()->update("abc")->digest()]], + [[xCrypto.hex_to_string("a9993e364706816aba3e25717850c26c9cd0d89d")]]) ]]) // HMAC // Test vectors for md5 from RFC-2104 -test_eq([[Crypto.hmac(Crypto.md5)("\013" * 16)("Hi There")]], - [[Crypto.hex_to_string("9294727a3638bb1c13f48ef8158bfc9d")]]) -test_eq([[Crypto.hmac(Crypto.md5)("Jefe")("what do ya want for nothing?")]], - [[Crypto.hex_to_string("750c783e6ab0b503eaa86e310a5db738")]]) -test_eq([[Crypto.hmac(Crypto.md5)("\252" * 16)("\335" * 50)]], - [[Crypto.hex_to_string("56be34521d144c88dbb8c733f0e8b3f6")]]) +test_eq([[Crypto.hmac(xCrypto.md5)("\013" * 16)("Hi There")]], + [[xCrypto.hex_to_string("9294727a3638bb1c13f48ef8158bfc9d")]]) +test_eq([[Crypto.hmac(xCrypto.md5)("Jefe")("what do ya want for nothing?")]], + [[xCrypto.hex_to_string("750c783e6ab0b503eaa86e310a5db738")]]) +test_eq([[Crypto.hmac(xCrypto.md5)("\252" * 16)("\335" * 50)]], + [[xCrypto.hex_to_string("56be34521d144c88dbb8c733f0e8b3f6")]]) // Similar test vectors for sha; not verified with other implementations -test_eq([[Crypto.hmac(Crypto.sha)("\013" * 16)("Hi There")]], - [[Crypto.hex_to_string("675b0b3a1b4ddf4e124872da6c2f632bfed957e9")]]) -test_eq([[Crypto.hmac(Crypto.sha)("Jefe")("what do ya want for nothing?")]], - [[Crypto.hex_to_string("effcdf6ae5eb2fa2d27416d5f184df9c259a7c79")]]) -test_eq([[Crypto.hmac(Crypto.sha)("\252" * 16)("\335" * 50)]], - [[Crypto.hex_to_string("d730594d167e35d5956fd8003d0db3d3f46dc7bb")]]) +test_eq([[Crypto.hmac(xCrypto.sha)("\013" * 16)("Hi There")]], + [[xCrypto.hex_to_string("675b0b3a1b4ddf4e124872da6c2f632bfed957e9")]]) +test_eq([[Crypto.hmac(xCrypto.sha)("Jefe")("what do ya want for nothing?")]], + [[xCrypto.hex_to_string("effcdf6ae5eb2fa2d27416d5f184df9c259a7c79")]]) +test_eq([[Crypto.hmac(xCrypto.sha)("\252" * 16)("\335" * 50)]], + [[xCrypto.hex_to_string("d730594d167e35d5956fd8003d0db3d3f46dc7bb")]])