Skip to content

Instantly share code, notes, and snippets.

@lcerezo
Created March 18, 2015 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcerezo/2e9825e0ea813879d726 to your computer and use it in GitHub Desktop.
Save lcerezo/2e9825e0ea813879d726 to your computer and use it in GitHub Desktop.
python method to create sha512 hash suitable for /etc/shadow
hostname[~]$ python
Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import crypt
>>> print crypt.crypt('My Magical passW0Rd!!',crypt.mksalt(crypt.METHOD_SHA512))
$6$zyMqrghWfTymk7Ya$vACFM/VMV8Dc3OyPMIsGD83GY54/wXhBezRJgoWhN1kez7b5NDuNAGE1EUtOrtlNFR4GoYFnDh8cEWjYm1okl.
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment