title: crypt(3) $6$ password hash algorithm (based on SHA-512) in Java?
body: <p>I'm looking for a Java function to generate/verify password hashes that were encoded in the way <code>crypt(3)</code> does when storing them in the Linux "/etc/shadow" file if <code>sha512</code> is activated in "/etc/pam.d/common-password".</p>
  
  <p>The plaintext string "geheim" will translate to:</p>
  
  <pre><code>"$6$WoC532HB$LagBJ00vAGNGu8p9oeYDOSNZo9vTNTzOgPA.K0bJoiXfbcpj3jBuTkNwdzCrSNadRi8LanH1tH6tGGPPp/Lp3."
  </code></pre>
  
  <p>From <a href="http://www.akkadia.org/drepper/SHA-crypt.txt" rel="noreferrer">http://www.akkadia.org/drepper/SHA-crypt.txt</a> I understand that, like with MD5, it's not just a SHA hash like <code>DigestUtils</code> or the Java <code>MessageDigest</code> classes produce but an algorithm that does a bit more magic.</p>