(String algorithm)
| 89 | } |
| 90 | |
| 91 | private static int blockSizeFor(String algorithm) { |
| 92 | String a = MessageDigestImpl.normalise(algorithm); |
| 93 | if ("MD5".equals(a) || "SHA1".equals(a) || "SHA224".equals(a) || "SHA256".equals(a)) { |
| 94 | return 64; |
| 95 | } |
| 96 | if ("SHA384".equals(a) || "SHA512".equals(a)) { |
| 97 | return 128; |
| 98 | } |
| 99 | throw new CryptoException("unsupported HMAC algorithm: " + algorithm); |
| 100 | } |
| 101 | |
| 102 | /// Resets the running HMAC so the instance can be reused with the same key. |
| 103 | public void reset() { |