1Crypt::URandom(3) User Contributed Perl Documentation Crypt::URandom(3)
2
3
4
6 Crypt::URandom - Provide non blocking randomness
7
9 This document describes Crypt::URandom version 0.36
10
12 use Crypt::URandom();
13
14 my $random_string_50_bytes_long = Crypt::URandom::urandom(50);
15
16 OR
17
18 use Crypt::URandom qw( urandom );
19
20 my $random_string_50_bytes_long = urandom(50);
21
23 This Module is intended to provide an interface to the strongest
24 available source of non-blocking randomness on the current platform.
25 Platforms currently supported are anything supporting /dev/urandom and
26 versions of Windows greater than or equal to Windows 2000.
27
29 "urandom"
30 This function accepts an integer and returns a string of the same
31 size filled with random data. The first call will initialize the
32 native cryptographic libraries (if necessary) and load all the
33 required Perl libraries
34
36 "No secure alternative for random number generation for Win32 versions
37 older than W2K"
38 The module cannot run on versions of Windows earlier than Windows
39 2000 as there is no cryptographic functions provided by the
40 operating system.
41
42 "Could not import CryptAcquireContext"
43 The module was unable to load the CryptAcquireContextA function
44 from the advapi32 dynamic library. The advapi32 library cannot
45 probably be loaded.
46
47 "CryptAcquireContext failed"
48 The module was unable to call the CryptAcquireContextA function
49 from the advapi32 dynamic library.
50
51 "Could not import CryptGenRandom"
52 The module was unable to load the CryptGenRandom function from the
53 advapi32 dynamic library.
54
55 "Could not import SystemFunction036"
56 The module was unable to load the SystemFunction036 function from
57 the advapi32 dynamic library.
58
59 "The length argument must be supplied and must be an integer"
60 The get method must be called with an integer argument to describe
61 how many random bytes are required.
62
63 "CryptGenRandom failed"
64 The Windows 2000 CryptGenRandom method call failed to generate the
65 required amount of randomness
66
67 "RtlGenRand failed"
68 The post Windows 2000 RtlGenRand method call failed to generate the
69 required amount of randomness
70
71 "Only read n bytes from path"
72 The /dev/urandom device did not return the desired amount of random
73 bytes
74
75 "Failed to read from path"
76 The /dev/urandom device returned an error when being read from
77
78 "Failed to open path"
79 The /dev/urandom device returned an error when being opened
80
82 Crypt::URandom requires no configuration files or environment
83 variables.
84
86 If the platform is Win32, the Win32::API module will be required.
87 Otherwise no other modules other than those provided by perl will
88 be required
89
91 None reported.
92
94 No bugs have been reported.
95
96 Please report any bugs or feature requests to
97 "bug-crypt-urandom@rt.cpan.org", or through the web interface at
98 <http://rt.cpan.org>.
99
101 David Dick "<ddick@cpan.org>"
102
104 The Win32::API code for interacting with Microsoft's CryptoAPI was
105 stolen with extreme gratitude from Crypt::Random::Source::Strong::Win32
106 by Max Kanat-Alexander
107
109 Copyright (c) 2011, David Dick "<ddick@cpan.org>". All rights reserved.
110
111 This module is free software; you can redistribute it and/or modify it
112 under the same terms as Perl itself.
113
115 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
116 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
117 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
118 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
119 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
120 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
121 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
122 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
123 NECESSARY SERVICING, REPAIR, OR CORRECTION.
124
125 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
126 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
127 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
128 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
129 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
130 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
131 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
132 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
133 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
134 DAMAGES.
135
136
137
138perl v5.34.0 2021-07-22 Crypt::URandom(3)