Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Passwords

by Dog and Pony (Priest)
on Aug 02, 2002 at 09:50 UTC ( [id://187033]=note: print w/replies, xml ) Need Help??


in reply to Passwords

For a seven (>6) character password:
print join '', (0..9, 'A'..'Z', 'a'..'z')[rand 62] for(1..7);
(Slightly altered version of the example at crypt).

If you want to have variable length passwords, try adding a rand statement inside the for, that adds a random number to the 7.

Hope that helps.


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re: Re: Passwords
by Anonymous Monk on Aug 02, 2002 at 11:27 UTC
    sorry to bother you again, but how do i put the generated password into a variable i.e $password. I have tried doing it using $password = join '', ....... But it just returns the first character of the generated password when i print it. Thanks
      Actually, there is, I see now, an error in my code which is the reason you can't do that right off the bat. My mistake for using print to test it with, since print happily takes arrays as input...

      Anyhow, you want Abigail-II's version below in either case, since it a) works, b) is much neater and c) makes sure you always have at least one each of numbers, lower- and uppercase characters (I missed that wish too). :)


      You have moved into a dark place.
      It is pitch black. You are likely to be eaten by a grue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-03-28 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found