2 .\" ----------------------------------------------------------------------------
3 .\" "THE BEER-WARE LICENSE" (Revision 42):
4 .\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 .\" can do whatever you want with this stuff. If we meet some day, and you think
6 .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 .\" ----------------------------------------------------------------------------
9 .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
20 .Nm SHA512_FileChunk ,
27 .Nm SHA384_FileChunk ,
30 .Nm SHA512_224_Update ,
31 .Nm SHA512_224_Final ,
34 .Nm SHA512_224_FileChunk ,
37 .Nm SHA512_256_Update ,
38 .Nm SHA512_256_Final ,
41 .Nm SHA512_256_FileChunk ,
43 .Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests
50 .Fn SHA512_Init "SHA512_CTX *context"
52 .Fn SHA512_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
54 .Fn SHA512_Final "unsigned char digest[64]" "SHA512_CTX *context"
56 .Fn SHA512_End "SHA512_CTX *context" "char *buf"
58 .Fn SHA512_File "const char *filename" "char *buf"
60 .Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
62 .Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf"
65 .Fn SHA384_Init "SHA384_CTX *context"
67 .Fn SHA384_Update "SHA384_CTX *context" "const unsigned char *data" "size_t len"
69 .Fn SHA384_Final "unsigned char digest[48]" "SHA384_CTX *context"
71 .Fn SHA384_End "SHA384_CTX *context" "char *buf"
73 .Fn SHA384_File "const char *filename" "char *buf"
75 .Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
77 .Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf"
80 .Fn SHA512_224_Init "SHA512_CTX *context"
82 .Fn SHA512_224_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
84 .Fn SHA512_224_Final "unsigned char digest[32]" "SHA512_CTX *context"
86 .Fn SHA512_224_End "SHA512_CTX *context" "char *buf"
88 .Fn SHA512_224_File "const char *filename" "char *buf"
90 .Fn SHA512_224_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
92 .Fn SHA512_224_Data "const unsigned char *data" "unsigned int len" "char *buf"
94 .Fn SHA512_256_Init "SHA512_CTX *context"
96 .Fn SHA512_256_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
98 .Fn SHA512_256_Final "unsigned char digest[32]" "SHA512_CTX *context"
100 .Fn SHA512_256_End "SHA512_CTX *context" "char *buf"
102 .Fn SHA512_256_File "const char *filename" "char *buf"
104 .Fn SHA512_256_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
106 .Fn SHA512_256_Data "const unsigned char *data" "unsigned int len" "char *buf"
110 functions calculate a 512-bit cryptographic checksum (digest)
111 for any number of input bytes.
112 A cryptographic checksum is a one-way
113 hash function; that is, it is computationally impractical to find
114 the input corresponding to a particular output.
118 of the input-data, which does not disclose the actual input.
125 functions are the core functions.
130 run over the data with
132 and finally extract the result using
134 which will also erase the
140 which converts the return value to a 129-character
141 (including the terminating '\e0')
142 ASCII string which represents the 512 bits in hexadecimal.
145 calculates the digest of a file, and uses
147 to return the result.
148 If the file cannot be opened, a null pointer is returned.
152 but it only calculates the digest over a byte-range of the file specified,
160 parameter is specified as 0, or more than the length of the remaining part
163 calculates the digest from
167 calculates the digest of a chunk of data in memory, and uses
169 to return the result.
178 argument can be a null pointer, in which case the returned string
181 and subsequently must be explicitly deallocated using
186 argument is non-null it must point to at least 129 characters of buffer space.
193 functions are identical to the
195 functions except they use a different initial hash value and the output is
196 truncated to 384, 224, and 256 bits respectively.
201 which converts the return value to a 97-character
202 (including the terminating '\e0')
203 ASCII string which represents the 384 bits in hexadecimal.
208 which converts the return value to a 57-character
209 (including the terminating '\e0')
210 ASCII string which represents the 224 bits in hexadecimal.
215 which converts the return value to a 57-character
216 (including the terminating '\e0')
218 string which represents the 224 bits in hexadecimal.
223 which converts the return value to a 65-character
224 (including the terminating '\e0')
225 ASCII string which represents the 256 bits in hexadecimal.
229 function called with a null buf argument may fail and return NULL if:
232 Insufficient storage space is available.
239 may return NULL when underlying
255 These functions appeared in
258 The core hash routines were implemented by Colin Percival based on
259 the published FIPS 180-2 standard.
261 No method is known to exist which finds two files having the same hash value,
262 nor to find a file with a specific hash value.
263 There is on the other hand no guarantee that such a method does not exist.