-namespace tut
-{
- struct crypto_data {
- };
-
- typedef test_group<crypto_data> tg;
- tg crypto_test_group("Crypto tests group");
-
- typedef tg::object testobject;
-
- template<>
- template<>
- void testobject::test<1>()
- {
- set_test_name("Check context creation");
-
- BLOWFISH_CTX ctx;
- InitContext("pr7Hhen", 7, &ctx);
- ensure("ctx == testCtx", equalCtx(ctx, testCtx));
- }
-
- template<>
- template<>
- void testobject::test<2>()
- {
- set_test_name("Check encryption");
-
- BLOWFISH_CTX ctx;
- InitContext("pr7Hhen", 7, &ctx);
- uint32_t a = 0x12345678;
- uint32_t b = 0x87654321;
- Blowfish_Encrypt(&ctx, &a, &b);
-
- ensure_equals("a == 0xd3988cd", a, 0xd3988cd);
- ensure_equals("b == 0x7996c6d6", b, 0x7996c6d6);
- }
-
- template<>
- template<>
- void testobject::test<3>()
- {
- set_test_name("Check decryption");
-
- BLOWFISH_CTX ctx;
- InitContext("pr7Hhen", 7, &ctx);
- uint32_t a = 0xd3988cd;
- uint32_t b = 0x7996c6d6;
- Blowfish_Decrypt(&ctx, &a, &b);
-
- ensure_equals("a == 0x12345678", a, 0x12345678);
- ensure_equals("b == 0x87654321", b, 0x87654321);
- }
-
- template<>
- template<>
- void testobject::test<4>()
- {
- set_test_name("Check block encryption");
-
- BLOWFISH_CTX ctx;
- InitContext("pr7Hhen", 7, &ctx);
- uint32_t block[2] = {0x12345678, 0x87654321};
- EncryptBlock(&block, &block, &ctx);
-
- ensure_equals("block[0] == 0xd3988cd", block[0], 0xd3988cd);
- ensure_equals("block[1] == 0x7996c6d6", block[1], 0x7996c6d6);
- }
-
- template<>
- template<>
- void testobject::test<5>()
- {
- set_test_name("Check block decryption");
-
- BLOWFISH_CTX ctx;
- InitContext("pr7Hhen", 7, &ctx);
- uint32_t block[2] = {0xd3988cd, 0x7996c6d6};
- DecryptBlock(&block, &block, &ctx);
-
- ensure_equals("block[0] == 0x12345678", block[0], 0x12345678);
- ensure_equals("block[1] == 0x87654321", block[1], 0x87654321);
- }
-
- template<>
- template<>
- void testobject::test<6>()
- {
- set_test_name("Check string encryption");