diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-06 19:49:52 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-22 23:17:31 +0000 |
commit | 99d946e6191056f747225d36a2408085624b516e (patch) | |
tree | 9b81751a703e40d188c26d035edb34e945e28422 /tests/unit_tests/device.cpp | |
parent | ringct: save 3 bytes on bulletproof size (diff) | |
download | monero-99d946e6191056f747225d36a2408085624b516e.tar.xz |
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
Diffstat (limited to 'tests/unit_tests/device.cpp')
-rw-r--r-- | tests/unit_tests/device.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/unit_tests/device.cpp b/tests/unit_tests/device.cpp index 50ccec9fa..3ae748145 100644 --- a/tests/unit_tests/device.cpp +++ b/tests/unit_tests/device.cpp @@ -114,7 +114,7 @@ TEST(device, ops) ASSERT_EQ(ki0, ki1); } -TEST(device, ecdh) +TEST(device, ecdh32) { hw::core::device_default dev; rct::ecdhTuple tuple, tuple2; @@ -123,8 +123,24 @@ TEST(device, ecdh) tuple.amount = rct::skGen(); tuple.senderPk = rct::pkGen(); tuple2 = tuple; - dev.ecdhEncode(tuple, key); - dev.ecdhDecode(tuple, key); + dev.ecdhEncode(tuple, key, false); + dev.ecdhDecode(tuple, key, false); + ASSERT_EQ(tuple2.mask, tuple.mask); + ASSERT_EQ(tuple2.amount, tuple.amount); + ASSERT_EQ(tuple2.senderPk, tuple.senderPk); +} + +TEST(device, ecdh8) +{ + hw::core::device_default dev; + rct::ecdhTuple tuple, tuple2; + rct::key key = rct::skGen(); + tuple.mask = rct::skGen(); + tuple.amount = rct::skGen(); + tuple.senderPk = rct::pkGen(); + tuple2 = tuple; + dev.ecdhEncode(tuple, key, true); + dev.ecdhDecode(tuple, key, true); ASSERT_EQ(tuple2.mask, tuple.mask); ASSERT_EQ(tuple2.amount, tuple.amount); ASSERT_EQ(tuple2.senderPk, tuple.senderPk); |