Giter VIP home page Giter VIP logo

perl-string-urandom's Introduction

NAME

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

SYNOPSIS

use String::Urandom;

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

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

DESCRIPTION

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

PREREQUISITES

Params::Validate

INSTALLATION

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.

OBJECT METHODS

new

Create an instance of a new string 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_length

This method will Set/Get the string character length.

$obj->str_length(55);

str_chars

This method will Set/Get characters used for generating a string.

$obj->str_chars('a b c 1 2 3');

rand_string

This method generates a new random string.

$obj->rand_string;

PARAMETERS

LENGTH

Defines the length of the string in characters.

default: 32

CHARS

Defines the characters used for generating the string.

default: a-z A-Z 0-9

REQUIREMENTS

Any flavour of UNIX that supports /dev/urandom

SECURITY

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

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.

REPOSITORY

https://github.com/nuxy/perl-String-Urandom

SEE ALSO

urandom(4)

AUTHOR

Marc S. Brooks <[email protected]> http://mbrooks.info

COPYRIGHT

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

DISCLAIMER OF WARRANTY

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.

perl-string-urandom's People

Contributors

nuxy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.