Param build: make structures opaque.
[openssl.git] / doc / man3 / SHA256_Init.pod
1 =pod
2
3 =head1 NAME
4
5 SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update,
6 SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384,
7 SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update,
8 SHA512_Final - Secure Hash Algorithm
9
10 =head1 SYNOPSIS
11
12  #include <openssl/sha.h>
13
14 Deprecated since OpenSSL 3.0, can be hidden entirely by defining
15 B<OPENSSL_API_COMPAT> with a suitable version value, see
16 L<openssl_user_macros(7)>:
17
18  int SHA1_Init(SHA_CTX *c);
19  int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
20  int SHA1_Final(unsigned char *md, SHA_CTX *c);
21  unsigned char *SHA1(const unsigned char *d, size_t n,
22                      unsigned char *md);
23
24  int SHA224_Init(SHA256_CTX *c);
25  int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
26  int SHA224_Final(unsigned char *md, SHA256_CTX *c);
27  unsigned char *SHA224(const unsigned char *d, size_t n,
28                        unsigned char *md);
29
30  int SHA256_Init(SHA256_CTX *c);
31  int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
32  int SHA256_Final(unsigned char *md, SHA256_CTX *c);
33  unsigned char *SHA256(const unsigned char *d, size_t n,
34                        unsigned char *md);
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  unsigned char *SHA384(const unsigned char *d, size_t n,
40                        unsigned char *md);
41
42  int SHA512_Init(SHA512_CTX *c);
43  int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
44  int SHA512_Final(unsigned char *md, SHA512_CTX *c);
45  unsigned char *SHA512(const unsigned char *d, size_t n,
46                        unsigned char *md);
47
48 =head1 DESCRIPTION
49
50 All of the functions described on this page are deprecated.
51 Applications should instead use L<EVP_DigestInit_ex(3)>, L<EVP_DigestUpdate(3)>
52 and L<EVP_DigestFinal_ex(3)>.
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 B<n>
58 bytes at B<d> and places it in B<md> (which must have space for
59 SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
60 is placed in a static array. Note: setting B<md> to NULL is B<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 B<SHA_CTX> structure.
66
67 SHA1_Update() can be called repeatedly with chunks of the message to
68 be hashed (B<len> bytes at B<data>).
69
70 SHA1_Final() places the message digest in B<md>, which must have space
71 for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>.
72
73 The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the
74 same way as for the SHA1 functions. Note that SHA224 and SHA256 use a
75 B<SHA256_CTX> object instead of B<SHA_CTX>. SHA384 and SHA512 use B<SHA512_CTX>.
76 The buffer B<md> must have space for the output from the SHA variant being used
77 (defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and
78 SHA512_DIGEST_LENGTH). Also note that, as for the SHA1() function above, the
79 SHA224(), SHA256(), SHA384() and SHA512() functions are not thread safe if
80 B<md> is NULL.
81
82 The predecessor of SHA-1, SHA, is also implemented, but it should be
83 used only when backward compatibility is required.
84
85 =head1 RETURN VALUES
86
87 SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to the hash
88 value.
89
90 SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224, SHA256,
91 SHA384 and SHA512 functions return 1 for success, 0 otherwise.
92
93 =head1 CONFORMING TO
94
95 US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash
96 Standard),
97 ANSI X9.30
98
99 =head1 SEE ALSO
100
101 L<EVP_DigestInit(3)>
102
103 =head1 HISTORY
104
105 All of these functions were deprecated in OpenSSL 3.0.
106
107 =head1 COPYRIGHT
108
109 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
110
111 Licensed under the Apache License 2.0 (the "License").  You may not use
112 this file except in compliance with the License.  You can obtain a copy
113 in the file LICENSE in the source distribution or at
114 L<https://www.openssl.org/source/license.html>.
115
116 =cut