Blame doc/man3/SHA256_Init.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update,
Packit c4476c
SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384,
Packit c4476c
SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update,
Packit c4476c
SHA512_Final - Secure Hash Algorithm
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/sha.h>
Packit c4476c
Packit c4476c
 int SHA1_Init(SHA_CTX *c);
Packit c4476c
 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
Packit c4476c
 int SHA1_Final(unsigned char *md, SHA_CTX *c);
Packit c4476c
 unsigned char *SHA1(const unsigned char *d, size_t n,
Packit c4476c
                     unsigned char *md);
Packit c4476c
Packit c4476c
 int SHA224_Init(SHA256_CTX *c);
Packit c4476c
 int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
Packit c4476c
 int SHA224_Final(unsigned char *md, SHA256_CTX *c);
Packit c4476c
 unsigned char *SHA224(const unsigned char *d, size_t n,
Packit c4476c
                       unsigned char *md);
Packit c4476c
Packit c4476c
 int SHA256_Init(SHA256_CTX *c);
Packit c4476c
 int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
Packit c4476c
 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
Packit c4476c
 unsigned char *SHA256(const unsigned char *d, size_t n,
Packit c4476c
                       unsigned char *md);
Packit c4476c
Packit c4476c
 int SHA384_Init(SHA512_CTX *c);
Packit c4476c
 int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
Packit c4476c
 int SHA384_Final(unsigned char *md, SHA512_CTX *c);
Packit c4476c
 unsigned char *SHA384(const unsigned char *d, size_t n,
Packit c4476c
                       unsigned char *md);
Packit c4476c
Packit c4476c
 int SHA512_Init(SHA512_CTX *c);
Packit c4476c
 int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
Packit c4476c
 int SHA512_Final(unsigned char *md, SHA512_CTX *c);
Packit c4476c
 unsigned char *SHA512(const unsigned char *d, size_t n,
Packit c4476c
                       unsigned char *md);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
Applications should use the higher level functions
Packit c4476c
L<EVP_DigestInit(3)> etc. instead of calling the hash
Packit c4476c
functions directly.
Packit c4476c
Packit c4476c
SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
Packit c4476c
160 bit output.
Packit c4476c
Packit c4476c
SHA1() computes the SHA-1 message digest of the B<n>
Packit c4476c
bytes at B<d> and places it in B<md> (which must have space for
Packit c4476c
SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
Packit c4476c
is placed in a static array. Note: setting B<md> to NULL is B<not thread safe>.
Packit c4476c
Packit c4476c
The following functions may be used if the message is not completely
Packit c4476c
stored in memory:
Packit c4476c
Packit c4476c
SHA1_Init() initializes a B<SHA_CTX> structure.
Packit c4476c
Packit c4476c
SHA1_Update() can be called repeatedly with chunks of the message to
Packit c4476c
be hashed (B<len> bytes at B<data>).
Packit c4476c
Packit c4476c
SHA1_Final() places the message digest in B<md>, which must have space
Packit c4476c
for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>.
Packit c4476c
Packit c4476c
The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the
Packit c4476c
same way as for the SHA1 functions. Note that SHA224 and SHA256 use a
Packit c4476c
B<SHA256_CTX> object instead of B<SHA_CTX>. SHA384 and SHA512 use B<SHA512_CTX>.
Packit c4476c
The buffer B<md> must have space for the output from the SHA variant being used
Packit c4476c
(defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and
Packit c4476c
SHA512_DIGEST_LENGTH). Also note that, as for the SHA1() function above, the
Packit c4476c
SHA224(), SHA256(), SHA384() and SHA512() functions are not thread safe if
Packit c4476c
B<md> is NULL.
Packit c4476c
Packit c4476c
The predecessor of SHA-1, SHA, is also implemented, but it should be
Packit c4476c
used only when backward compatibility is required.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to the hash
Packit c4476c
value.
Packit c4476c
Packit c4476c
SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224, SHA256,
Packit c4476c
SHA384 and SHA512 functions return 1 for success, 0 otherwise.
Packit c4476c
Packit c4476c
=head1 CONFORMING TO
Packit c4476c
Packit c4476c
US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash
Packit c4476c
Standard),
Packit c4476c
ANSI X9.30
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<EVP_DigestInit(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut