NAME

String::Urandom - An alternative to using /dev/random

SYNOPSIS

use String::Urandom;

my $obj = new String::Urandom;

# set the string length 
$obj->str_length(255);

# set the characters
$obj->str_chars('a b c 1 2 3');

# print the result
print $obj->rand_string, "\n";

DESCRIPTION

Using output from /dev/urandom. Simply convert bytes into 8-bit characters.

METHODS

str_length

This method will set/get the string character length.

The default value is: 32

$obj->str_length(255);

str_chars

This method will set/get characters used when generating a string.

The default value is: a-z A-Z 0-9

$obj->str_chars('a e i o u 1 2 3');

rand_string

This method generates a new random string.

$obj->rand_string;

REQUIREMENTS

Any flavour of UNIX that supports /dev/urandom

NOTES

The /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 ALSO

urandom(4)

AUTHOR

Marc S. Brooks <mbrooks@cpan.org> http://mbrooks.info

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.