Changeset View
Changeset View
Standalone View
Standalone View
src/bench/crypto_aes.cpp
Show All 32 Lines | |||||
} | } | ||||
static void AES256_Encrypt(benchmark::State &state) { | static void AES256_Encrypt(benchmark::State &state) { | ||||
const std::vector<uint8_t> key(AES256_KEYSIZE, 0); | const std::vector<uint8_t> key(AES256_KEYSIZE, 0); | ||||
const std::vector<uint8_t> plaintext(16, 0); | const std::vector<uint8_t> plaintext(16, 0); | ||||
std::vector<uint8_t> cyphertext(16, 0); | std::vector<uint8_t> cyphertext(16, 0); | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
AES128Encrypt(key.data()).Encrypt(cyphertext.data(), plaintext.data()); | AES256Encrypt(key.data()).Encrypt(cyphertext.data(), plaintext.data()); | ||||
} | } | ||||
} | } | ||||
static void AES256_Decrypt(benchmark::State &state) { | static void AES256_Decrypt(benchmark::State &state) { | ||||
const std::vector<uint8_t> key(AES256_KEYSIZE, 0); | const std::vector<uint8_t> key(AES256_KEYSIZE, 0); | ||||
const std::vector<uint8_t> cyphertext(16, 0); | const std::vector<uint8_t> cyphertext(16, 0); | ||||
std::vector<uint8_t> plaintext(16, 0); | std::vector<uint8_t> plaintext(16, 0); | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
AES128Decrypt(key.data()).Decrypt(plaintext.data(), cyphertext.data()); | AES256Decrypt(key.data()).Decrypt(plaintext.data(), cyphertext.data()); | ||||
} | } | ||||
} | } | ||||
static void AES128CBC_EncryptNoPad(benchmark::State &state) { | static void AES128CBC_EncryptNoPad(benchmark::State &state) { | ||||
const std::vector<uint8_t> key(AES128_KEYSIZE, 0); | const std::vector<uint8_t> key(AES128_KEYSIZE, 0); | ||||
const std::vector<uint8_t> iv(AES_BLOCKSIZE, 0); | const std::vector<uint8_t> iv(AES_BLOCKSIZE, 0); | ||||
const std::vector<uint8_t> plaintext(128, 0); | const std::vector<uint8_t> plaintext(128, 0); | ||||
std::vector<uint8_t> cyphertext(128, 0); | std::vector<uint8_t> cyphertext(128, 0); | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |