Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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.


Comment on Re: Password (pseudo)casual
Select or Download Code
Replies are listed 'Best First'.
Re^2: Password (pseudo)casual
by cisco88 (Beadle) on Jan 23, 2013 at 21:19 UTC
    Thanks :)
    -- Luca Francesca
    Vodafone Italy & Ntt Data

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2016-06-01 02:28 GMT
Find Nodes?
    Voting Booth?