Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Generating random characters for a salt.

by fenLisesi (Priest)
on Aug 30, 2007 at 09:59 UTC ( [id://636038]=note: print w/replies, xml ) Need Help??


in reply to Generating random characters for a salt.

Due to merlyn:
use Digest::MD5 qw(md5_hex); my $salt = md5_hex( time().{}.rand().$$ );
Cheers.

Replies are listed 'Best First'.
Re^2: Generating random characters for a salt.
by Cap'n Steve (Friar) on Aug 31, 2007 at 07:04 UTC
    That's certainly interesting, but it seems strange to go to those lengths to get a random number and then limit it to a hex string. Granted, I'm not exactly a cryptography expert, but don't you want the largest possible pool of characters?
      If you are given these rules:

      1. Your salt must be N characters long or shorter
      2. N is a small integer

      then, yes, you would want a big char set. That is not the case with salts, however. Heck, you could restrict yourself to two characters and still be arbitrarily uhm... arbitrary by making the string longer.

      The incredibly-randomness and terribly-hard-to-guessness of a salt is not critical: it is going to be hashed again.

      Disclaimer: I am not a crypto expert either. /me .oO(Come to think of it, I am not an expert in anything, really. That's not very good at age 34)

      Cheers.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-16 10:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found