You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
475 B

/**
* \author Daniel Otte
* \date 2008-08-24
* \license GPLv3 or later
* \brief random number generator based on noekeon running in CFB-mode
*
*/
#include <stdint.h>
#include <string.h>
14 years ago
#include "noekeon.h"
uint8_t random_state[16];
uint8_t random_key[16];
uint8_t random8(void){
static uint8_t sr[16];
static uint8_t i=0;
if(i==0){
noekeon_enc(random_state, random_key);
memcpy(sr, random_state, 16);
i=15;
return sr[15];
}
--i;
return sr[i];
}