/usr/include/kashmir/system/devrand.h is in libkashmir-dev 0.0~git20150805.0.2f3913f+dfsg3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | // devrand.h -- UNIX random number generator
// Copyright (C) 2008 Kenneth Laskoski
/** @file devrand.h
@brief UNIX random number generator
@author Copyright (C) 2008 Kenneth Laskoski
Use, modification, and distribution are subject to the
Boost Software License, Version 1.0. See accompanying file
LICENSE_1_0.txt or <http://www.boost.org/LICENSE_1_0.txt>.
*/
#ifndef KL_DEVRAND_H
#define KL_DEVRAND_H
#include "../randomstream.h"
#include "../unique.h"
#include <fstream>
#include <stdexcept>
namespace kashmir {
namespace system {
class DevRand : public randomstream<DevRand>, unique<DevRand>
{
std::ifstream file;
public:
DevRand() : file("/dev/urandom", std::ios::binary)
{
if (!file)
throw std::runtime_error("failed to open random device.");
}
void read(char *buffer, std::size_t count)
{
file.read(buffer, count);
}
};
}}
#endif
|