| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package cn.com.goldenwater.dcproj.util;
- import org.apache.commons.codec.binary.Base64;
- public class Base64Util {
- /**
- * 解密
- *
- * @param value
- * @return
- * @see [类、类#方法、类#成员]
- */
- public static String decodeStr(String value) {
- byte[] debytes = Base64.decodeBase64(value.getBytes());
- return new String(debytes);
- }
- /**
- * 加密
- *
- * @param value
- * @return
- * @see [类、类#方法、类#成员]
- */
- public static String encodeStr(String value) {
- byte[] enbytes = Base64.encodeBase64Chunked(value.getBytes());
- return new String(enbytes);
- }
- /**
- * 加密
- *
- * @param value
- * @return
- * @see [类、类#方法、类#成员]
- */
- public static String encodeStr(byte[] value) {
- byte[] enbytes = Base64.encodeBase64Chunked(value);
- return new String(enbytes);
- }
- }
|