title: Python SHA512 salted passwords with crypt on MacOS X
body: <p>I am trying to generate encrypted password strings, similar to /etc/shadow in Linux. For some reason the output I am getting is different. Any ideas what am I missing and is one has longer than the other (not counting the salt portion)?</p>
  
  <pre><code>#!/usr/bin/python
  import crypt
  
  alg = 6  # SHA512
  salt = 'vb1tLY1qiY'
  word = 'password'
  
  insalt = '${}${}$'.format(alg, salt)
  
  cryptWord = crypt.crypt(word, insalt)
  print cryptWord
  </code></pre>
  
  <p>The output is: <code>$6FMi11BJFsAc</code></p>
  
  <p>If I generate this in Linux like this:</p>
  
  <pre><code>mkpasswd --method=sha-512 --salt=vb1tLY1qiY password
  </code></pre>
  
  <p>The output is: <code>$6$vb1tLY1qiY$WFHTa6CRShEuKg63vuPTYOVRK1oQiM6johIEs2JslF1904VhEdSXlHje74eB4uLXHrKNyZ4bPjSlWpZD6qIo71</code></p>