Browse Source

correct hash for EXAMPLES, plus some typos;

from er, Charlie Root (PR 3506)
OPENBSD_3_5
jmc 21 years ago
parent
commit
a6a93c29bf
1 changed files with 10 additions and 8 deletions
  1. +10
    -8
      src/lib/libc/hash/sha2.3

+ 10
- 8
src/lib/libc/hash/sha2.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sha2.3,v 1.4 2003/06/17 21:56:23 millert Exp $
.\" $OpenBSD: sha2.3,v 1.5 2003/10/03 13:57:39 jmc Exp $
.\" .\"
.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> .\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
.\" .\"
@ -85,8 +85,8 @@ bits as input.
The SHA2 functions are considered to be more secure than the The SHA2 functions are considered to be more secure than the
.Xr sha1 3 .Xr sha1 3
functions with which they share a similar interface. functions with which they share a similar interface.
The 256, 384, and 512 bit versions of SHA2 share the same interface.
For brevity, only the 256 bit variants are described below.
The 256, 384, and 512-bit versions of SHA2 share the same interface.
For brevity, only the 256-bit variants are described below.
.Pp .Pp
The The
.Fn SHA256_Init .Fn SHA256_Init
@ -130,7 +130,7 @@ function calculates the digest for a file and returns the result via
.Fn SHA256_End . .Fn SHA256_End .
If If
.Fn SHA256_File .Fn SHA256_File
is unable to open the file a NULL pointer is returned.
is unable to open the file, a NULL pointer is returned.
.Pp .Pp
The The
.Fn SHA256_Data .Fn SHA256_Data
@ -146,7 +146,7 @@ and
functions the functions the
.Ar buf .Ar buf
parameter should either be a string large enough to hold the resulting digest parameter should either be a string large enough to hold the resulting digest
(e.g.
(e.g.\&
.Ev SHA256_DIGEST_STRING_LENGTH , .Ev SHA256_DIGEST_STRING_LENGTH ,
.Ev SHA384_DIGEST_STRING_LENGTH .Ev SHA384_DIGEST_STRING_LENGTH
or or
@ -159,8 +159,10 @@ and should be freed using
.Xr free 3 .Xr free 3
when it is no longer needed. when it is no longer needed.
.Sh EXAMPLES .Sh EXAMPLES
The follow code fragment will calculate the digest for
the string "abc" which is ``0xa9993e36476816aba3e25717850c26c9cd0d89d''.
The following code fragment will calculate the SHA-256 digest for the string
.Qq abc ,
which is
.Dq 0xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad .
.Bd -literal -offset indent .Bd -literal -offset indent
SHA256_CTX ctx; SHA256_CTX ctx;
u_int8_t results[SHA256_DIGEST_LENGTH]; u_int8_t results[SHA256_DIGEST_LENGTH];
@ -201,7 +203,7 @@ printf("0x%s\en", SHA256_Data(buf, strlen(buf), output));
The SHA2 functions appeared in The SHA2 functions appeared in
.Ox 3.4 . .Ox 3.4 .
.Sh AUTHORS .Sh AUTHORS
This implementation of the SHA fucntions was written by Aaron D. Gifford.
This implementation of the SHA functions was written by Aaron D. Gifford.
.Pp .Pp
The The
.Fn SHA256_End , .Fn SHA256_End ,


Loading…
Cancel
Save