去看一下《java安全性编程指南》
解决方案 »
- filter的执行顺序到底是咋走的??
- struts2 拦截器 和session 的存取问题 在线等
- xml问题
- 求助:分页问题,单击“下一页”显示不了数据!
- 数据库查询问题,有高手帮忙进来解决下!
- 为iframe添加onmousemove的问题
- 急用:高分求,如何把(字符串名)转化为(字符串变量名)
- HTMLUnit 采集网页iframe内容的问题。
- 出于简便,想在struts中的多个请求对应一个action实例,那我在action中如何区分不同的请求
- tomcat异步servlet处理上传数据超时,chrome显示连接已重置
- 字符转换的问题?
- 为什么用存储过程代替动态sql语句可以防止SQL注入攻击?
public String generatemd5string(String csinput)
{
byte[] b, b2 ;
StringBuffer buf ;
String csreturn = null ; try
{
b = csinput.getBytes("iso-8859-1") ;
MessageDigest md = MessageDigest.getInstance("MD5") ;
md.update(b) ;
b2 = md.digest() ; buf = new StringBuffer(b2.length * 2) ;
for (int nLoopindex = 0 ; nLoopindex < b2.length ; nLoopindex++)
{
if ( ( (int) b2[nLoopindex] & 0xff) < 0x10)
{
buf.append("0") ;
}
buf.append(Long.toString( (int) b2[nLoopindex] & 0xff, 16)) ;
}
csreturn = new String(buf) ;
}
catch (Exception e)
{
e.printStackTrace() ;
csreturn = null ;
} return csreturn ;
}