How to create SHA512 password hashes on command line

  • In Linux I can create a SHA1 password hash using sha1pass mypassword. Is there a similar command line tool which lets me create sha512 hashes? Same question for Bcrypt and PBKDF2.

    Don't you mean `sha1sum`?

    @Tichodroma no, there is actually a `sha1pass` command, part of the syslinux-common package on Debian.

    There's a `sha512sum` command that's part of coreutils, and similarly `openssl sha512` -- but neither does the extra stuff that `sha1pass` does.

  • derobert

    derobert Correct answer

    8 years ago

    Yes, you're looking for mkpasswd, which (at least on Debian) is part of the whois package. Don't ask why...

    [email protected]:~$ mkpasswd -m help
    Available methods:
    des     standard 56 bit DES-based crypt(3)
    md5     MD5
    sha-256 SHA-256
    sha-512 SHA-512
    

    Unfortunately, my version at least doesn't do bcrypt. If your C library does, it should (and the manpage gives a -R option to set the strength). -R also works on sha-512, but I'm not sure if its PBKDF-2 or not.

    If you need to generate bcrypt passwords, you can do it fairly simply with the Crypt::Eksblowfish::Bcrypt Perl module.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM