Skip to content

Commit

Permalink
Tiny update in SpritzBestPracticePassword
Browse files Browse the repository at this point in the history
  • Loading branch information
abderraouf-adjal committed Jan 14, 2016
1 parent a43dac5 commit da52f0b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
#include <SpritzCipher.h>


spritz_ctx rng_ctx; /* For the random bytes generator */
uint8_t password_len = 28; /* ~160-bit of entropy password; ceil(160/log2(26*2+10)) */
uint8_t password[32];


/* The RNG seed (64 digits of Pi) */
uint8_t entropy[64] =
{ '3', '1', '4', '1', '5', '9', '2', '6',
Expand All @@ -42,6 +37,9 @@ const uint8_t alphanumeric_table[62] =
};


spritz_ctx rng_ctx; /* For the random bytes generator */


void setup() {
/* Initialize serial and wait for port to open */
Serial.begin(9600);
Expand All @@ -66,6 +64,9 @@ void setup() {


void loop() {
uint8_t password_len = 28; /* ~160-bit of entropy password; ceil(160/log2(26*2+10)) */
uint8_t password[password_len];

/* Fill the buffer with random uniformly distributed random alphanumeric characters */
for (uint8_t i = 0; i < password_len; i++) {
password[i] = alphanumeric_table[spritz_random_uniform(&rng_ctx, (uint32_t)(sizeof(alphanumeric_table)))];
Expand Down

0 comments on commit da52f0b

Please sign in to comment.