| | |
| | | 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.regex.Matcher;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | | import org.apache.commons.codec.binary.Base64;
|
| | | import org.yeshi.utils.encrypt.HmacUtils;
|
| | |
|
| | | import sun.misc.BASE64Encoder;
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public static boolean isNullOrEmpty(String text) {
|
| | | if (text == null || text.length() == 0 || text.equalsIgnoreCase("null")) {
|
| | | if (text == null || text.trim().length() == 0 || text.equalsIgnoreCase("null")) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | | // 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解密
|