deepsy 22-Nitrogen
Main Page
Concepts
APIs
Tools
Contact
File List
File Members
sources
cpp
LIBRARIES
UTILS
src
bcrypt
openbsd.h
1
#ifndef ARC4RANDOM_H_INCLUDED
2
#define ARC4RANDOM_H_INCLUDED
3
4
#include <cstddef>
5
#include <cstring>
6
#include <ctime>
7
8
namespace
OpenBSD
9
{
10
inline
11
void
arc4random_buf(
void
*buf,
size_t
nbytes)
12
{
13
for
(
size_t
n = 0; n < nbytes; ++ n)
14
((
char
*)(buf))[n] = rand() %256;
15
}
16
17
inline
18
void
arc4random_init(
void
)
19
{
20
srand( (
unsigned
int
) time(NULL));
21
}
22
23
inline
24
void
explicit_bzero(
void
*b,
size_t
len)
25
{
26
volatile
void
* dont_optimize = memset( b, 0, len );
27
dont_optimize = dont_optimize;
28
}
29
}
30
31
#endif // ARC4RANDOM_H_INCLUDED
OpenBSD
Definition:
openbsd.h:8
Generated by