#include "rc6_generic.hpp"
|
|
#include "test_scaffold.h"
|
|
#include <iostream>
|
|
#include <ios>
|
|
|
|
struct RC6test : public test_scaffold {
|
|
RC6test() {
|
|
name = __FILE__ ":1";
|
|
}
|
|
|
|
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{0x8fc3a536,0x56b1f778,0xc129df4e,0x9848a41e};
|
|
|
|
|
|
std::cout<<"plain:";
|
|
for(auto a : plaintext)
|
|
std::cout << std::hex << a;
|
|
|
|
auto cipher = rc(key);
|
|
plaintext = cipher.encrypt(plaintext);
|
|
|
|
std::cout<<"\nkey__:";
|
|
for(auto a : key)
|
|
std::cout << std::hex << a;
|
|
|
|
std::cout<<"\nciphe:";
|
|
for(auto a : plaintext)
|
|
std::cout << std::hex << a;
|
|
|
|
std::cout<<"\nexpec:";
|
|
for(auto a : expected)
|
|
std::cout << std::hex << a;
|
|
std::cout << std::endl;
|
|
|
|
return plaintext != expected;
|
|
}
|
|
};
|
|
|
|
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};
|
|
|
|
|
|
std::cout<<"plain:";
|
|
for(auto a : plaintext)
|
|
std::cout << std::hex << a;
|
|
|
|
auto cipher = rc(key);
|
|
plaintext = cipher.encrypt(plaintext);
|
|
|
|
std::cout<<"\nkey__:";
|
|
for(auto a : key)
|
|
std::cout << std::hex << a;
|
|
|
|
std::cout<<"\nciphe:";
|
|
for(auto a : plaintext)
|
|
std::cout << std::hex << a;
|
|
|
|
plaintext = cipher.decrypt(plaintext);
|
|
|
|
std::cout<<"\ncidec:";
|
|
for(auto a : plaintext)
|
|
std::cout << std::hex << a;
|
|
|
|
std::cout<<"\nexpec:";
|
|
for(auto a : expected)
|
|
std::cout << std::hex << a;
|
|
std::cout << std::endl;
|
|
|
|
return plaintext != expected;
|
|
}
|
|
};
|
|
|
|
append_test dummy_szmltz63(new RC6test2{});
|