Implement decryption

This commit is contained in:
2019-05-15 09:26:42 +02:00
parent 702c37656f
commit d03fe358e7
3 changed files with 122 additions and 10 deletions

View File

@@ -12,17 +12,21 @@ using namespace std;
using namespace std::chrono;
int main(int argc, char **argv) {
uint8_t data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const uint8_t key[16] = {0xA0,0x7C,0x3D,0x99,0xFA,0x00,0x02,0x46,0x97,0x33,0x73,0x50,0x31,0x7C,0xD3,0xDC};
//uint8_t data[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
uint8_t data[16] = {0xA0,0x7C,0x3D,0x99,0xFA,0x00,0x02,0x46,0x97,0x33,0x73,0x50,0x31,0x7C,0xD3,0xDC};
//const uint8_t key[16] = {0xA0,0x7C,0x3D,0x99,0xFA,0x00,0x02,0x46,0x97,0x33,0x73,0x50,0x31,0x7C,0xD3,0xDC};
uint8_t key[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
ifstream input("/dev/urandom", ios::binary);
for (int i = 0;i < 5000;i++)
for (int i = 0;i < 100000;i++)
{
input.read((char*) data, 16);
input.read((char*) key, 16);
AES::encrypt_ecb(data, key);
for (int d = 0;d < 16;d++)
{
cout << dec << (int) data[d] << ",";
cout << dec << (int) key[d] << ",";
}
AES::encrypt_ecb(data, key);
profiler.clear();
AES::decrypt_ecb(data, key);
cout << profiler.calls["gf_reduce"] << endl;
profiler.clear();
}