pcb and initial code from https://github.com/das-labor/borgware-2d.git
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.
28 lines
475 B
28 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>
|
|
#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];
|
|
}
|
|
|