General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
849 B

пре 4 година
пре 4 година
  1. #include "rc6_generic.hpp"
  2. #include "test_scaffold.h"
  3. #include <iostream>
  4. #include <ios>
  5. struct RC6test : public test_scaffold {
  6. RC6test() {
  7. name = __FILE__ ":1";
  8. }
  9. virtual int run() {
  10. using rc = RC6<>;
  11. rc::key_type key = {0,0,0,0};
  12. rc::block_type plaintext = {0,0,0,0};
  13. rc::block_type expected{0x8fc3a536,0x56b1f778,0xc129df4e,0x9848a41e};
  14. std::cout<<"plain:";
  15. for(auto a : plaintext)
  16. std::cout << std::hex << a;
  17. auto cipher = rc(key);
  18. cipher.encrypt(plaintext);
  19. std::cout<<"\nkey__:";
  20. for(auto a : key)
  21. std::cout << std::hex << a;
  22. std::cout<<"\nciphe:";
  23. for(auto a : plaintext)
  24. std::cout << std::hex << a;
  25. std::cout<<"\nexpec:";
  26. for(auto a : expected)
  27. std::cout << std::hex << a;
  28. std::cout << std::endl;
  29. return plaintext != expected;
  30. }
  31. };
  32. append_test dummy_szfhu5463(new RC6test{});