CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
I need to encrypt passwords

 



adolfo
Novice

Aug 27, 2001, 11:33 AM

Post #1 of 4 (822 views)
I need to encrypt passwords Can't Post

Hi everybody, I need to encrypt some passwords and I don't know how to do it.
I need to protect an admin area with passwords and I want the passwords to be encrypted.
┐How can I do this?
Thanx in advance. !! =)




mhx
Enthusiast / Moderator

Aug 27, 2001, 12:12 PM

Post #2 of 4 (821 views)
Re: I need to encrypt passwords [In reply to] Can't Post

Try not to store passwords.
Perl has a crypt function that converts a string, e.g. a password, to an encrypted string. There's no known decrypt function, so you won't be able to reconstruct the password from that string. Storing the encrypted string is completely safe, even if everyone could see it. To check a password, just crypt it again and compare the result with the stored encrypted string. If they match, the password is ok.
See perldoc -f crypt for details.
Hope this helps.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



adolfo
Novice

Aug 27, 2001, 12:33 PM

Post #3 of 4 (819 views)
Re: I need to encrypt passwords [In reply to] Can't Post

Thanx again Marcus !!!
Do you have ICQ# or something like that?



mhx
Enthusiast / Moderator

Aug 27, 2001, 12:38 PM

Post #4 of 4 (818 views)
Re: I need to encrypt passwords [In reply to] Can't Post

Not yet. But I'll put my ICQ# into my profile if I do...

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives