#include "rc6_generic.hpp" #include "test_scaffold.h" #include #include struct RC6test : public test_scaffold { RC6test() { name = __FILE__ ":1"; } virtual int run() { using rc = RC6<>; auto test = [](rc::key_type key, rc::block_type plaintext, rc::block_type expected) -> bool { auto cipher = rc{key}; plaintext = cipher.encrypt(plaintext); return plaintext != expected; }; auto res = 0; res += test( {0, 0, 0, 0}, {0,0,0,0}, {0x8fc3a536,0x56b1f778,0xc129df4e,0x9848a41e} ); res += test( {0x80000000, 0x00000000, 0x00000000, 0x00000000}, {0,0,0,0}, {0x1AD578A0, 0x2A081628, 0x50A15A15, 0x52A17AD4} ); return res; } }; append_test dummy_szfhu5463(new RC6test{}); struct RC6test2 : public test_scaffold { RC6test2() { name = __FILE__ ":2"; } virtual int run() { using rc = RC6<>; rc::key_type key{0,0,0,0}; rc::block_type plaintext{0,0,0,0}; rc::block_type expected{0,0,0,0}; auto cipher = rc{key}; auto plaintext2 = cipher.encrypt(plaintext); auto plaintext3 = cipher.decrypt(plaintext2); return plaintext3 != expected; } }; append_test dummy_szmltz63(new RC6test2{});