package com.tonvc.util;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class BaseCyper {
/**
* 加密
* @by tonvc
*/
public String encode(byte[] str) throws Exception{
BASE64Encoder base64 = new BASE64Encoder();
return base64.encode(str);
}
/**
* 解密
* @by tonvc
*/
public String decode(String str) throws Exception {
BASE64Decoder decoder = new BASE64Decoder();
byte[] b = decoder.decodeBuffer(str) ;
return new String(b);
}
public static void main(String[] args) throws Exception {
new BaseCyper().decode("L1Rlc3RGaWxlL7LiytTOxLz+oaqhqjE");
}
}
BASE64 加密与解密的使用
最新推荐文章于 2023-03-07 20:15:00 发布