JAVA
新项目中登录模块用到之前 PHP
项目的用户表,由于密码是 crypt
加密存储的,于是整理了下二者的登录密码验证过程
// 数据库操作
$user = getUserInfo();
if (crypt($_POST['password'], $user['password']) != $user['password']) {
ajaxReturn(['status' => 0, 'msg' => '用户名密码错误']);
}
byte[] s = {'a', 'a', 'a', 'A', 'A', 'A', '1', '1', '1'};
String cryptPwd = "$1$M01.l11.$Gyikpxe1fVU0UBmzQbSJr1";
String pwd = Md5Crypt.md5Crypt(s, cryptPwd);
System.out.println("cryptPwd is " + cryptPwd);
System.out.println(" pwd is " + pwd);
资料