| 类 | 说明 |
|---|---|
| DigestUtils |
digest算法封装
|
| HmacUtils |
HMAC的一个典型应用是用在“质询/响应”(Challenge/Response)身份认证中
Hmac算法封装,计算“text”的HMAC:
if (length(K) > blocksize) {
K = H(K) // keys longer than blocksize are shortened
} else if (length(key) < blocksize) {
K += [0x00 * (blocksize - length(K))] // keys shorter than blocksize are zero-padded
}
opad = [0x5c * B] XOR K
ipad = [0x36 * B] XOR K
hash = H(opad + H(ipad + text))
其中:H为散列函数,K为密钥,text为数据,
B表示数据块的字长(the blocksize is that of the underlying hash function) |
Copyright © 2023. All rights reserved.