1Data::Entropy::RawSourcUes:e:rLoCcoanlt(r3i)buted Perl DDoactuam:e:nEtnattrioopny::RawSource::Local(3)
2
3
4
6 Data::Entropy::RawSource::Local - read randomness from local device
7
9 use Data::Entropy::RawSource::Local;
10
11 my $rawsrc = Data::Entropy::RawSource::Local->new;
12
13 $rawsrc->sysread($c, 1);
14 # and the rest of the I/O handle interface
15
17 This class provides a constructor to open an I/O handle connected to a
18 local source of random octets. This may be a strong entropy source,
19 depending on the OS, but not every OS has such a facility at all.
20
21 There are no actual objects blessed into this class. Only the
22 constructor belongs to this class; it returns "IO::File" objects. For
23 use as a general entropy source, it is recommended to wrap the handle
24 using "Data::Entropy::Source", which provides methods to extract
25 entropy in more convenient forms than mere octets.
26
27 On systems with a blocking /dev/random, such as Linux, the bits
28 generated can be totally unbiased and uncorrelated. Such an entropy
29 stream is suitable for all uses, including security applications.
30 However, the rate of entropy generation is limited, so applications
31 requiring a large amount of apparently-random data might prefer to fake
32 it cryptographically (see Data::Entropy::RawSource::CryptCounter).
33
34 On systems where /dev/random does not block, the bits generated are
35 necessarily correlated to some extent, but it should be
36 cryptographically difficult to detect the correlation. Such an entropy
37 source is not suitable for all applications. Some other systems lack
38 /dev/random entirely. If satisfactory entropy cannot be generated
39 locally, consider downloading it from a server (see
40 Data::Entropy::RawSource::RandomOrg and
41 Data::Entropy::RawSource::RandomnumbersInfo).
42
44 Data::Entropy::RawSource::Local->new([FILENAME])
45 Opens a file handle referring to the randomness device, or "die"s
46 on error. The device opened is /dev/random by default, but this
47 may be overridden by giving a FILENAME argument.
48
49 The default device name may in the future be different on different
50 OSes, if their equivalent devices are in different places.
51
53 There are no actual objects blessed into this class. The constuctor
54 returns "IO::File" objects. See IO::File for the interface. It is
55 recommended to use unbuffered reads (the "sysread" method) rather than
56 buffered reads (the "getc" method et al), to avoid wasting entropy that
57 could be used by another process.
58
60 Data::Entropy::RawSource::CryptCounter,
61 Data::Entropy::RawSource::RandomOrg,
62 Data::Entropy::RawSource::RandomnumbersInfo, Data::Entropy::Source,
63 IO::File
64
66 Andrew Main (Zefram) <zefram@fysh.org>
67
69 Copyright (C) 2006, 2007, 2009, 2011 Andrew Main (Zefram)
70 <zefram@fysh.org>
71
73 This module is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75
76
77
78perl v5.28.1 2019-02-02Data::Entropy::RawSource::Local(3)