java BASE64解码 加密

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);

     }

}

posted on 2015-04-16 22:14  zhaoshuzhan  阅读(164)  评论(0编辑  收藏  举报

导航