| | |
| | | package org.yeshi.utils;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.lang.reflect.Method;
|
| | | import java.security.InvalidKeyException;
|
| | | import java.security.MessageDigest;
|
| | | import java.security.NoSuchAlgorithmException;
|
| | | import java.util.List;
|
| | | import java.util.regex.Matcher;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | | import org.apache.commons.codec.binary.Base64;
|
| | | import org.yeshi.utils.encrypt.HmacUtils;
|
| | |
|
| | | import sun.misc.BASE64Encoder;
|
| | |
|
| | |
| | | // LogUtil.i("result: " + buf.toString().substring(8,
|
| | | // 24));// 16λ�ļ���
|
| | | } catch (NoSuchAlgorithmException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static String MD5Hmac(String st, String key) {
|
| | | try {
|
| | | return HmacUtils.byte2hex(HmacUtils.encryptHMAC(st, key));
|
| | | } catch (InvalidKeyException e) {
|
| | | e.printStackTrace();
|
| | | } catch (NoSuchAlgorithmException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | |
| | | Object retObj = mainMethod.invoke(null, new Object[] { input });
|
| | | return (String) retObj;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * BASE64解密
|
| | |
| | | return lArr;
|
| | | }
|
| | |
|
| | | public static String concat(List list, String sperator) {
|
| | | if (list == null)
|
| | | return null;
|
| | | String str = "";
|
| | | for (Object obj : list) {
|
| | | str += obj + sperator;
|
| | | }
|
| | | if (str.endsWith(sperator))
|
| | | str = str.substring(0, str.length() - sperator.length());
|
| | | return str;
|
| | | }
|
| | |
|
| | | public static String concat(Object[] array, String sperator) {
|
| | | if (array == null)
|
| | | return null;
|
| | |
|
| | | String str = "";
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | str += array[i] + sperator;
|
| | | }
|
| | |
|
| | | if (str.endsWith(sperator))
|
| | | str = str.substring(0, str.length() - sperator.length());
|
| | | return str;
|
| | | }
|
| | |
|
| | |
|
| | | }
|