forked from artyom-beilis/cppcms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurandom.h
More file actions
50 lines (39 loc) · 1.22 KB
/
Copy pathurandom.h
File metadata and controls
50 lines (39 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <[email protected]>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCMS_URANDOM_H
#define CPPCMS_URANDOM_H
#include <cppcms/defs.h>
#include <booster/hold_ptr.h>
#include <booster/noncopyable.h>
namespace cppcms {
///
/// \brief High entropy random number generator
///
/// This is cryptographic random number generator that uses /dev/urandom on POSIX platforms
/// and CryptoAPI's CryptGenRandom function under MS Windows
///
class CPPCMS_API urandom_device : public booster::noncopyable {
public:
///
/// Create a new random number generator
///
urandom_device();
///
/// Destory it
///
~urandom_device();
///
/// Fill a buffer pointer by \a ptr of \a n bytes with random numbers
///
void generate(void *ptr,unsigned n);
private:
struct _data;
booster::hold_ptr<_data> d;
};
}
#endif