Equivalent of PHP's crypt function in Java

后端 未结 7 2216
青春惊慌失措
青春惊慌失措 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 14:53

    This is an old thread but I ran into the same issue and found a different solution. You can use the UnixCrypt/Md5Crypt classes in the Apache Commons Codec 1.7 library.

    For example you can call

    UnixCrypt.crypt(string, salt)
    

    OR

    Md5Crypt.md5Crypt(byte[], salt)
    

    I haven't looked into the other encryption types but I imagine their are other utilities as well.

    • org.apache.commons.codec.digest.UnixCrypt
    • org.apache.commons.codec.digest.Md5Crypt

提交回复
热议问题