diff options
Diffstat (limited to 'lib/libc/hash/sha1.3')
-rw-r--r-- | lib/libc/hash/sha1.3 | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/libc/hash/sha1.3 b/lib/libc/hash/sha1.3 index 4d753ca7966..9b5b001d238 100644 --- a/lib/libc/hash/sha1.3 +++ b/lib/libc/hash/sha1.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sha1.3,v 1.26 2003/06/25 19:33:34 deraadt Exp $ +.\" $OpenBSD: sha1.3,v 1.27 2004/04/26 19:38:12 millert Exp $ .\" .\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> .\" @@ -35,17 +35,17 @@ .Ft void .Fn SHA1Init "SHA1_CTX *context" .Ft void -.Fn SHA1Update "SHA1_CTX *context" "const u_char *data" "u_int len" +.Fn SHA1Update "SHA1_CTX *context" "const u_int8_t *data" "u_int len" .Ft void -.Fn SHA1Final "u_char digest[20]" "SHA1_CTX *context" +.Fn SHA1Final "u_int8_t digest[SHA1_DIGEST_LENGTH]" "SHA1_CTX *context" .Ft void -.Fn SHA1Transform "u_int32_t state[5]" "u_char buffer[64]" +.Fn SHA1Transform "u_int32_t state[5]" "u_int8_t buffer[SHA1_BLOCK_LENGTH]" .Ft "char *" -.Fn SHA1End "SHA1_CTX *context" "char *buf" +.Fn SHA1End "SHA1_CTX *context" "char buf[SHA1_DIGEST_STRING_LENGTH]" .Ft "char *" -.Fn SHA1File "char *filename" "char *buf" +.Fn SHA1File "char *filename" "char buf[SHA1_DIGEST_STRING_LENGTH]" .Ft "char *" -.Fn SHA1Data "const u_char *data" "u_int len" "char *buf" +.Fn SHA1Data "const u_int8_t *data" "u_int len" "char buf[SHA1_DIGEST_STRING_LENGTH]" .Sh DESCRIPTION The SHA1 functions implement the NIST Secure Hash Algorithm (SHA-1), FIPS PUB 180-1. @@ -144,19 +144,19 @@ The follow code fragment will calculate the digest for the string "abc" which is ``0xa9993e36476816aba3e25717850c26c9cd0d89d''. .Bd -literal -offset indent SHA1_CTX sha; -u_char results[20]; +u_int8_t results[SHA1_DIGEST_LENGTH]; char *buf; int n; buf = "abc"; n = strlen(buf); SHA1Init(&sha); -SHA1Update(&sha, (u_char *)buf, n); +SHA1Update(&sha, (u_int8_t *)buf, n); SHA1Final(results, &sha); /* Print the digest as one long hex value */ printf("0x"); -for (n = 0; n < 20; n++) +for (n = 0; n < SHA1_DIGEST_LENGTH; n++) printf("%02x", results[n]); putchar('\en'); .Ed @@ -164,7 +164,7 @@ putchar('\en'); Alternately, the helper functions could be used in the following way: .Bd -literal -offset indent SHA1_CTX sha; -u_char output[41]; +u_int8_t output[SHA1_DIGEST_STRING_LENGTH]; char *buf = "abc"; printf("0x%s\en", SHA1Data(buf, strlen(buf), output)); |