| 1 |
package jose |
| 2 |
|
| 3 |
import ( |
| 4 |
"crypto/hmac" |
| 5 |
"hash" |
| 6 |
) |
| 7 |
|
| 8 |
func calculateHmac(keySizeBits int, securedInput []byte, key []byte) []byte { |
| 9 |
hasher := hmac.New(func() hash.Hash { return hashAlg(keySizeBits)}, key) |
| 10 |
hasher.Write(securedInput) |
| 11 |
|
| 12 |
return hasher.Sum(nil) |
| 13 |
} |