Skip to content
Snippets Groups Projects
Commit 8777215a authored by Niels Möller's avatar Niels Möller
Browse files

New testsuite

Rev: src/modules/_Crypto/testsuite.in:1.2
parent f08a7d01
Branches
Tags
No related merge requests found
// Crypto
test_true([[objectp(Crypto)]])
// C-programs
test_true([[programp(Crypto.cbc)]])
test_true([[programp(Crypto.crypto)]])
test_true([[programp(Crypto.des)]])
test_true([[programp(Crypto.idea)]])
test_true([[programp(Crypto.invert)]])
test_true([[programp(Crypto.md5)]])
test_true([[programp(Crypto.pipe)]])
test_true([[programp(Crypto.rc4)]])
test_true([[programp(Crypto.sha)]])
// Functions
test_true([[functionp(Crypto.des_parity)]])
test_true([[functionp(Crypto.hex_to_string)]])
test_true([[functionp(Crypto.string_to_hex)]])
// Pike programs
test_true([[programp(Crypto.des3)]])
test_true([[programp(Crypto.des3_cbc)]])
test_true([[programp(Crypto.des_cbc)]])
test_true([[programp(Crypto.idea_cbc)]])
test_true([[programp(Crypto.rsa)]])
// Randomness submodule
test_true([[objectp(Crypto.randomness)]])
test_true([[programp(Crypto.randomness.pike_random)]])
test_true([[programp(Crypto.randomness.rc4_random)]])
test_true([[functionp(Crypto.randomness.reasonably_random)]])
test_true([[functionp(Crypto.randomness.really_random)]])
// DES
test_true([[objectp(Crypto.des())]])
test_eq([[Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0101010101010180"))
->crypt_block(Crypto.hex_to_string("0000000000000000"))]],
[[Crypto.hex_to_string("9cc62df43b6eed74")]])
test_eq([[Crypto.des()->set_encrypt_key(Crypto.hex_to_string("8001010101010101"))
->crypt_block(Crypto.hex_to_string("0000000000000040"))]],
[[Crypto.hex_to_string("a380e02a6be54696")]])
test_eq([[Crypto.des()->set_encrypt_key(Crypto.hex_to_string("08192a3b4c5d6e7f"))
->crypt_block(Crypto.hex_to_string("0000000000000000"))]],
[[Crypto.hex_to_string("25DDAC3E96176467")]])
test_eq([[Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef"))
->crypt_block("Now is t")]],
[[Crypto.hex_to_string("3fa40e8a984d4815")]])
test_eq([[Crypto.des()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef"))
->crypt_block(Crypto.hex_to_string("0123456789abcde7"))]],
[[Crypto.hex_to_string("c95744256a5ed31d")]])
test_eq([[Crypto.des()->set_decrypt_key(Crypto.hex_to_string("0123456789abcdef"))
->crypt_block(Crypto.hex_to_string("3fa40e8a984d4815"))]],
[["Now is t"]])
// IDEA
test_true([[objectp(Crypto.idea())]])
test_eq([[Crypto.idea()->set_encrypt_key(Crypto.hex_to_string("0123456789abcdef"
"0123456789abcdef"))
->crypt_block(Crypto.hex_to_string("0123456789abcde7"))]],
[[Crypto.hex_to_string("2011aacef6f4bc7f")]])
// 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(Crypto.hex_to_string("0123456789abcdef"))
->crypt(Crypto.hex_to_string(
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"))]],
[[Crypto.hex_to_string(
"7595c3e6114a09780c4ad452338e1ffd9a1be9498f813d76533449b6778dcad8"
"c78a8d2ba9ac66085d0e53d59c26c2d1c490c1ebbe0ce66d1b6b1b13b6b919b8"
"47c25a91447a95e75e4ef16779cde8bf0a95850e32af9689444fd377108f98fd"
"cbd4e726567500990bcc7e0ca3c4aaa304a387d20f3b8fbbcd42a1bd311d7a43"
"03dda5ab078896ae80c18b0af66dff319616eb784e495ad2ce90d7f772a81747"
"b65f62093b1e0db9e5ba532fafec47508323e671327df9444432cb7367cec82f"
"5d44c0d00b67d650a075cd4b70dedd77eb9b10231b6b5b741347396d62897421"
"d43df9b42e446e358e9c11a9b2184ecbef0cd8e7a877ef968f1390ec9b3d35a5"
"585cb009290e2fcde7b5ec66d9084be44055a619d9dd7fc3166f9487f7cb2729"
"12426445998514c15d53a18c864ce3a2b7555793988126520eacf2e3066e230c"
"91bee4dd5304f5fd0405b35bd99c73135d3d9bc335ee049ef69b3867bf2d7bd1"
"eaa595d8bfc0066ff8d31509eb0c6caa006c807a623ef84c3d33c195d23ee320"
"c40de0558157c822d4b8c569d849aed59d4e0fd7f379586b4b7ff684ed6a189f"
"7486d49b9c4bad9ba24b96abf924372c8a8fffb10d55354900a77a3db5f205e1"
"b99fcd8660863a159ad4abe40fa48934163ddde542a6585540fd683cbfd8c00f"
"12129a284deacc4cdefe58be7137541c047126c8d49e2755ab181ab7e940b0c0")]])
// 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"
"abcdefghijklmnopqrstuvwxyz0123456789")->digest()]],
[[Crypto.hex_to_string("d174ab98d277d9f5a5611c2c9f419d9f")]])
test_eq([[Crypto.md5()->update("1234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890")->digest()]],
[[Crypto.hex_to_string("57edf4a22be3c955ac49da2e2107b67a")]])
// SHA
test_true([[objectp(Crypto.sha())]])
test_eq([[Crypto.sha()->update("abc")->digest()]],
[[Crypto.hex_to_string("a9993e364706816aba3e25717850c26c9cd0d89d")]])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment