diff --git a/test/aria.cpp b/test/aria.cpp index 4353a43..935f89c 100644 --- a/test/aria.cpp +++ b/test/aria.cpp @@ -1,12 +1,13 @@ //---------------------------------------------------------------------------// // Copyright (c) 2018-2020 Mikhail Komarov +// Copyright (c) 2020 Nikita Kaskov // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //---------------------------------------------------------------------------// -#define BOOST_TEST_MODULE aria_cipher_test +#define BOOST_TEST_MODULE noekeon_cipher_test #include #include @@ -20,53 +21,20 @@ #include -using namespace nil::crypto3::block; +using namespace nil::crypto3; -namespace boost { - namespace test_tools { - namespace tt_detail { - template class P, typename K, typename V> - struct print_log_value> { - void operator()(std::ostream&, P const&) { - } - }; - } // namespace tt_detail - } // namespace test_tools -} // namespace boost +BOOST_AUTO_TEST_SUITE(aria_test_suite) -static const std::unordered_map> valid_data = { - {"Zg==", {0x66}}, - {"Zm8=", {0x66, 0x6F}}, - {"Zm9v", {0x66, 0x6F, 0x6F}}, - {"aGVsbG8gd29ybGQ=", {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64}}, - {"aGVsbG8gd29ybGQh", {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21}}, - {"SGVsbG8sIHdvcmxkLg==", {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x2E}}, - {"VGhlIDEyIGNoYXJz", {0x54, 0x68, 0x65, 0x20, 0x31, 0x32, 0x20, 0x63, 0x68, 0x61, 0x72, 0x73}}, - {"VGhlIDEzIGNoYXJzLg==", {0x54, 0x68, 0x65, 0x20, 0x31, 0x33, 0x20, 0x63, 0x68, 0x61, 0x72, 0x73, 0x2E}}, - {"VGhlIDE0IGNoYXJzLi4=", {0x54, 0x68, 0x65, 0x20, 0x31, 0x34, 0x20, 0x63, 0x68, 0x61, 0x72, 0x73, 0x2E, 0x2E}}, - {"VGhlIDE1IGNoYXJzLi4u", - {0x54, 0x68, 0x65, 0x20, 0x31, 0x35, 0x20, 0x63, 0x68, 0x61, 0x72, 0x73, 0x2E, 0x2E, 0x2E}}, - {"QW4gVVRGLTggdXVtbDogw7w=", - {0x41, 0x6E, 0x20, 0x55, 0x54, 0x46, 0x2D, 0x38, 0x20, 0x75, 0x75, 0x6D, 0x6C, 0x3A, 0x20, 0xC3, 0xBC}}, - {"V2VpcmQgR2VybWFuIDIgYnl0ZSB0aGluZzogw58u", - {0x57, 0x65, 0x69, 0x72, 0x64, 0x20, 0x47, 0x65, 0x72, 0x6D, 0x61, 0x6E, 0x20, 0x32, 0x20, - 0x62, 0x79, 0x74, 0x65, 0x20, 0x74, 0x68, 0x69, 0x6E, 0x67, 0x3A, 0x20, 0xC3, 0x9F, 0x2E}}, - {"mw==", {0x9B}}, - {"HGA=", {0x1C, 0x60}}, - {"gTS9", {0x81, 0x34, 0xBD}}, - {"Xmz/3g==", {0x5E, 0x6C, 0xFF, 0xDE}}, - {"ss3w3H8=", {0xb2, 0xcd, 0xf0, 0xdc, 0x7f}}, - {"/FYt2tQO", {0xfc, 0x56, 0x2d, 0xda, 0xd4, 0x0e}}, - {"KbIyLohB6A==", {0x29, 0xb2, 0x32, 0x2e, 0x88, 0x41, 0xe8}}, - {"Dw/O2Ul6r5I=", {0x0f, 0x0f, 0xce, 0xd9, 0x49, 0x7a, 0xaf, 0x92}}, - {"Jw+xiYKADaZA", {0x27, 0x0f, 0xb1, 0x89, 0x82, 0x80, 0x0d, 0xa6, 0x40}}}; +BOOST_AUTO_TEST_CASE(aria_1) { -static const std::vector invalid_data = {"ZOOL!isnotvalidbase64", "Neitheris:this?"}; + std::vector input = {'\x00', '\x11', '\x22', '\x33', '\x44', '\x55', '\x66', '\x77', + '\x88', '\x99', '\xaa', '\xbb', '\xcc', '\xdd', '\xee', '\xff'}; + std::vector key = {'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', + '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f'}; -BOOST_AUTO_TEST_SUITE(aria_test_suite) + std::string out = encrypt>(input, key); -BOOST_DATA_TEST_CASE(aria_single_range_encrypt, - boost::unit_test::data::random(0, 16) ^ boost::unit_test::data::xrange(7), random_sample, index) { + BOOST_CHECK_EQUAL(out, "d718fbd6ab644c739da95f3be6451778"); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file