package com.linewell.core.util;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.logicalcobwebs.proxool.util.Decryptool;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
*
* @author zhappy
*/
public class DecUtil implements Decryptool {
@Override
public String decrypt(String string) {
BASE64Decoder decode = new BASE64Decoder();
String s = null;
try {
byte[] b = decode.decodeBuffer(string);
s = new String(b);
} catch (IOException ex) {
Logger.getLogger(DecUtil.class.getName()).log(Level.SEVERE, null, ex);
}
return s;
}
public String encrypt(String string) {
BASE64Encoder encode = new BASE64Encoder();
return encode.encode(string.getBytes());
}
public static void main(String[] args) {
DecUtil dec = new DecUtil();
String str = "password";
System.out.println("未加密前:" + str);
String _str = dec.encrypt(str);
System.out.println("加密后:" + _str);
System.out.println("加密字符串[" + _str + "]解密后:" + dec.decrypt(_str));
}
}

qq_27000615
- 粉丝: 0
最新资源
- C语言程序设计实训题目一.doc
- 《信息化进程中的教育技术发展研究》子课题《网络环境下的中职教育理论与实践探索》研--究--报--告.doc
- 计算机数据库入侵检测技术应用.docx
- 基于单片机的电子钟的方案设计书(1)1.doc
- 网络空间安全新形势下的信息安全人才培养.doc
- 童发发的大模型学习之旅
- 自动化生产设备方案.ppt
- 第一节办公自动化基础知识.ppt
- 全国计算机等级考试二级教程MSOffice高级应用.ppt
- 递进式应用型人工智能专业实践教学体系探究.docx
- 新建供欲提高CAD制图画图速度者参考.doc
- 计算机应用技术期末复习题.doc
- 汽车电子商务课程标准.docx
- 基于PLC多层电梯电气设计与调试正板doc.doc
- 加强高校学生网络安全教育研究.docx
- 基于Hadoop平台的大数据应用系统解决方案.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


