Skip to content

Commit

Permalink
Using spritz_is_equal() in testing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
abderraouf-adjal committed Jan 2, 2016
1 parent 1ec157b commit 2972229
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 35 deletions.
11 changes: 4 additions & 7 deletions examples/SpritzCryptTest/SpritzCryptTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,10 @@ void testFunc(const byte *msg, byte msgLen, const byte *key, byte keyLen)
Serial.println();

/* Check the output */
for (byte i = 0; i < msgLen; i++) {
/* If the output is wrong */
if (buf[i] != msg[i]) { /* Alert if test fail */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN (Most boards have this LED connected to digital pin 13) ON */
Serial.println("\n** WARNING: Output != ExpectedOutput **");
break;
}
if (spritz_is_equal(buf, msg, msgLen)) {
/* If the output is wrong "Alert" */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN On (Most boards have this LED connected to digital pin 13) */
Serial.println("\n** WARNING: Output != Test_Vector **");
}
Serial.println();
}
Expand Down
12 changes: 5 additions & 7 deletions examples/SpritzHashChunksTest/SpritzHashChunksTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ void testFunc(const byte ExpectedOutput[32], const byte *data, byte dataLen)
}
Serial.print(digest[i], HEX);
}

/* Check the output */
for (byte i = 0; i < sizeof(digest); i++) {
/* If the output is wrong */
if (digest[i] != ExpectedOutput[i]) { /* Alert if test fail */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN (Most boards have this LED connected to digital pin 13) ON */
Serial.println("\n** WARNING: Output != Test_Vector **");
break;
}
if (spritz_is_equal(digest, ExpectedOutput, sizeof(digest))) {
/* If the output is wrong "Alert" */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN On (Most boards have this LED connected to digital pin 13) */
Serial.println("\n** WARNING: Output != Test_Vector **");
}
Serial.println();
}
Expand Down
12 changes: 5 additions & 7 deletions examples/SpritzHashTest/SpritzHashTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ void testFunc(const byte ExpectedOutput[32], const byte *data, byte dataLen)
}
Serial.print(digest[i], HEX);
}

/* Check the output */
for (byte i = 0; i < sizeof(digest); i++) {
/* If the output is wrong */
if (digest[i] != ExpectedOutput[i]) { /* Alert if test fail */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN (Most boards have this LED connected to digital pin 13) ON */
Serial.println("\n** WARNING: Output != Test_Vector **");
break;
}
if (spritz_is_equal(digest, ExpectedOutput, sizeof(digest))) {
/* If the output is wrong "Alert" */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN On (Most boards have this LED connected to digital pin 13) */
Serial.println("\n** WARNING: Output != Test_Vector **");
}
Serial.println();
}
Expand Down
12 changes: 5 additions & 7 deletions examples/SpritzMACTest/SpritzMACTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ void testFunc(const byte ExpectedOutput[32], const byte *msg, byte msgLen, const
}
Serial.print(digest[i], HEX);
}

/* Check the output */
for (byte i = 0; i < sizeof(digest); i++) {
/* If the output is wrong */
if (digest[i] != ExpectedOutput[i]) { /* Alert if test fail */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN (Most boards have this LED connected to digital pin 13) ON */
Serial.println("\n** WARNING: Output != Test_Vector **");
break;
}
if (spritz_is_equal(digest, ExpectedOutput, sizeof(digest))) {
/* If the output is wrong "Alert" */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN On (Most boards have this LED connected to digital pin 13) */
Serial.println("\n** WARNING: Output != Test_Vector **");
}
Serial.println();
}
Expand Down
12 changes: 5 additions & 7 deletions examples/SpritzStreamTest/SpritzStreamTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ void testFunc(const byte ExpectedOutput[32], const byte *data, byte dataLen)
}
Serial.print(buf[i], HEX);
}

/* Check the output */
for (byte i = 0; i < sizeof(buf); i++) {
/* If the output is wrong */
if (buf[i] != ExpectedOutput[i]) { /* Alert if test fail */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN (Most boards have this LED connected to digital pin 13) ON */
Serial.println("\n** WARNING: Output != Test_Vector **");
break;
}
if (spritz_is_equal(buf, ExpectedOutput, sizeof(buf))) {
/* If the output is wrong "Alert" */
digitalWrite(LED_BUILTIN, HIGH); /* Turn pin LED_BUILTIN On (Most boards have this LED connected to digital pin 13) */
Serial.println("\n** WARNING: Output != Test_Vector **");
}
Serial.println();
}
Expand Down

0 comments on commit 2972229

Please sign in to comment.