LinuxCzar

Engineering Software, Linux, and Observability. The website of Jack Neely.    

Creating SHA512 Password Hashes

Need to generate password hashes?  Perhaps to distribute the hash of the root password to all your machines?  Easy, just whip out openssl.  Until you realize that there is no support for SHA2 password hashes.

I hate re-inventing the wheel, but my searching did not turn up a good way to generate SHA512 password hashes reasonably.  So I wrote a bit of Python to do it.  It will output crypt(), MD5, and SHA512 hashes for a given password.

http://linuxczar.net/code/hashpw.py

This takes advantage of GNU libc extensions, so it may not be uber portable.  Also, I had to write my own salt generation method.  It provides 8 character random salts but could be better.

All semi-modern Linux distributions support SHA512 password hashes now.  Red Hat has backported the support to RHEL 4.7 and RHEL 5.3.  So any reasonably updated RHEL/CentOS machine will work.

 Previous  Up  Next


comments powered by Disqus