Crypt (3) $ 6 $ password hash algorithm (based on SHA-512) in Java?

I am looking for a Java function to generate / verify password hashes that were encoded in the crypt(3) when stored in the Linux / etc / shadow file if sha512 activated in "/etc/pam.d/common-password".

The plaintext string "geheim" will be translated into:

 "$6$WoC532HB$LagBJ00vAGNGu8p9oeYDOSNZo9vTNTzOgPA.K0bJoiXfbcpj3jBuTkNwdzCrSNadRi8LanH1tH6tGGPPp/Lp3." 

From http://www.akkadia.org/drepper/SHA-crypt.txt I understand that, as in the case of MD5, this is not just a SHA hash code, for example DigestUtils , or Java MessageDigest classes produce, but an algorithm, which makes a little more magical.

+6
source share
3 answers

I found Java implementations for all new crypt () algorithms here: ftp://ftp.arlut.utexas.edu/java_hashes/

+5
source

The question you are referencing provides links to the traditional crypt method (3) based on DES and the "$ 1 $" method based on MD5. I need to check passwords that use the SHA-1 based $ 5 $ method or even the SHA-512 based $ 6 $ method.

Based on this, it means that crypt (3) uses, for example, SHA-512, but adds the salt value and performs several iterations, as described in http://www.akkadia.org/drepper/SHA-crypt.txt

0
source

Source: https://habr.com/ru/post/907223/


All Articles