authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2020-10-04 10:19:30+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-10-15 20:50:34-04:00
logcb44f27104937682ffaa42ec133e56595e4f08d0
tree04e29b53b10c4db6c4ea31985e333b92e4e0cdc1
parenta66449c1edbd14f66cb0a87316d16f26121af353

std/crypto/hmac: remove HmacBlake2s256 definition

HMAC is a generic construction, so we allow it to be instantiated with any hash function. In practice, HMAC is almost exclusively used with MD5, SHA1 and SHA2, so it makes sense to define some shortcuts for them. However, defining `HmacBlake2s256` is a bit weird (and why specifically that one, and not other hash functions we also support?). There would be nothing wrong with that construction, but it's not used in any standard protocol and would be a curious choice. BLAKE2 being a keyed hash function, it doesn't need HMAC to be used as a MAC, so that also doesn't make it a good example of a possible hash function for HMAC. This commit doesn't remove the ability to use a Hmac(Blake2s256) type if, for some reason, applications really need this, but it removes HmacBlake2s256 as a constant.

1 files changed, 0 insertions(+), 4 deletions(-)

lib/std/crypto/hmac.zig-4
......@@ -18,10 +18,6 @@ pub const sha2 = struct {
1818 pub const HmacSha512 = Hmac(crypto.hash.sha2.Sha512);
1919};
2020
21pub const blake2 = struct {
22 pub const HmacBlake2s256 = Hmac(crypto.hash.blake2.Blake2s256);
23};
24
2521pub fn Hmac(comptime Hash: type) type {
2622 return struct {
2723 const Self = @This();