1SHA256_INIT(3ossl)                  OpenSSL                 SHA256_INIT(3ossl)
2
3
4

NAME

6       SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init,
7       SHA224_Update, SHA224_Final, SHA256, SHA256_Init, SHA256_Update,
8       SHA256_Final, SHA384, SHA384_Init, SHA384_Update, SHA384_Final, SHA512,
9       SHA512_Init, SHA512_Update, SHA512_Final - Secure Hash Algorithm
10

SYNOPSIS

12        #include <openssl/sha.h>
13
14        unsigned char *SHA1(const unsigned char *data, size_t count, unsigned char *md_buf);
15        unsigned char *SHA224(const unsigned char *data, size_t count, unsigned char *md_buf);
16        unsigned char *SHA256(const unsigned char *data, size_t count, unsigned char *md_buf);
17        unsigned char *SHA384(const unsigned char *data, size_t count, unsigned char *md_buf);
18        unsigned char *SHA512(const unsigned char *data, size_t count, unsigned char *md_buf);
19
20       The following functions have been deprecated since OpenSSL 3.0, and can
21       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
22       version value, see openssl_user_macros(7):
23
24        int SHA1_Init(SHA_CTX *c);
25        int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
26        int SHA1_Final(unsigned char *md, SHA_CTX *c);
27
28        int SHA224_Init(SHA256_CTX *c);
29        int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
30        int SHA224_Final(unsigned char *md, SHA256_CTX *c);
31
32        int SHA256_Init(SHA256_CTX *c);
33        int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
34        int SHA256_Final(unsigned char *md, SHA256_CTX *c);
35
36        int SHA384_Init(SHA512_CTX *c);
37        int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
38        int SHA384_Final(unsigned char *md, SHA512_CTX *c);
39
40        int SHA512_Init(SHA512_CTX *c);
41        int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
42        int SHA512_Final(unsigned char *md, SHA512_CTX *c);
43

DESCRIPTION

45       All of the functions described on this page except for SHA1(),
46       SHA224(), SHA256(), SHA384() and SHA512() are deprecated.  Applications
47       should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and
48       EVP_DigestFinal_ex(3), or the quick one-shot function EVP_Q_digest(3).
49       SHA1(), SHA224(), SHA256(), SHA384(), and SHA256() can continue to be
50       used. They can also be replaced by, e.g.,
51
52           (EVP_Q_digest(d, n, md, NULL, NULL, "SHA256", NULL) ? md : NULL)
53
54       SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
55       160 bit output.
56
57       SHA1() computes the SHA-1 message digest of the n bytes at d and places
58       it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of
59       output). If md is NULL, the digest is placed in a static array. Note:
60       setting md to NULL is not thread safe.
61
62       The following functions may be used if the message is not completely
63       stored in memory:
64
65       SHA1_Init() initializes a SHA_CTX structure.
66
67       SHA1_Update() can be called repeatedly with chunks of the message to be
68       hashed (len bytes at data).
69
70       SHA1_Final() places the message digest in md, which must have space for
71       SHA_DIGEST_LENGTH == 20 bytes of output, and erases the SHA_CTX.
72
73       The SHA224, SHA256, SHA384 and SHA512 families of functions operate in
74       the same way as for the SHA1 functions. Note that SHA224 and SHA256 use
75       a SHA256_CTX object instead of SHA_CTX. SHA384 and SHA512 use
76       SHA512_CTX.  The buffer md must have space for the output from the SHA
77       variant being used (defined by SHA224_DIGEST_LENGTH,
78       SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and SHA512_DIGEST_LENGTH).
79       Also note that, as for the SHA1() function above, the SHA224(),
80       SHA256(), SHA384() and SHA512() functions are not thread safe if md is
81       NULL.
82

RETURN VALUES

84       SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to
85       the hash value.
86
87       SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224,
88       SHA256, SHA384 and SHA512 functions return 1 for success, 0 otherwise.
89

CONFORMING TO

91       US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash
92       Standard), ANSI X9.30
93

SEE ALSO

95       EVP_Q_digest(3), EVP_DigestInit(3)
96

HISTORY

98       All of these functions except SHA*() were deprecated in OpenSSL 3.0.
99
101       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
102
103       Licensed under the Apache License 2.0 (the "License").  You may not use
104       this file except in compliance with the License.  You can obtain a copy
105       in the file LICENSE in the source distribution or at
106       <https://www.openssl.org/source/license.html>.
107
108
109
1103.0.9                             2023-07-27                SHA256_INIT(3ossl)
Impressum