Equivalent of PHP's crypt function in Java

后端 未结 7 2211
青春惊慌失措
青春惊慌失措 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:47

    It seems you have to work with a legacy database already populated with passwords you cannot discard, so you can't just switch to a salted MessageDigest, preferably using SHA-1. And your problem gets more complicated, since PHP's crypt is a wrapper that might use one of several algorithms. But let's assume your PHP uses the original DES-based UNIX crypt, then all you need is an implementation of that in Java. As far as i know, there is no implementation of UNIX's crypt in the standard Java installation, but you might want to look here for a list of options.

提交回复
热议问题