程序包 com.ajaxjs.util
类 HashHelper
java.lang.Object
com.ajaxjs.util.HashHelper
-
字段概要
字段 -
构造器概要
构造器构造器说明HashHelper(String algorithmName, byte[] input) HashHelper(String algorithmName, String input) -
方法概要
修饰符和类型方法说明static StringcalcFileMD5(byte[] bytes) Calculate the MD5 of a file.static StringCalculate the MD5 of a file.static HashHelpergetHmacMD5(String str, String key) Generates HMAC-MD5 hash value for a string.static StringgetHmacSHA256(String str, String key, boolean isWithoutPadding) Generates HMAC-SHA256 hash value for a string.byte[]getMac()获取指定算法的 MAC 值(可设密钥)byte[]static StringGenerates SHA1 hash value for a string.static StringGenerates SHA256 hash value for a string.byte[]hash()Do hashGet the result of hashed in BASE64hashAsBase64(boolean isWithoutPadding) Get the result of hashed in BASE64Do hashstatic StringGenerates MD5 hash value for a string.setKeyBase64(String key)
-
字段详细资料
-
MD5
- 另请参阅:
-
SHA1
- 另请参阅:
-
SHA256
- 另请参阅:
-
HMAC_SHA1
- 另请参阅:
-
HMAC_SHA256
- 另请参阅:
-
-
构造器详细资料
-
HashHelper
-
HashHelper
-
-
方法详细资料
-
getMessageDigest
public byte[] getMessageDigest() -
setKey
-
setKeyBase64
-
getMac
public byte[] getMac()获取指定算法的 MAC 值(可设密钥)- 返回:
- 生成的 MAC 值
-
hash
public byte[] hash()Do hash- 返回:
- The hash value in bytes.
-
hashAsStr
Do hash- 返回:
- The hash value in hex string, lowercase.
-
hashAsBase64
Get the result of hashed in BASE64- 参数:
isWithoutPadding- 是否去掉末尾的 = 号- 返回:
- The result of hashed in BASE64
-
hashAsBase64
Get the result of hashed in BASE64- 返回:
- The result of hashed in BASE64
-
md5
Generates MD5 hash value for a string. It's equivalent to Spring's DigestUtils.md5DigestAsHex()- 参数:
str- Input string- 返回:
- MD5 hash value
-
getSHA1
Generates SHA1 hash value for a string.- 参数:
str- Input string- 返回:
- SHA1 hash value
-
getSHA256
Generates SHA256 hash value for a string.- 参数:
str- Input string- 返回:
- SHA256 hash value
-
getHmacMD5
Generates HMAC-MD5 hash value for a string.- 参数:
str- Input stringkey- Key string- 返回:
- HMAC-MD5 hash value
-
getHmacSHA256
Generates HMAC-SHA256 hash value for a string.- 参数:
str- Input stringkey- Key string- 返回:
- HMAC-SHA256 hash value
-
calcFileMD5
Calculate the MD5 of a file.- 参数:
in- The file stream.- 返回:
- The MD5 result in lowercase.
-
calcFileMD5
Calculate the MD5 of a file.- 参数:
bytes- The file bytes.- 返回:
- The MD5 result in lowercase.
-