1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Finalization and key setup figures for hash/auth algorithms

This commit is contained in:
Rhys Weatherley
2015-04-02 16:33:47 +10:00
parent d50a7fed2d
commit 47ab405e7f
10 changed files with 392 additions and 19 deletions

View File

@@ -174,6 +174,48 @@ void perfGHASH(GHASH *hash)
Serial.println(" bytes per second");
}
void perfGHASHSetKey(GHASH *hash)
{
unsigned long start;
unsigned long elapsed;
int count;
Serial.print("Set Key ... ");
start = micros();
for (count = 0; count < 1000; ++count) {
hash->reset(testVectorGHASH_1.key);
}
elapsed = micros() - start;
Serial.print(elapsed / 1000.0);
Serial.print("us per op, ");
Serial.print((1000.0 * 1000000.0) / elapsed);
Serial.println(" ops per second");
}
void perfGHASHFinalize(GHASH *hash)
{
unsigned long start;
unsigned long elapsed;
int count;
Serial.print("Finalize ... ");
hash->reset(testVectorGHASH_1.key);
hash->update("abc", 3);
start = micros();
for (count = 0; count < 1000; ++count) {
hash->finalize(buffer, 16);
}
elapsed = micros() - start;
Serial.print(elapsed / 1000.0);
Serial.print("us per op, ");
Serial.print((1000.0 * 1000000.0) / elapsed);
Serial.println(" ops per second");
}
void setup()
{
Serial.begin(9600);
@@ -194,6 +236,8 @@ void setup()
Serial.println("Performance Tests:");
perfGHASH(&ghash);
perfGHASHSetKey(&ghash);
perfGHASHFinalize(&ghash);
}
void loop()