|
NAMEString::Urandom - An alternative to using /dev/randomSYNOPSISuse String::Urandom; my $obj = String::Urandom->new( LENGTH => 55, CHARS => [ qw/ a b c 1 2 3 / ] ); print $obj->rand_string, "\n"; DESCRIPTIONUsing output from /dev/urandom. Simply convert bytes into 8-bit characters.PREREQUISITESParams::Validate INSTALLATIONFrom source:$ tar xfz String-Urandom-0.X.X.tar.gz $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib $ make $ make test $ make install Perl one liner using CPAN.pm: $ perl -MCPAN -e 'install String::Urandom' Use of CPAN.pm in interactive mode: $ perl -MCPAN -e shell cpan> install String::Urandom cpan> quit Just like the manual installation of Perl modules, the user may need root access during this process to insure write permission is allowed within the installation directory. OBJECT METHODSnewCreate a new session object. Configuration items may be passed as a parameter.my $obj = new String::Urandom; or my %params = ( LENGTH => 55, CHARS => [ qw/ a b c 1 2 3 / ] ); my $obj = String::Urandom->new(\%params); str_lengthThis method will Set/Get the string character length.The default value is: 32 $obj->str_length(55); str_charsThis method will Set/Get characters used for generating a string.The default value is: a-z A-Z 0-9 $obj->str_chars('a b c 1 2 3'); rand_stringThis method generates a new random string.$obj->rand_string; PARAMETERSLENGTHDefines the length of the string in characters.The default value is: 32 CHARSDefines the characters used for generating the string.The default value is: a-z A-Z 0-9 REQUIREMENTSAny flavour of UNIX that supports /dev/urandomSECURITYIn general, the longer the string length and total characters defined, the more secure the output result will be.NOTESThe /dev/urandom is an ("unlocked" random source) which reuses the internal pool to produce more pseudo-random bits. Since this is the case, the read may contain less entropy than its counterpart /dev/random. Knowing this, this module was intended to be used as a pseudorandom string generator for less secure applications where response timing may be an issue.SEE ALSOurandom(4)AUTHORMarc S. Brooks <mbrooks@cpan.org> <http://mbrooks.info>COPYRIGHTThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.See <http://www.perl.com/perl/misc/Artistic.html> DISCLAIMER OF WARRANTYBECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Visit the GSP FreeBSD Man Page Interface. |