How to create SHA512 password hashes on command line

Posted on Python (>= 3.3) $ python -c ‘import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))’ -or scripted- $ python -c ‘import crypt; print(crypt.crypt(“somesecret”, crypt.mksalt(crypt.METHOD_SHA512)))’ Python (2.x or 3.x) $ python -c “import crypt, getpass, pwd; \ print(crypt.crypt(‘password’, ‘\$6\$saltsalt\$’))” $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/ Note: $6$ designates sha512. Support for this method of specifying the algorithm is dependent on support in OS level crypt(3) […]