Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Password (pseudo)casual

by davido (Archbishop)
on Jan 23, 2013 at 18:04 UTC ( #1014972=note: print w/ replies, xml ) Need Help??


in reply to Password (pseudo)casual

It looks like you're trying to get a 20-character random password generated using the characters from 'a' through 'z'. Here's a solution that uses Bytes::Random::Secure:

perl -MBytes::Random::Secure=random_string_from -E 'say random_string_ +from( join("", "a" .. "z" ), 20 );'

Bytes::Random::Secure uses Math::Random::ISAAC as the Random Number Generator, and relies on Crypt::Random::Source to generate a strong seed for the ISAAC generator. The random_string_from function takes care to be free from modulo bias regardless of source string length.

The current release of Bytes::Random::Secure on CPAN has a sort of hefty dependency chain due to its use of Crypt::Random::Source. The next release (due out in a few days) will replace Crypt::Random::Source with Dana Jacobsen's new Crypt::Random::Seed, which is designed to some degree with Bytes::Random::Secure in mind. It has core-only dependencies, provides better fall-backs and portability than Crypt::Random::Source. The next version of Bytes::Random::Secure (watch for v0.20) will also provide an OO interface alongside the functions interface for times when the user requires more control over how ISAAC is seeded.


Dave


Comment on Re: Password (pseudo)casual
Select or Download Code
Re^2: Password (pseudo)casual
by cisco88 (Sexton) on Jan 23, 2013 at 21:19 UTC
    Thanks :)
    -- Luca Francesca
    <luca.francesca@ciscoland.eu>
    SysAdmin/Integrator
    @
    Vodafone Italy & Ntt Data

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-11-23 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (128 votes), past polls