超级课程表登录加密算法
来源:互联网 发布:linux命令行新建文件 编辑:程序博客网 时间:2024/04/27 23:27
//加密 public static String encrypt(String paramString) { String paramString2 = getEncryptKey(); try { paramString = URLEncoder.encode(paramString, "utf-8"); SecretKeySpec secretKeySpec = new SecretKeySpec(DigestUtils.md5(paramString2), "AES"); Cipher localCipher = Cipher.getInstance("AES"); localCipher.init(1, secretKeySpec); paramString = byte2HexStr(localCipher.doFinal(paramString.getBytes("utf-8"))); } catch (Exception e) { e.printStackTrace(); } return paramString; } //获取加密Key private static String getEncryptKey() { String paramString = "friday_syllabus"; int j = 0; String encrypt = new String(); char[] array1 = "0123456789abcdef".toCharArray(); try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(paramString.getBytes()); byte[] md5bytes = md.digest();//md5值 char[] keychars = new char[32]; for (int i = 0; i < 16; i++) { int k = md5bytes[i]; int m = j + 1; keychars[j] = array1[(k >>> 4 & 0xF)]; j = m + 1; keychars[m] = array1[(k & 0xF)]; } encrypt = new String(keychars).toUpperCase(); } catch (Exception e) { e.printStackTrace(); } return encrypt; } //字节码转16进制字符串 private static String byte2HexStr(byte[] b) { String temp = ""; StringBuilder sb = new StringBuilder(""); for (int n = 0; n < b.length; n++) { temp = Integer.toHexString(b[n] & 0xFF); sb.append((temp.length() == 1) ? "0" + temp : temp); } return sb.toString().toUpperCase().trim(); }
0 0
- 超级课程表登录加密算法
- 实现-超级课程表——校园登录(1)
- 实现-超级课程表——校园登录(2)
- android超级课程表原理
- 超级课程表demo
- 仿超级课程表
- Android超级课程表实现原理
- 超级课程表点赞插件
- 实践--课程表(仿超级课程表展示课表)
- 手机端课程表的实现——仿超级课程表
- 糗事百科 超级课程表为什么火
- 超级课程表课表的界面的实现
- 仿超级课程表下拉刷新listview
- 仿超级课程表的课程界面设计
- 超级课程表课表的界面的实现
- 【android】项目案例(一)之超级课程表
- 仿超级课程表的课程界面设计
- android学习:《超级课程表》的课表界面设计
- mysql免安装卸载
- tomcat:pipeline与valve机制
- 熟悉Android开发不得不知道的技巧
- Cocos Creator 常用节点和组件接口(官方文档摘录)
- 一步一步学习自定义View(二)
- 超级课程表登录加密算法
- 【Python】小谈numpy数组占用内存空间问题
- 《思维导图》
- 对象作为参数传递的相关问题
- linux下文件误删的补救
- javascript实现删除前弹出确认框
- 一些测试题的思路与答案
- jersey和spring集成配置使用
- 悬而未决