Skip to content

Commit

Permalink
Documentation and Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abderraouf-adjal committed Nov 7, 2017
1 parent 07f341c commit fb2edd9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
10 changes: 7 additions & 3 deletions examples/SpritzBestPractice/SpritzBestPractice.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand All @@ -27,7 +31,7 @@
*/

/* The RNG seed (64 digits of Pi) */
const uint8_t entropy[64] =
const uint8_t entropy_example[64] =
{ '3', '1', '4', '1', '5', '9', '2', '6',
'5', '3', '5', '8', '9', '7', '9', '3',
'2', '3', '8', '4', '6', '2', '6', '4',
Expand Down Expand Up @@ -69,7 +73,7 @@ void loop() {
Serial.println("\n[Hash 32 KB of Spritz random bytes generator output]\n");

/* Make a 256-bit hash of the entropy in "buf" using one function */
spritz_hash(buf, (uint8_t)(sizeof(buf)), entropy, (uint8_t)(sizeof(entropy)));
spritz_hash(buf, (uint8_t)(sizeof(buf)), entropy_example, (uint8_t)(sizeof(entropy_example)));
/* Initialize/Seed the RNG with the hash of entropy */
spritz_setup(&rng_ctx, buf, (uint8_t)(sizeof(buf)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand All @@ -26,7 +30,7 @@
*/

/* The RNG seed (64 digits of Pi) */
uint8_t entropy[64] =
uint8_t entropy_example[64] =
{ '3', '1', '4', '1', '5', '9', '2', '6',
'5', '3', '5', '8', '9', '7', '9', '3',
'2', '3', '8', '4', '6', '2', '6', '4',
Expand Down Expand Up @@ -69,11 +73,11 @@ void loop() {
*/
/* Make a 256-bit hash of the entropy in "buf" using one function */
spritz_hash_setup(&the_ctx); /* Initialize */
spritz_hash_update(&the_ctx, entropy, (uint16_t)(sizeof(entropy))); /* Add data */
spritz_hash_update(&the_ctx, entropy_example, (uint16_t)(sizeof(entropy_example))); /* Add data */
spritz_hash_final(&the_ctx, buf, (uint8_t)(sizeof(buf))); /* Output the final hash */

spritz_state_memzero(&the_ctx); /* wipe "the_ctx" data by replacing it with zeros (0x00) */
spritz_memzero(entropy, (uint16_t)(sizeof(entropy))); /* wipe "entropy" data by replacing it with zeros (0x00) */
spritz_memzero(entropy_example, (uint16_t)(sizeof(entropy_example))); /* wipe "entropy" data by replacing it with zeros (0x00) */

/* Initialize/Seed the RNG with the hash of entropy */
spritz_setup(&the_ctx, buf, (uint8_t)(sizeof(buf)));
Expand Down
6 changes: 5 additions & 1 deletion examples/SpritzCryptTest/SpritzCryptTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand Down
6 changes: 5 additions & 1 deletion examples/SpritzHashTest/SpritzHashTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand Down
6 changes: 5 additions & 1 deletion examples/SpritzMACTest/SpritzMACTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand Down
6 changes: 5 additions & 1 deletion examples/SpritzStreamTest/SpritzStreamTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
* This example code is in the public domain.
*/

/* ArduinoSpritzCipher documentation: README.md */
/* ArduinoSpritzCipher documentation: <README.md> */


/* ArduinoSpritzCipher is configurable in <SpritzCipher.h> with:
* SPRITZ_TIMING_SAFE_CRUSH, SPRITZ_WIPE_TRACES, SPRITZ_WIPE_TRACES_PARANOID.
* For detailed information, read the documentation.
*/
#include <SpritzCipher.h>


Expand Down

0 comments on commit fb2edd9

Please sign in to comment.