/*** 0x9C加密* @param str* @return*/
public static String encrypt(String str) {byte[] strByteArr = str.getBytes();StringBuilder stringBuilder = new StringBuilder();for (int i = 0; i < strByteArr.length; i++) {int temp = strByteArr[i] ^ 0x9C;String hexStr = Integer.toHexString(temp);if (hexStr.length() < 2) {stringBuilder.append("0").append(hexStr);} else {stringBuilder.append(hexStr);}}return stringBuilder.toString();
}
/*** 0x9C解密* @param str* @return*/
public static String decipher(String str) {byte[] decipher = new byte[str.length() / 2];//char[] chars = stringBuilder.toString().toCharArray();for (int i = 0; i < decipher.length; i++) {decipher[i] = (byte)(0x9C ^ Integer.parseInt(str.substring(i * 2, i * 2 + 2), 16));//int position = 2 * i;//decipher[i] = (byte) (charToByte(chars[position]) << 4 | charToByte(chars[position + 1]));}String strDecipher = new String(decipher);return strDecipher;
}