diff --git a/examples/SpritzCryptTest/SpritzCryptTest.ino b/examples/SpritzCryptTest/SpritzCryptTest.ino index c0528f8..e379a81 100644 --- a/examples/SpritzCryptTest/SpritzCryptTest.ino +++ b/examples/SpritzCryptTest/SpritzCryptTest.ino @@ -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(); } diff --git a/examples/SpritzHashChunksTest/SpritzHashChunksTest.ino b/examples/SpritzHashChunksTest/SpritzHashChunksTest.ino index 79a88b3..a8020c2 100644 --- a/examples/SpritzHashChunksTest/SpritzHashChunksTest.ino +++ b/examples/SpritzHashChunksTest/SpritzHashChunksTest.ino @@ -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(); } diff --git a/examples/SpritzHashTest/SpritzHashTest.ino b/examples/SpritzHashTest/SpritzHashTest.ino index 72f7ea3..d53c50e 100644 --- a/examples/SpritzHashTest/SpritzHashTest.ino +++ b/examples/SpritzHashTest/SpritzHashTest.ino @@ -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(); } diff --git a/examples/SpritzMACTest/SpritzMACTest.ino b/examples/SpritzMACTest/SpritzMACTest.ino index 897b547..2db79ce 100644 --- a/examples/SpritzMACTest/SpritzMACTest.ino +++ b/examples/SpritzMACTest/SpritzMACTest.ino @@ -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(); } diff --git a/examples/SpritzStreamTest/SpritzStreamTest.ino b/examples/SpritzStreamTest/SpritzStreamTest.ino index 4fc32ad..4d74c69 100644 --- a/examples/SpritzStreamTest/SpritzStreamTest.ino +++ b/examples/SpritzStreamTest/SpritzStreamTest.ino @@ -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(); }