utf16leBytes = password.getBytes("UTF-16LE"); digestBytes = md.digest(utf16leBytes); return new String(new String(Hex.encode(digestBytes)));
/** * SHA-1加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeSHAHex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeSHA(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * MD5加密 * * @param data * 待加密数据 * * @return String 消息摘要 * * @throws NoSuchAlgorithmException */ public static String encodeMD5Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeMD5(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * SHA-256加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeSHA256Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeSHA256(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * MD2加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeMD2Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeMD2(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * RipeMD320Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeRipeMD320Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeRipeMD320(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * SHA-224加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeSHA224Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeSHA224(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * RipeMD128Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeRipeMD128Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeRipeMD128(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * RipeMD256Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeRipeMD256Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeRipeMD256(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * SHA-384加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeSHA384Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeSHA384(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * TigerHex加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeTigerHex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeTiger(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * SHA-512加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeSHA512Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeSHA512(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * WhirlpoolHex加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeWhirlpoolHex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeWhirlpool(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * GOST3411Hex加密 * * @param data * 待加密数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeGOST3411Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeGOST3411(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * MD4加密 * * @param data * 待加密数据 * * @return String 消息摘要 * * @throws Exception */ public static String encodeMD4Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeMD4(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * RipeMD160Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeRipeMD160Hex(byte[] data) throws NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeRipeMD160(data); // 做十六进制编码处理 return new String(Hex.encode(b)); }
/** * HmacRipeMD160Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * @param key * 密钥 * * @return String 消息摘要 * * @throws Exception */ public static String encodeHmacRipeMD160Hex(byte[] data, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeHmacRipeMD160(data, key); // 做十六进制转换 return new String(Hex.encode(b)); }
/** * HmacMD4Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * @param key * 密钥 * * @return String 消息摘要 * * @throws Exception */ public static String encodeHmacMD4Hex(byte[] data, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeHmacMD4(data, key); // 做十六进制转换 return new String(Hex.encode(b)); }
/** * HmacSHA224Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * @param key * 密钥 * * @return String 消息摘要 * * @throws Exception */ public static String encodeHmacSHA224Hex(byte[] data, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeHmacSHA224(data, key); // 做十六进制转换 return new String(Hex.encode(b)); }
/** * HmacRipeMD128Hex消息摘要 * * @param data * 待做消息摘要处理的数据 * @param key * 密钥 * * @return byte[] 消息摘要 * * @throws Exception */ public static String encodeHmacRipeMD128Hex(byte[] data, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { // 执行消息摘要 byte[] b = encodeHmacRipeMD128(data, key); // 做十六进制转换 return new String(Hex.encode(b)); }