Big code refactor, get rid of HAL entirely
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "uniqid.h"
|
||||
#include "atomic.h"
|
||||
#include "randcrypto/uniqid.h"
|
||||
#include "randcrypto/physrand.h"
|
||||
#include "spinlock/spinlock.h"
|
||||
#include "hal/hal.h"
|
||||
|
||||
static const char *base62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
@ -28,7 +27,7 @@ void uniqseed(void) {
|
||||
return;
|
||||
|
||||
uint32_t seed = 0;
|
||||
int32_t r = hal_randnum();
|
||||
int32_t r = randcrypto_get_physrand();
|
||||
if (r != -1) {
|
||||
seed = (uint32_t)r;
|
||||
} else {
|
||||
@ -48,7 +47,7 @@ void randcrypto_gen_uniqid(char *out, size_t n) {
|
||||
|
||||
uniqseed();
|
||||
|
||||
int32_t r = hal_randnum();
|
||||
int32_t r = randcrypto_get_physrand();
|
||||
uint32_t extra = (r != -1) ? (uint32_t)r : uniqstate * 0x27d4eb2dU;
|
||||
|
||||
uniqstate += 0x9E3779B1u;
|
||||
|
||||
Reference in New Issue
Block a user