#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 res = 0; { rc::key_type key = {0x00000000, 0x00000000, 0x00000000, 0x00000000}; rc::block_type plaintext = {0,0,0,0}; rc::block_type expected = {0x8fc3a536,0x56b1f778,0xc129df4e,0x9848a41e}; auto cipher = rc{key}; plaintext = cipher.encrypt(plaintext); res += plaintext != expected; } { rc::key_type key = {0x80000000, 0x00000000, 0x00000000, 0x00000000}; rc::block_type plaintext = {0,0,0,0}; rc::block_type expected = {0x1AD578A0, 0x2A081628, 0x50A15A15, 0x52A17AD4}; auto cipher = rc{key}; plaintext = cipher.encrypt(plaintext); res += plaintext != expected; } 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{});