MD5加密登录注册

花生喂龙 2016-07-20 09:46:38
开始想登录,注册同时加密的,后来发现注册加密存入数据库的话不知道登录怎么解密了,因为生成的是随机码的样子
我参考的资料是这篇博客,只做了登录《javascript+Java 实现MD5加密登录密码 - 爱技术爱生活—TAO - 博客频道 - CSDN.NET http://blog.csdn.net/linshutao/article/details/7827633》

我的问题是,我jsp页面生成的加密密码,和后台获取密码后再生成的加密密码不一样啊
jsp页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.servlet.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">

<title>登录界面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/md5.js"></script>
</head>
<% request.getSession().setAttribute("md5RandomKey", MdUtils.getRandomNum(10)); %>
<body>
<form action="<%=basePath %>controller/userLogin.do" method="post">
<table align="center">
<tr>
<c:if test="${returnMap.STATUS != null}">
<font color='red' size='3px' >
<c:out value="${returnMap.STATUS}"></c:out>
</font>
</c:if>
</tr>
<tr>
<td>用户名:</td>
<td><input type="text" name="userName" id="userName" placeholder="用户名/邮箱/手机号" style="width: 350px;height: 66px;font-size: 35px;"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="loginPwd" id="loginPwd" style="width: 350px;height: 66px;font-size: 35px;"/></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="登录" onclick="login()" style="width: 175px;height: 40px;font-size: 20px;"/>
<input type="reset" value="重置"style="width: 175px;height: 40px;font-size: 20px;"/>
</td>
</tr>
</table>
</form>
</body>

<script type="text/javascript">
function login(){
alert(document.getElementById("loginPwd").value);
var hash = MD5(document.getElementById("loginPwd").value+"${md5RandomKey}",null);
alert(document.getElementById("loginPwd").value);
alert("${md5RandomKey}");
alert("hash1="+hash);
document.getElementById("loginPwd").value = hash;
alert("hash2="+hash);
}
</script>

</html>

登录的java页面
public class UsersController extends Bean {
/**
* 登录
*
* @param request
* @param user
* @return
*/
@RequestMapping("/userLogin")
public String userLogin(HttpServletRequest request, HttpSession httpSession,ModelMap map) {
String userName = request.getParameter("userName");
String loginPwd = request.getParameter("loginPwd");
String md5RandomKey = (String)request.getSession().getAttribute("md5RandomKey");
Users uservo = new Users();
uservo.setUserName(userName);

Users userLogin = usersService.userLogin(uservo);
System.out.println(userLogin);
if (userLogin!= null) {
String pwd = userLogin.getPwd();
System.out.println("pwd="+pwd);
System.out.println("loginPwd="+loginPwd);
System.out.println("md5RandomKey="+md5RandomKey);
String realPassword = MdUtils.getMD5Str(userLogin.getPwd()+md5RandomKey,null);
System.out.println("realPassword="+realPassword);
if(realPassword==loginPwd){
System.out.println("登录成功");
return "redirect:/controller/index.do";
}else{
System.out.println("密码错误,登录失败");
return "/login.jsp";
}
} else {
System.out.println("用户名不存在,登录失败");
return "/login.jsp";
}
}

而且我前后台获得的密码和MD5随机码是一样的啊
初学,求多多指教啊
...全文
638 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
达纳苏斯的夜 2016-07-22
  • 打赏
  • 举报
回复
你只需要调用后台的util里的方法,登录注册都使用这个方法,生成的规则一样,验证的时候就是一致的。
花生喂龙 2016-07-22
  • 打赏
  • 举报
回复
引用 15 楼 john_sh888 的回复:
可以的吧。同样的字符MD5加密后的字段是一样的,楼主。。。。。
———————————————— 应该是我参考的博主写错了,他前台用的md5.js里的方法,后台又用的md5Util.java类里的方法,但是他写的方法我又看不懂。。。现在改成两个地方用同一个方法就可以了
花生喂龙 2016-07-22
  • 打赏
  • 举报
回复
引用 12 楼 Molly_1994 的回复:
[quote=引用 7 楼 qq_24435837 的回复:] [quote=引用 5 楼 Molly_1994 的回复:] 解密是不行的,只能按加密后的比较。如果像你这样有生成的随机数,那随机数也要保存起来
———————————————— jsp页面和取得数据库密码的java页面获得的随机数是一样的啊(看1楼最后的图) jsp页面是引入了MD5.js,java页面是MdUtils类里的getMD5Str方法,我觉得是这里用问题,但是我看不懂。。。[/quote] 你数据库存的是不是 MD5(MD5(明文)+随机数) [/quote] ———————————————— 没有做注册处理,只做了登录处理。登录页面MD5(输入密码+随机数)与MD5(数据库取出的密码+随机数)在后台比较。。。
  • 打赏
  • 举报
回复
注册的时候密码传到后台MD5加密后保存 登录的时候密码传到后台MD5加密后查询
达纳苏斯的夜 2016-07-21
  • 打赏
  • 举报
回复
引用 6 楼 qq_24435837 的回复:
[quote=引用 3 楼 qq_25139939 的回复:] 首先,你注册的时候是密码MD5加密存入数据库,然后你登录的时候同样把密码加密与数据库加密过的密码验证就可以实现了。
______________________________ 不可以的,我开始就是这么做的,发现MD5没有办法逆向,因为生成的是随机数[/quote] 你不用考虑逆向,你MD5加密规则在那里。如果你注册的时候密码是password,你登录也是password,登录的密码加密后不就和你注册的密码一样吗?
john_sh888 2016-07-21
  • 打赏
  • 举报
回复
可以的吧。同样的字符MD5加密后的字段是一样的,楼主。。。。。
  • 打赏
  • 举报
回复
存入数据库的密码是加密的,那么验证时候的密码也要加密后验证,并且数据库的password要设置char(32) 定长。
anakin_feng 2016-07-21
  • 打赏
  • 举报
回复
你只要看看是不是注册的时候加密的顺序和登录的时候是不是一致的,只要一致就没问题的
anakin_feng 2016-07-21
  • 打赏
  • 举报
回复
引用 7 楼 qq_24435837 的回复:
[quote=引用 5 楼 Molly_1994 的回复:] 解密是不行的,只能按加密后的比较。如果像你这样有生成的随机数,那随机数也要保存起来
———————————————— jsp页面和取得数据库密码的java页面获得的随机数是一样的啊(看1楼最后的图) jsp页面是引入了MD5.js,java页面是MdUtils类里的getMD5Str方法,我觉得是这里用问题,但是我看不懂。。。[/quote] 你数据库存的是不是 MD5(MD5(明文)+随机数)
花生喂龙 2016-07-21
  • 打赏
  • 举报
回复
引用 9 楼 hjgzj 的回复:
注册的时候密码传到后台MD5加密后保存 登录的时候密码传到后台MD5加密后查询
———————————————————— 我学习的这个博文,它前端jsp用的md5.js里的方法加密,后台又调用的MD5util.java 里的方法,导致两边的密码和随机数一样,加密后的却不一样了 按你的方法,我是不是只要在js和java里选择一种就可以了。话说是jsp页面直接加密好呢还是后台加密好呢
花生喂龙 2016-07-21
  • 打赏
  • 举报
回复
引用 8 楼 qq_25139939 的回复:
[quote=引用 6 楼 qq_24435837 的回复:] [quote=引用 3 楼 qq_25139939 的回复:] 首先,你注册的时候是密码MD5加密存入数据库,然后你登录的时候同样把密码加密与数据库加密过的密码验证就可以实现了。
______________________________ 不可以的,我开始就是这么做的,发现MD5没有办法逆向,因为生成的是随机数[/quote] 你不用考虑逆向,你MD5加密规则在那里。如果你注册的时候密码是password,你登录也是password,登录的密码加密后不就和你注册的密码一样吗?[/quote] ———————————————————————— 有一个md5.js文件,又有一个md5Util.java文件,该用哪个呢?还是说只要保证注册和登录用的是同一个就可以了
anakin_feng 2016-07-20
  • 打赏
  • 举报
回复
解密是不行的,只能按加密后的比较。如果像你这样有生成的随机数,那随机数也要保存起来
ITjavaman 2016-07-20
  • 打赏
  • 举报
回复
MD5解密?哥你想干嘛?按楼上那么干不行么?
达纳苏斯的夜 2016-07-20
  • 打赏
  • 举报
回复
首先,你注册的时候是密码MD5加密存入数据库,然后你登录的时候同样把密码加密与数据库加密过的密码验证就可以实现了。
柒拾~ 2016-07-20
  • 打赏
  • 举报
回复
登陆JAVA 页面: package org.tedu.cloudnote.service; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.tedu.cloudnote.dao.UserDao; import org.tedu.cloudnote.entity.User; import org.tedu.cloudnote.util.NoteResult; import org.tedu.cloudnote.util.NoteUtil; @Service("userService")//扫描 @Transactional public class UserServiceImpl implements UserService{ @Resource//注入 private UserDao userDao; // @Transactional//checkLogin里面逻辑是一个整体, //有错就把执行过的SQL撤销;没有错误就提交SQL操作 public NoteResult checkLogin( String name, String password) throws Exception { NoteResult result = new NoteResult(); //检测用户名和密码 User user = userDao.findByName(name); if(user==null){ result.setStatus(1); result.setMsg("用户不存在"); return result; } //将用户输入password加密 String md5_pwd = NoteUtil.md5(password); //密文比对 if(!user.getCn_user_password() .equals(md5_pwd)){ result.setStatus(2); result.setMsg("密码错误"); return result; } result.setStatus(0); result.setMsg("登录成功"); //把用户ID返回给ajax回调函数 result.setData(user.getCn_user_id()); return result; } public NoteResult registUser( String name, String password, String nick) throws Exception{ NoteResult result = new NoteResult(); //用户名唯一性检测 User has_user = userDao.findByName(name); if(has_user!=null){ result.setStatus(1); result.setMsg("该用户名已存在"); return result; } //执行添加 User user = new User(); String userId = NoteUtil.createId(); user.setCn_user_id(userId);//设置用户ID user.setCn_user_name(name);//设置用户名 String md5_pwd = NoteUtil.md5(password); user.setCn_user_password(md5_pwd);//设置加密后的密码 user.setCn_user_nick(nick);//设置昵称 userDao.save(user);//添加用户 result.setStatus(0); result.setMsg("注册用户成功"); //模拟下一步操作出异常 String s = null; s.length(); return result; } } jsp页面: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="styles/login.css"/> <script type="text/javascript" src="scripts/jquery.min.js"> </script> <script type="text/javascript" src="scripts/base.js"> </script> <script type="text/javascript" src="scripts/cookie_util.js"> </script> <script type="text/javascript" src="scripts/login.js"> </script> <script type="text/javascript" src="scripts/regist.js"> </script> </head> <body> <div class="global"> <div class="log log_in" tabindex='-1' id='dl'> <dl> <dt> <div class='header'> <h3>登 录</h3> </div> </dt> <dt></dt> <dt> <div class='letter'> 用户名: <input type="text" name="" id="count" tabindex='1'/> <span id="count_span"></span> </div> </dt> <dt> <div class='letter'> 密   码: <input type="password" name="" id="password" tabindex='2'/> <span id="password_span"></span> </div> </dt> <dt> <div> <input type="button" name="" id="login" value=' 登 录 ' tabindex='3'/> <input type="button" name="" id="sig_in" value=' 注 册 ' tabindex='4'/> </div> </dt> </dl> </div> <div class="sig sig_out" tabindex='-1' id='zc' style='visibility:hidden;'> <dl> <dt> <div class='header'> <h3>注 册</h3> </div> </dt> <dt></dt> <dt> <div class='letter'> 用户名: <input type="text" name="" id="regist_username" tabindex='5'/> <div class='warning' id='warning_1'><span>该用户名不可用</span></div> </div> </dt> <dt> <div class='letter'> 昵   称: <input type="text" name="" id="nickname" tabindex='6'/> <div class="warning" id="warning_4"><span></span></div> </div> </dt> <dt> <div class='letter'> 密   码: <input type="password" name="" id="regist_password" tabindex='7'/> <div class='warning' id='warning_2'><span>密码长度过短</span></div> </div> </dt> <dt> <div class='password'>    确认密码: <input type="password" name="" id="final_password" tabindex='8'/> <div class='warning' id='warning_3'><span>密码输入不一致</span></div> </div> </dt> <dt> <div> <input type="button" name="" id="regist_button" value=' 注 册 ' tabindex='9'/> <input type="button" name="" id="back" value=' 返 回 ' tabindex='10'/> <script type="text/javascript"> function get(e){ return document.getElementById(e); } get('sig_in').onclick=function(){ get('dl').className='log log_out'; get('zc').className='sig sig_in'; } get('back').onclick=function(){ get('zc').className='sig sig_out'; get('dl').className='log log_in'; } window.onload=function(){ var t =setTimeout("get('zc').style.visibility='visible'",800); get('final_password').onblur=function(){ var npassword=get('regist_password').value; var fpassword=get('final_password').value; if(npassword!=fpassword){ get('warning_3').style.display='block'; } } get('regist_password').onblur=function(){ var npassword=get('regist_password').value.length; if(npassword<6&&npassword>0){ get('warning_2').style.display='block'; } } get('regist_password').onfocus=function(){ get('warning_2').style.display='none'; } get('final_password').onfocus=function(){ get('warning_3').style.display='none'; } } </script> </div> </dt> </dl> </div> </div> </body> </html>
花生喂龙 2016-07-20
  • 打赏
  • 举报
回复
md5.js
/* 
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message 
 * Digest Algorithm, as defined in RFC 1321. 
 * Copyright (C) Paul Johnston 1999 - 2000. 
 * Updated by Greg Holt 2000 - 2001. 
 * See http://pajhome.org.uk/site/legal.html for details. 
 */  
var hex_chr = "0123456789abcdef";  
function rhex(num) {  
    str = "";  
    for (j = 0; j <= 3; j++) {  
        str += hex_chr.charAt((num >> (j * 8 + 4)) & 15) + hex_chr.charAt((num >> (j * 8)) & 15);  
    }  
    return str;  
}  
function str2blks_MD5(str) {  
    nblk = ((str.length + 8) >> 6) + 1;  
    blks = new Array(nblk * 16);  
    for (i = 0; i < nblk * 16; i++) {  
        blks[i] = 0;  
    }  
    for (i = 0; i < str.length; i++) {  
        blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);  
    }  
    blks[i >> 2] |= 128 << ((i % 4) * 8);  
    blks[nblk * 16 - 2] = str.length * 8;  
    return blks;  
}  
function add(x, y) {  
    var lsw = (x & 65535) + (y & 65535);  
    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);  
    return (msw << 16) | (lsw & 65535);  
}  
function rol(num, cnt) {  
    return (num << cnt) | (num >>> (32 - cnt));  
}  
function cmn(q, a, b, x, s, t) {  
    return add(rol(add(add(a, q), add(x, t)), s), b);  
}  
function ff(a, b, c, d, x, s, t) {  
    return cmn((b & c) | ((~b) & d), a, b, x, s, t);  
}  
function gg(a, b, c, d, x, s, t) {  
    return cmn((b & d) | (c & (~d)), a, b, x, s, t);  
}  
function hh(a, b, c, d, x, s, t) {  
    return cmn(b ^ c ^ d, a, b, x, s, t);  
}  
function ii(a, b, c, d, x, s, t) {  
    return cmn(c ^ (b | (~d)), a, b, x, s, t);  
}  
function MD5(str) {  
    x = str2blks_MD5(str);  
    var a = 1732584193;  
    var b = -271733879;  
    var c = -1732584194;  
    var d = 271733878;  
    for (i = 0; i < x.length; i += 16) {  
        var olda = a;  
        var oldb = b;  
        var oldc = c;  
        var oldd = d;  
        a = ff(a, b, c, d, x[i + 0], 7, -680876936);  
        d = ff(d, a, b, c, x[i + 1], 12, -389564586);  
        c = ff(c, d, a, b, x[i + 2], 17, 606105819);  
        b = ff(b, c, d, a, x[i + 3], 22, -1044525330);  
        a = ff(a, b, c, d, x[i + 4], 7, -176418897);  
        d = ff(d, a, b, c, x[i + 5], 12, 1200080426);  
        c = ff(c, d, a, b, x[i + 6], 17, -1473231341);  
        b = ff(b, c, d, a, x[i + 7], 22, -45705983);  
        a = ff(a, b, c, d, x[i + 8], 7, 1770035416);  
        d = ff(d, a, b, c, x[i + 9], 12, -1958414417);  
        c = ff(c, d, a, b, x[i + 10], 17, -42063);  
        b = ff(b, c, d, a, x[i + 11], 22, -1990404162);  
        a = ff(a, b, c, d, x[i + 12], 7, 1804603682);  
        d = ff(d, a, b, c, x[i + 13], 12, -40341101);  
        c = ff(c, d, a, b, x[i + 14], 17, -1502002290);  
        b = ff(b, c, d, a, x[i + 15], 22, 1236535329);  
        a = gg(a, b, c, d, x[i + 1], 5, -165796510);  
        d = gg(d, a, b, c, x[i + 6], 9, -1069501632);  
        c = gg(c, d, a, b, x[i + 11], 14, 643717713);  
        b = gg(b, c, d, a, x[i + 0], 20, -373897302);  
        a = gg(a, b, c, d, x[i + 5], 5, -701558691);  
        d = gg(d, a, b, c, x[i + 10], 9, 38016083);  
        c = gg(c, d, a, b, x[i + 15], 14, -660478335);  
        b = gg(b, c, d, a, x[i + 4], 20, -405537848);  
        a = gg(a, b, c, d, x[i + 9], 5, 568446438);  
        d = gg(d, a, b, c, x[i + 14], 9, -1019803690);  
        c = gg(c, d, a, b, x[i + 3], 14, -187363961);  
        b = gg(b, c, d, a, x[i + 8], 20, 1163531501);  
        a = gg(a, b, c, d, x[i + 13], 5, -1444681467);  
        d = gg(d, a, b, c, x[i + 2], 9, -51403784);  
        c = gg(c, d, a, b, x[i + 7], 14, 1735328473);  
        b = gg(b, c, d, a, x[i + 12], 20, -1926607734);  
        a = hh(a, b, c, d, x[i + 5], 4, -378558);  
        d = hh(d, a, b, c, x[i + 8], 11, -2022574463);  
        c = hh(c, d, a, b, x[i + 11], 16, 1839030562);  
        b = hh(b, c, d, a, x[i + 14], 23, -35309556);  
        a = hh(a, b, c, d, x[i + 1], 4, -1530992060);  
        d = hh(d, a, b, c, x[i + 4], 11, 1272893353);  
        c = hh(c, d, a, b, x[i + 7], 16, -155497632);  
        b = hh(b, c, d, a, x[i + 10], 23, -1094730640);  
        a = hh(a, b, c, d, x[i + 13], 4, 681279174);  
        d = hh(d, a, b, c, x[i + 0], 11, -358537222);  
        c = hh(c, d, a, b, x[i + 3], 16, -722521979);  
        b = hh(b, c, d, a, x[i + 6], 23, 76029189);  
        a = hh(a, b, c, d, x[i + 9], 4, -640364487);  
        d = hh(d, a, b, c, x[i + 12], 11, -421815835);  
        c = hh(c, d, a, b, x[i + 15], 16, 530742520);  
        b = hh(b, c, d, a, x[i + 2], 23, -995338651);  
        a = ii(a, b, c, d, x[i + 0], 6, -198630844);  
        d = ii(d, a, b, c, x[i + 7], 10, 1126891415);  
        c = ii(c, d, a, b, x[i + 14], 15, -1416354905);  
        b = ii(b, c, d, a, x[i + 5], 21, -57434055);  
        a = ii(a, b, c, d, x[i + 12], 6, 1700485571);  
        d = ii(d, a, b, c, x[i + 3], 10, -1894986606);  
        c = ii(c, d, a, b, x[i + 10], 15, -1051523);  
        b = ii(b, c, d, a, x[i + 1], 21, -2054922799);  
        a = ii(a, b, c, d, x[i + 8], 6, 1873313359);  
        d = ii(d, a, b, c, x[i + 15], 10, -30611744);  
        c = ii(c, d, a, b, x[i + 6], 15, -1560198380);  
        b = ii(b, c, d, a, x[i + 13], 21, 1309151649);  
        a = ii(a, b, c, d, x[i + 4], 6, -145523070);  
        d = ii(d, a, b, c, x[i + 11], 10, -1120210379);  
        c = ii(c, d, a, b, x[i + 2], 15, 718787259);  
        b = ii(b, c, d, a, x[i + 9], 21, -343485551);  
        a = add(a, olda);  
        b = add(b, oldb);  
        c = add(c, oldc);  
        d = add(d, oldd);  
    }  
    return rhex(a) + rhex(b) + rhex(c) + rhex(d);  
}  
md5的java类
package com.servlet;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;

import org.apache.log4j.Logger;

public class MdUtils {
	static Logger log = Logger.getLogger(MdUtils.class.getName());
	private static final String ALLCHAR = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

	/**
	 * 获取任意位的随机字符串(0-9 a-z A-Z)
	 * 
	 * @param size
	 *            位数
	 * @return
	 */
	public static final String getRandomNum(int size) {
		StringBuffer sb = new StringBuffer();
		Random random = new Random();
		for (int i = 0; i < size; i++) {
			sb.append(ALLCHAR.charAt(random.nextInt(ALLCHAR.length())));
		}
		return sb.toString();
	}

	  /** 
	    * md5加密(ITS) 
	    * @param str 
	    * @param charSet 
	    * @return 
	    */  
	   public synchronized static final String getMD5Str(String str,String charSet) { //md5加密  
	    MessageDigest messageDigest = null;    
	    try {    
	        messageDigest = MessageDigest.getInstance("MD5");    
	        messageDigest.reset();   
	        if(charSet==null){  
	            messageDigest.update(str.getBytes());  
	        }else{  
	            messageDigest.update(str.getBytes(charSet));    
	        }             
	    } catch (NoSuchAlgorithmException e) {    
	        log.error("md5 error:"+e.getMessage(),e);  
	    } catch (UnsupportedEncodingException e) {    
	        log.error("md5 error:"+e.getMessage(),e);  
	    }    
	      
	    byte[] byteArray = messageDigest.digest();    
	    StringBuffer md5StrBuff = new StringBuffer();    
	    for (int i = 0; i < byteArray.length; i++) {                
	        if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)    
	            md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));    
	        else    
	            md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));    
	    }    
	    return md5StrBuff.toString();    
	}  
}
花生喂龙 2016-07-20
  • 打赏
  • 举报
回复
引用 5 楼 Molly_1994 的回复:
解密是不行的,只能按加密后的比较。如果像你这样有生成的随机数,那随机数也要保存起来
———————————————— jsp页面和取得数据库密码的java页面获得的随机数是一样的啊(看1楼最后的图) jsp页面是引入了MD5.js,java页面是MdUtils类里的getMD5Str方法,我觉得是这里用问题,但是我看不懂。。。
花生喂龙 2016-07-20
  • 打赏
  • 举报
回复
引用 3 楼 qq_25139939 的回复:
首先,你注册的时候是密码MD5加密存入数据库,然后你登录的时候同样把密码加密与数据库加密过的密码验证就可以实现了。
______________________________ 不可以的,我开始就是这么做的,发现MD5没有办法逆向,因为生成的是随机数

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧