2018-12-02 18:17:19 +11:00
|
|
|
#include <cruft/util/tap.hpp>
|
|
|
|
|
2024-07-18 09:51:47 +10:00
|
|
|
#include <cruft/crypto/block/speck.hpp>
|
2018-12-02 18:17:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
cruft::TAP::logger tap;
|
|
|
|
|
|
|
|
{
|
|
|
|
// speck128/128 test vectors from the IACR paper.
|
|
|
|
std::array<u64,2> const key { 0x0f0e0d0c0b0a0908, 0x0706050403020100 };
|
|
|
|
std::array<u64,2> const dec { 0x6c61766975716520, 0x7469206564616d20 };
|
|
|
|
std::array<u64,2> const enc { 0xa65d985179783265, 0x7860fedf5c570d18 };
|
|
|
|
|
|
|
|
cruft::crypto::block::speck const cipher (key);
|
|
|
|
tap.expect (cipher.encrypt (dec) == enc, "speck128/128 encode");
|
|
|
|
tap.expect (cipher.decrypt (enc) == dec, "speck128/128 decode");
|
|
|
|
}
|
|
|
|
|
|
|
|
return tap.status ();
|
|
|
|
}
|