|
|
@ -1,4 +1,4 @@ |
|
|
|
.\" $OpenBSD: sha2.3,v 1.11 2004/06/22 01:57:29 jfb Exp $ |
|
|
|
.\" $OpenBSD: sha2.3,v 1.12 2005/09/12 10:33:29 jmc Exp $ |
|
|
|
.\" |
|
|
|
.\" Copyright (c) 2003, 2004 Todd C. Miller <Todd.Miller@courtesan.com> |
|
|
|
.\" |
|
|
@ -146,7 +146,7 @@ function is used by |
|
|
|
to hash 512-bit blocks and forms the core of the algorithm. |
|
|
|
Most programs should use the interface provided by |
|
|
|
.Fn SHA256_Init , |
|
|
|
.Fn SHA256_Update |
|
|
|
.Fn SHA256_Update , |
|
|
|
and |
|
|
|
.Fn SHA256_Final |
|
|
|
instead of calling |
|
|
@ -167,7 +167,9 @@ function calculates the digest for a file and returns the result via |
|
|
|
.Fn SHA256_End . |
|
|
|
If |
|
|
|
.Fn SHA256_File |
|
|
|
is unable to open the file, a NULL pointer is returned. |
|
|
|
is unable to open the file, a |
|
|
|
.Dv NULL |
|
|
|
pointer is returned. |
|
|
|
.Pp |
|
|
|
.Fn SHA256_FileChunk |
|
|
|
behaves like |
|
|
@ -203,11 +205,13 @@ functions the |
|
|
|
parameter should either be a string large enough to hold the resulting digest |
|
|
|
(e.g.\& |
|
|
|
.Ev SHA256_DIGEST_STRING_LENGTH , |
|
|
|
.Ev SHA384_DIGEST_STRING_LENGTH |
|
|
|
.Ev SHA384_DIGEST_STRING_LENGTH , |
|
|
|
or |
|
|
|
.Ev SHA512_DIGEST_STRING_LENGTH , |
|
|
|
depending on the function being used) |
|
|
|
or a NULL pointer. |
|
|
|
or a |
|
|
|
.Dv NULL |
|
|
|
pointer. |
|
|
|
In the latter case, space will be dynamically allocated via |
|
|
|
.Xr malloc 3 |
|
|
|
and should be freed using |
|
|
@ -232,7 +236,7 @@ SHA256_Final(results, &ctx); |
|
|
|
|
|
|
|
/* Print the digest as one long hex value */ |
|
|
|
printf("0x"); |
|
|
|
for (n = 0; n < SHA256_DIGEST_LENGTH; n++) |
|
|
|
for (n = 0; n \*(Lt SHA256_DIGEST_LENGTH; n++) |
|
|
|
printf("%02x", results[n]); |
|
|
|
putchar('\en'); |
|
|
|
.Ed |
|
|
@ -272,7 +276,7 @@ helper functions are derived from code written by Poul-Henning Kamp. |
|
|
|
This implementation of the Secure Hash Standard has not been validated by |
|
|
|
NIST and as such is not in official compliance with the standard. |
|
|
|
.Pp |
|
|
|
If a message digest is to be copied to a multi-byte type (ie: |
|
|
|
If a message digest is to be copied to a multi-byte type (i.e.\& |
|
|
|
an array of five 32-bit integers) it will be necessary to |
|
|
|
perform byte swapping on little endian machines such as the i386, alpha, |
|
|
|
and vax. |