GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
String::Urandom(3) User Contributed Perl Documentation String::Urandom(3)

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

  use String::Urandom;

  my $obj = String::Urandom->new(
      LENGTH => 55,
      CHARS  => [ qw/ a b c 1 2 3 / ]
    );

  print $obj->rand_string, "\n";

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

  Params::Validate

From 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.

Create 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);

This method will Set/Get the string character length.

The default value is: 32

  $obj->str_length(55);

This 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');

This method generates a new random string.

  $obj->rand_string;

Defines the length of the string in characters.

The default value is: 32

Defines the characters used for generating the string.

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

Any flavour of UNIX that supports /dev/urandom

In general, the longer the string length and total characters defined, the more secure the output result will be.

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.

urandom(4)

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

This 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>

BECAUSE 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.

2011-05-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.