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

Re: hashed unix/shadow SHA512 passwords

by hobbs (Monk)
on Jul 21, 2009 at 23:23 UTC ( [id://782119]=note: print w/replies, xml ) Need Help??


in reply to hashed unix/shadow SHA512 passwords

Unless you have a pressing need (like ability to run the script on a different system with a different crypt()) then don't try to do this. Instead just write something like my $shadow = crypt($root_pass, '$6$' . $salt); and you're good to go! The way that crypt() is designed it's equally good for generating or checking a hash.

Oh, but to answer the question you actually asked, the reason is that the "SHA-512" crypt() algorithm isn't SHA-512, it's a key-derivation function using SHA-512. Likewise the "MD5" crypt algorithm isn't MD5, etc. The actual algorithm is specified here as far as I can tell, but you shouldn't worry about implementing it. Let crypt() do that for you.

Replies are listed 'Best First'.
Re^2: hashed unix/shadow SHA512 passwords
by greenmoss (Novice) on Apr 16, 2010 at 20:47 UTC
    Thanks; I can only vaguely remember why I needed this, but I'm sure I will stumble across this again, and will try your solution.

Log In?
Username:
Password:

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

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

    No recent polls found