Home | History | Annotate | Line # | Download | only in hash
hmac.3 revision 1.2
 $NetBSD: hmac.3,v 1.2 2016/07/01 22:56:06 christos Exp $

.Dd July 1, 2016 .Dt HMAC 3 .Os .Sh NAME .Nm hmac , .Nd Compute a key-Hash Message Authentication Code .Sh LIBRARY .Lb libc .Sh SYNOPSIS n stdlib.h .Ft ssize_t .Fn hmac "const char *hname" "const void *key" "size_t klen" "const void *text" "size_t tlen" "void *digest" "size_t dlen" .Sh DESCRIPTION The .Fn hmac function computes the key-Hash Message Authentication Code per .%R RFC 2104 and places the result in .Fa digest writing up to .Fa dlen bytes. The actual number of bytes that would be written is returned.

p The hash functions supported are: md2, md4, md5, rmd160, sha1, sha224, sha256, sha384, sha512. .Sh RETURN VALUES The .Fn hmac returns .Dv -1 if the .Fa hname is not found. Otherwise the actual length of the digest string is returned (which could be bigger or smaller than .Fa dlen ) . This length depends on the hashing function selected. .Sh SEE ALSO .Xr md2 3 , .Xr md4 3 , .Xr md5 3 , .Xr rmd160 3 , .Xr sha1 3 , .Xr sha2 3 .Sh STANDARDS .%R RFC 2104 .Sh NOTES The maximum digest length has been extended from .Dv 64 to .Dv 128 bytes to handle SHA2. .Sh HISTORY The .Fn hmac function appeared in .Nx 8