1SHA256_INIT(3) OpenSSL SHA256_INIT(3)
2
3
4
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
12 #include <openssl/sha.h>
13
14 int SHA1_Init(SHA_CTX *c);
15 int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
16 int SHA1_Final(unsigned char *md, SHA_CTX *c);
17 unsigned char *SHA1(const unsigned char *d, size_t n,
18 unsigned char *md);
19
20 int SHA224_Init(SHA256_CTX *c);
21 int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
22 int SHA224_Final(unsigned char *md, SHA256_CTX *c);
23 unsigned char *SHA224(const unsigned char *d, size_t n,
24 unsigned char *md);
25
26 int SHA256_Init(SHA256_CTX *c);
27 int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
28 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
29 unsigned char *SHA256(const unsigned char *d, size_t n,
30 unsigned char *md);
31
32 int SHA384_Init(SHA512_CTX *c);
33 int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
34 int SHA384_Final(unsigned char *md, SHA512_CTX *c);
35 unsigned char *SHA384(const unsigned char *d, size_t n,
36 unsigned char *md);
37
38 int SHA512_Init(SHA512_CTX *c);
39 int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
40 int SHA512_Final(unsigned char *md, SHA512_CTX *c);
41 unsigned char *SHA512(const unsigned char *d, size_t n,
42 unsigned char *md);
43
45 Applications should use the higher level functions EVP_DigestInit(3)
46 etc. instead of calling the hash functions directly.
47
48 SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
49 160 bit output.
50
51 SHA1() computes the SHA-1 message digest of the n bytes at d and places
52 it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of
53 output). If md is NULL, the digest is placed in a static array. Note:
54 setting md to NULL is not thread safe.
55
56 The following functions may be used if the message is not completely
57 stored in memory:
58
59 SHA1_Init() initializes a SHA_CTX structure.
60
61 SHA1_Update() can be called repeatedly with chunks of the message to be
62 hashed (len bytes at data).
63
64 SHA1_Final() places the message digest in md, which must have space for
65 SHA_DIGEST_LENGTH == 20 bytes of output, and erases the SHA_CTX.
66
67 The SHA224, SHA256, SHA384 and SHA512 families of functions operate in
68 the same way as for the SHA1 functions. Note that SHA224 and SHA256 use
69 a SHA256_CTX object instead of SHA_CTX. SHA384 and SHA512 use
70 SHA512_CTX. The buffer md must have space for the output from the SHA
71 variant being used (defined by SHA224_DIGEST_LENGTH,
72 SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and SHA512_DIGEST_LENGTH).
73 Also note that, as for the SHA1() function above, the SHA224(),
74 SHA256(), SHA384() and SHA512() functions are not thread safe if md is
75 NULL.
76
78 SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to
79 the hash value.
80
81 SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224,
82 SHA256, SHA384 and SHA512 functions return 1 for success, 0 otherwise.
83
85 US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash
86 Standard), ANSI X9.30
87
89 EVP_DigestInit(3)
90
92 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
93
94 Licensed under the OpenSSL license (the "License"). You may not use
95 this file except in compliance with the License. You can obtain a copy
96 in the file LICENSE in the source distribution or at
97 <https://www.openssl.org/source/license.html>.
98
99
100
1011.1.1l 2021-09-15 SHA256_INIT(3)