Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Password with hashes

by kcott (Archbishop)
on Aug 10, 2012 at 07:27 UTC ( [id://986681]=note: print w/replies, xml ) Need Help??


in reply to Password with hashes

As you're dealing with passwords, I hope you've considered the security implications. If not, please do so.

A little more code than my %pword = (Rich => '', Broke => '',); would have been useful. I'm not sure why you'd consider reversing the hash. You haven't described what problem you're encountering using a username as a key. Here's a few code snippets that might prove helpful:

exists $pword{$username}
Returns TRUE if $username is a key in %pword, FALSE otherwise. See exists.
length $pword{$username}
Returns TRUE if a password has been set (i.e. not the original zero-length value of ''), FALSE otherwise. See length.
$pword{$username}
Returns the current password for $username.
$pword{$username} = $password
Sets a new password for $username.

If you're having fundamental problems with how to handle hashes, take a look at perldata.

-- Ken

Replies are listed 'Best First'.
Re^2: Password with hashes
by dsheroh (Monsignor) on Aug 10, 2012 at 08:26 UTC
    I'm not sure why you'd consider reversing the hash.
    Having seen people suggest similar things in the past, my assumption is that the reason for this is so that users can log in using only their password. Which is a thoroughly ill-conceived and insecure way of doing things. So, OP, if that was your intention, please don't do that.

      ++ While I don't recall seeing that usage myself, I completely agree with: ill-conceived, insecure and don't do it.

      -- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-05-20 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found