码迷,mamicode.com
首页 > 编程语言 > 详细

java BASE64解码 加密

时间:2015-04-16 23:19:23      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:

import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;

public class Base64encoder {
public static void main(String[] args) throws Exception {
BASE64Encoder encoder = new BASE64Encoder();
String username = "zsz19901116@163.com";
String password = "674515zsz";
String a = encoder.encode(username.getBytes());
String b = encoder.encode(password.getBytes());
System.out.println(a + "\n" + b);
BASE64Decoder decoder = new BASE64Decoder();
String c = a;
String d = b;
String e = new String(decoder.decodeBuffer(c));
String f = new String(decoder.decodeBuffer(d));
System.out.println(e + "\n" + f);

     }

}

java BASE64解码 加密

标签:

原文地址:http://www.cnblogs.com/zszitman/p/4433472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!