java实现base64加密解密
生活随笔
收集整理的這篇文章主要介紹了
java实现base64加密解密
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/**
?? ? * 加密
?? ? * @param str
?? ? * @return
?? ? */
public static String getStr(String str){
?? ??? ?BASE64Encoder base64 = new BASE64Encoder();
??????? return base64.encode(str.getBytes());
?? ?}
/**
?? ? * 解密
?? ? * @param str
?? ? * @return
?? ? * @throws IOException
?? ? */
?? ?public static String getDeStr(String str) throws IOException{
?? ??? ?BASE64Decoder base64 = new BASE64Decoder();
?? ??? ?return new String(base64.decodeBuffer(str));
?? ?}
總結
以上是生活随笔為你收集整理的java实现base64加密解密的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java实现bean实体与map集合相互
- 下一篇: 导出oracle awr分析报告,配置o