Equivalent of PHP's crypt function in Java

后端 未结 7 2210
青春惊慌失措
青春惊慌失措 2020-12-16 14:24

I am migrating my PHP code to Google App Engine - Java.
So I need an equivalent of PHP\'s crypt function in Java,
since I have stored all the passwords of registered

7条回答
  •  攒了一身酷
    2020-12-16 15:01

    PHP's crypt supports multiple hash functions. If you use the MD5 version (hash starts with $1$), you can find a Java implementation here,

    http://www.java2s.com/Open-Source/Java-Document/Groupware/LibreSource/md5/MD5Crypt.java.htm

    Please notice that they use their own MD5 class. I am not sure if it's the same as standard MD5.

    I am sure you can find Java implementation for other hash algorithms too.

提交回复
热议问题