sha512.3 (d491167b38cb63185ae1a73e92f6226c3bb5b85a) sha512.3 (2768d7056727c414241ebc4b9d26e62dd5460760)
1.\"
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.\" ----------------------------------------------------------------------------
8.\"
9.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
10.\" $FreeBSD$
11.\"
1.\"
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.\" ----------------------------------------------------------------------------
8.\"
9.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
10.\" $FreeBSD$
11.\"
12.Dd May 21, 2019
12.Dd February 3, 2023
13.Dt SHA512 3
14.Os
15.Sh NAME
16.Nm SHA512_Init ,
17.Nm SHA512_Update ,
18.Nm SHA512_Final ,
19.Nm SHA512_End ,
20.Nm SHA512_File ,
21.Nm SHA512_FileChunk ,
22.Nm SHA512_Data ,
23.Nm SHA384_Init ,
24.Nm SHA384_Update ,
25.Nm SHA384_Final ,
26.Nm SHA384_End ,
27.Nm SHA384_File ,
28.Nm SHA384_FileChunk ,
29.Nm SHA384_Data ,
13.Dt SHA512 3
14.Os
15.Sh NAME
16.Nm SHA512_Init ,
17.Nm SHA512_Update ,
18.Nm SHA512_Final ,
19.Nm SHA512_End ,
20.Nm SHA512_File ,
21.Nm SHA512_FileChunk ,
22.Nm SHA512_Data ,
23.Nm SHA384_Init ,
24.Nm SHA384_Update ,
25.Nm SHA384_Final ,
26.Nm SHA384_End ,
27.Nm SHA384_File ,
28.Nm SHA384_FileChunk ,
29.Nm SHA384_Data ,
30.Nm SHA512_224_Init ,
31.Nm SHA512_224_Update ,
32.Nm SHA512_224_Final ,
33.Nm SHA512_224_End ,
34.Nm SHA512_224_File ,
35.Nm SHA512_224_FileChunk ,
36.Nm SHA512_224_Data
30.Nm SHA512_256_Init ,
31.Nm SHA512_256_Update ,
32.Nm SHA512_256_Final ,
33.Nm SHA512_256_End ,
34.Nm SHA512_256_File ,
35.Nm SHA512_256_FileChunk ,
36.Nm SHA512_256_Data
37.Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests

--- 28 unchanged lines hidden (view full) ---

66.Ft "char *"
67.Fn SHA384_File "const char *filename" "char *buf"
68.Ft "char *"
69.Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
70.Ft "char *"
71.Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf"
72.In sha512t.h
73.Ft void
37.Nm SHA512_256_Init ,
38.Nm SHA512_256_Update ,
39.Nm SHA512_256_Final ,
40.Nm SHA512_256_End ,
41.Nm SHA512_256_File ,
42.Nm SHA512_256_FileChunk ,
43.Nm SHA512_256_Data
44.Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests

--- 28 unchanged lines hidden (view full) ---

73.Ft "char *"
74.Fn SHA384_File "const char *filename" "char *buf"
75.Ft "char *"
76.Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
77.Ft "char *"
78.Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf"
79.In sha512t.h
80.Ft void
81.Fn SHA512_224_Init "SHA512_CTX *context"
82.Ft void
83.Fn SHA512_224_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
84.Ft void
85.Fn SHA512_224_Final "unsigned char digest[32]" "SHA512_CTX *context"
86.Ft "char *"
87.Fn SHA512_224_End "SHA512_CTX *context" "char *buf"
88.Ft "char *"
89.Fn SHA512_224_File "const char *filename" "char *buf"
90.Ft "char *"
91.Fn SHA512_224_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
92.Ft "char *"
93.Fn SHA512_224_Data "const unsigned char *data" "unsigned int len" "char *buf"
94.Ft void
74.Fn SHA512_256_Init "SHA512_CTX *context"
75.Ft void
76.Fn SHA512_256_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
77.Ft void
78.Fn SHA512_256_Final "unsigned char digest[32]" "SHA512_CTX *context"
79.Ft "char *"
80.Fn SHA512_256_End "SHA512_CTX *context" "char *buf"
81.Ft "char *"

--- 32 unchanged lines hidden (view full) ---

114which will also erase the
115.Vt SHA512_CTX .
116.Pp
117.Fn SHA512_End
118is a wrapper for
119.Fn SHA512_Final
120which converts the return value to a 129-character
121(including the terminating '\e0')
95.Fn SHA512_256_Init "SHA512_CTX *context"
96.Ft void
97.Fn SHA512_256_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len"
98.Ft void
99.Fn SHA512_256_Final "unsigned char digest[32]" "SHA512_CTX *context"
100.Ft "char *"
101.Fn SHA512_256_End "SHA512_CTX *context" "char *buf"
102.Ft "char *"

--- 32 unchanged lines hidden (view full) ---

135which will also erase the
136.Vt SHA512_CTX .
137.Pp
138.Fn SHA512_End
139is a wrapper for
140.Fn SHA512_Final
141which converts the return value to a 129-character
142(including the terminating '\e0')
122.Tn ASCII
123string which represents the 512 bits in hexadecimal.
143ASCII string which represents the 512 bits in hexadecimal.
124.Pp
125.Fn SHA512_File
126calculates the digest of a file, and uses
127.Fn SHA512_End
128to return the result.
129If the file cannot be opened, a null pointer is returned.
130.Fn SHA512_FileChunk
131is similar to

--- 30 unchanged lines hidden (view full) ---

162and subsequently must be explicitly deallocated using
163.Xr free 3
164after use.
165If the
166.Fa buf
167argument is non-null it must point to at least 129 characters of buffer space.
168.Pp
169The
144.Pp
145.Fn SHA512_File
146calculates the digest of a file, and uses
147.Fn SHA512_End
148to return the result.
149If the file cannot be opened, a null pointer is returned.
150.Fn SHA512_FileChunk
151is similar to

--- 30 unchanged lines hidden (view full) ---

182and subsequently must be explicitly deallocated using
183.Xr free 3
184after use.
185If the
186.Fa buf
187argument is non-null it must point to at least 129 characters of buffer space.
188.Pp
189The
170.Li SHA384_
190.Li SHA384_ ,
191.Li SHA512_224 ,
171and
172.Li SHA512_256_
173functions are identical to the
174.Li SHA512_
175functions except they use a different initial hash value and the output is
192and
193.Li SHA512_256_
194functions are identical to the
195.Li SHA512_
196functions except they use a different initial hash value and the output is
176truncated to 384 bits and 256 bits respectively.
197truncated to 384, 224, and 256 bits respectively.
177.Pp
178.Fn SHA384_End
179is a wrapper for
180.Fn SHA384_Final
181which converts the return value to a 97-character
182(including the terminating '\e0')
198.Pp
199.Fn SHA384_End
200is a wrapper for
201.Fn SHA384_Final
202which converts the return value to a 97-character
203(including the terminating '\e0')
204ASCII string which represents the 384 bits in hexadecimal.
205.Pp
206.Fn SHA512_224_End
207is a wrapper for
208.Fn SHA512_Final
209which converts the return value to a 57-character
210(including the terminating '\e0')
211ASCII string which represents the 224 bits in hexadecimal.
212.Pp
213.Fn SHA512_224_End
214is a wrapper for
215.Fn SHA512_Final
216which converts the return value to a 57-character
217(including the terminating '\e0')
183.Tn ASCII
218.Tn ASCII
184string which represents the 384 bits in hexadecimal.
219string which represents the 224 bits in hexadecimal.
185.Pp
186.Fn SHA512_256_End
187is a wrapper for
188.Fn SHA512_Final
189which converts the return value to a 65-character
190(including the terminating '\e0')
220.Pp
221.Fn SHA512_256_End
222is a wrapper for
223.Fn SHA512_Final
224which converts the return value to a 65-character
225(including the terminating '\e0')
191.Tn ASCII
192string which represents the 256 bits in hexadecimal.
226ASCII string which represents the 256 bits in hexadecimal.
193.Sh ERRORS
194The
195.Fn SHA512_End
196function called with a null buf argument may fail and return NULL if:
197.Bl -tag -width Er
198.It Bq Er ENOMEM
199Insufficient storage space is available.
200.El

--- 17 unchanged lines hidden (view full) ---

218.Xr sha256 3 ,
219.Xr sha512 3 ,
220.Xr skein 3
221.Sh HISTORY
222These functions appeared in
223.Fx 9.0 .
224.Sh AUTHORS
225The core hash routines were implemented by Colin Percival based on
227.Sh ERRORS
228The
229.Fn SHA512_End
230function called with a null buf argument may fail and return NULL if:
231.Bl -tag -width Er
232.It Bq Er ENOMEM
233Insufficient storage space is available.
234.El

--- 17 unchanged lines hidden (view full) ---

252.Xr sha256 3 ,
253.Xr sha512 3 ,
254.Xr skein 3
255.Sh HISTORY
256These functions appeared in
257.Fx 9.0 .
258.Sh AUTHORS
259The core hash routines were implemented by Colin Percival based on
226the published
227.Tn FIPS 180-2
228standard.
260the published FIPS 180-2 standard.
229.Sh BUGS
230No method is known to exist which finds two files having the same hash value,
231nor to find a file with a specific hash value.
232There is on the other hand no guarantee that such a method does not exist.
261.Sh BUGS
262No method is known to exist which finds two files having the same hash value,
263nor to find a file with a specific hash value.
264There is on the other hand no guarantee that such a method does not exist.