|
|
@ -80,14 +80,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) |
|
|
|
|
|
|
|
|
|
|
|
// Degenerate case
|
|
|
|
// Degenerate case
|
|
|
|
|
|
|
|
|
|
|
|
key += '\x00','\x00'; |
|
|
|
key += '\x00'; |
|
|
|
|
|
|
|
key += '\x00'; |
|
|
|
ds.Xor(key); |
|
|
|
ds.Xor(key); |
|
|
|
BOOST_CHECK_EQUAL( |
|
|
|
BOOST_CHECK_EQUAL( |
|
|
|
std::string(expected_xor.begin(), expected_xor.end()), |
|
|
|
std::string(expected_xor.begin(), expected_xor.end()), |
|
|
|
std::string(ds.begin(), ds.end())); |
|
|
|
std::string(ds.begin(), ds.end())); |
|
|
|
|
|
|
|
|
|
|
|
in += '\x0f','\xf0'; |
|
|
|
in += '\x0f'; |
|
|
|
expected_xor += '\xf0','\x0f'; |
|
|
|
in += '\xf0'; |
|
|
|
|
|
|
|
expected_xor += '\xf0'; |
|
|
|
|
|
|
|
expected_xor += '\x0f'; |
|
|
|
|
|
|
|
|
|
|
|
// Single character key
|
|
|
|
// Single character key
|
|
|
|
|
|
|
|
|
|
|
@ -105,14 +108,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) |
|
|
|
|
|
|
|
|
|
|
|
in.clear(); |
|
|
|
in.clear(); |
|
|
|
expected_xor.clear(); |
|
|
|
expected_xor.clear(); |
|
|
|
in += '\xf0','\x0f'; |
|
|
|
in += '\xf0'; |
|
|
|
expected_xor += '\x0f','\x00'; |
|
|
|
in += '\x0f'; |
|
|
|
|
|
|
|
expected_xor += '\x0f'; |
|
|
|
|
|
|
|
expected_xor += '\x00'; |
|
|
|
|
|
|
|
|
|
|
|
ds.clear(); |
|
|
|
ds.clear(); |
|
|
|
ds.insert(ds.begin(), in.begin(), in.end()); |
|
|
|
ds.insert(ds.begin(), in.begin(), in.end()); |
|
|
|
|
|
|
|
|
|
|
|
key.clear(); |
|
|
|
key.clear(); |
|
|
|
key += '\xff','\x0f'; |
|
|
|
key += '\xff'; |
|
|
|
|
|
|
|
key += '\x0f'; |
|
|
|
|
|
|
|
|
|
|
|
ds.Xor(key); |
|
|
|
ds.Xor(key); |
|
|
|
BOOST_CHECK_EQUAL( |
|
|
|
BOOST_CHECK_EQUAL( |
|
|
|