File: //usr/local/openssl/man/man3/SHA224_Final.3
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "sha 3"
.TH sha 3 2019-12-20 1.0.2u OpenSSL
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update,
SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384,
SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update,
SHA512_Final \- Secure Hash Algorithm
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/sha.h>
\&
\& int SHA1_Init(SHA_CTX *c);
\& int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
\& int SHA1_Final(unsigned char *md, SHA_CTX *c);
\& unsigned char *SHA1(const unsigned char *d, size_t n,
\& unsigned char *md);
\&
\& int SHA224_Init(SHA256_CTX *c);
\& int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
\& int SHA224_Final(unsigned char *md, SHA256_CTX *c);
\& unsigned char *SHA224(const unsigned char *d, size_t n,
\& unsigned char *md);
\&
\& int SHA256_Init(SHA256_CTX *c);
\& int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
\& int SHA256_Final(unsigned char *md, SHA256_CTX *c);
\& unsigned char *SHA256(const unsigned char *d, size_t n,
\& unsigned char *md);
\&
\& int SHA384_Init(SHA512_CTX *c);
\& int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
\& int SHA384_Final(unsigned char *md, SHA512_CTX *c);
\& unsigned char *SHA384(const unsigned char *d, size_t n,
\& unsigned char *md);
\&
\& int SHA512_Init(SHA512_CTX *c);
\& int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
\& int SHA512_Final(unsigned char *md, SHA512_CTX *c);
\& unsigned char *SHA512(const unsigned char *d, size_t n,
\& unsigned char *md);
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
Applications should use the higher level functions
\&\fBEVP_DigestInit\fR\|(3) etc. instead of calling the hash
functions directly.
.PP
SHA\-1 (Secure Hash Algorithm) is a cryptographic hash function with a
160 bit output.
.PP
\&\fBSHA1()\fR computes the SHA\-1 message digest of the \fBn\fR
bytes at \fBd\fR and places it in \fBmd\fR (which must have space for
SHA_DIGEST_LENGTH == 20 bytes of output). If \fBmd\fR is NULL, the digest
is placed in a static array. Note: setting \fBmd\fR to NULL is \fBnot thread safe\fR.
.PP
The following functions may be used if the message is not completely
stored in memory:
.PP
\&\fBSHA1_Init()\fR initializes a \fBSHA_CTX\fR structure.
.PP
\&\fBSHA1_Update()\fR can be called repeatedly with chunks of the message to
be hashed (\fBlen\fR bytes at \fBdata\fR).
.PP
\&\fBSHA1_Final()\fR places the message digest in \fBmd\fR, which must have space
for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the \fBSHA_CTX\fR.
.PP
The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the
same way as for the SHA1 functions. Note that SHA224 and SHA256 use a
\&\fBSHA256_CTX\fR object instead of \fBSHA_CTX\fR. SHA384 and SHA512 use \fBSHA512_CTX\fR.
The buffer \fBmd\fR must have space for the output from the SHA variant being used
(defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and
SHA512_DIGEST_LENGTH). Also note that, as for the \fBSHA1()\fR function above, the
\&\fBSHA224()\fR, \fBSHA256()\fR, \fBSHA384()\fR and \fBSHA512()\fR functions are not thread safe if
\&\fBmd\fR is NULL.
.PP
The predecessor of SHA\-1, SHA, is also implemented, but it should be
used only when backward compatibility is required.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fBSHA1()\fR, \fBSHA224()\fR, \fBSHA256()\fR, \fBSHA384()\fR and \fBSHA512()\fR return a pointer to the hash
value.
.PP
\&\fBSHA1_Init()\fR, \fBSHA1_Update()\fR and \fBSHA1_Final()\fR and equivalent SHA224, SHA256,
SHA384 and SHA512 functions return 1 for success, 0 otherwise.
.SH "CONFORMING TO"
.IX Header "CONFORMING TO"
US Federal Information Processing Standard FIPS PUB 180\-4 (Secure Hash
Standard),
ANSI X9.30
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBripemd\fR\|(3), \fBhmac\fR\|(3), \fBEVP_DigestInit\fR\|(3)
.SH HISTORY
.IX Header "HISTORY"
\&\fBSHA1()\fR, \fBSHA1_Init()\fR, \fBSHA1_Update()\fR and \fBSHA1_Final()\fR are available in all
versions of SSLeay and OpenSSL.