Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libmd/sha512.3
.\" | .\" | ||||
.\" ---------------------------------------------------------------------------- | .\" ---------------------------------------------------------------------------- | ||||
.\" "THE BEER-WARE LICENSE" (Revision 42): | .\" "THE BEER-WARE LICENSE" (Revision 42): | ||||
.\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you | .\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you | ||||
.\" can do whatever you want with this stuff. If we meet some day, and you think | .\" can do whatever you want with this stuff. If we meet some day, and you think | ||||
.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp | .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp | ||||
.\" ---------------------------------------------------------------------------- | .\" ---------------------------------------------------------------------------- | ||||
.\" | .\" | ||||
.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp | .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd March 28, 2014 | .Dd October 17, 2015 | ||||
.Dt SHA512 3 | .Dt SHA512 3 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm SHA512_Init , | .Nm SHA512_Init , | ||||
.Nm SHA512_Update , | .Nm SHA512_Update , | ||||
.Nm SHA512_Final , | .Nm SHA512_Final , | ||||
.Nm SHA512_End , | .Nm SHA512_End , | ||||
.Nm SHA512_File , | .Nm SHA512_File , | ||||
.Nm SHA512_FileChunk , | .Nm SHA512_FileChunk , | ||||
.Nm SHA512_Data | .Nm SHA512_Data , | ||||
.Nd calculate the FIPS 180-2 ``SHA-512'' message digest | .Nm SHA384_Init , | ||||
.Nm SHA384_Update , | |||||
.Nm SHA384_Final , | |||||
.Nm SHA384_End , | |||||
.Nm SHA384_File , | |||||
.Nm SHA384_FileChunk , | |||||
.Nm SHA384_Data | |||||
.Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests | |||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libmd | .Lb libmd | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/types.h | .In sys/types.h | ||||
.In sha512.h | .In sha512.h | ||||
.Ft void | .Ft void | ||||
.Fn SHA512_Init "SHA512_CTX *context" | .Fn SHA512_Init "SHA512_CTX *context" | ||||
.Ft void | .Ft void | ||||
.Fn SHA512_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len" | .Fn SHA512_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len" | ||||
.Ft void | .Ft void | ||||
.Fn SHA512_Final "unsigned char digest[64]" "SHA512_CTX *context" | .Fn SHA512_Final "unsigned char digest[64]" "SHA512_CTX *context" | ||||
.Ft "char *" | .Ft "char *" | ||||
.Fn SHA512_End "SHA512_CTX *context" "char *buf" | .Fn SHA512_End "SHA512_CTX *context" "char *buf" | ||||
.Ft "char *" | .Ft "char *" | ||||
.Fn SHA512_File "const char *filename" "char *buf" | .Fn SHA512_File "const char *filename" "char *buf" | ||||
.Ft "char *" | .Ft "char *" | ||||
.Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" | .Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" | ||||
.Ft "char *" | .Ft "char *" | ||||
.Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" | .Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" | ||||
.Ft void | |||||
.Fn SHA384_Init "SHA384_CTX *context" | |||||
.Ft void | |||||
.Fn SHA384_Update "SHA384_CTX *context" "const unsigned char *data" "size_t len" | |||||
.Ft void | |||||
.Fn SHA384_Final "unsigned char digest[48]" "SHA384_CTX *context" | |||||
.Ft "char *" | |||||
.Fn SHA384_End "SHA384_CTX *context" "char *buf" | |||||
.Ft "char *" | |||||
.Fn SHA384_File "const char *filename" "char *buf" | |||||
.Ft "char *" | |||||
.Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" | |||||
.Ft "char *" | |||||
.Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf" | |||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Li SHA512_ | .Li SHA512_ | ||||
functions calculate a 512-bit cryptographic checksum (digest) | functions calculate a 512-bit cryptographic checksum (digest) | ||||
for any number of input bytes. | for any number of input bytes. | ||||
A cryptographic checksum is a one-way | A cryptographic checksum is a one-way | ||||
hash function; that is, it is computationally impractical to find | hash function; that is, it is computationally impractical to find | ||||
the input corresponding to a particular output. | the input corresponding to a particular output. | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
is allocated with | is allocated with | ||||
.Xr malloc 3 | .Xr malloc 3 | ||||
and subsequently must be explicitly deallocated using | and subsequently must be explicitly deallocated using | ||||
.Xr free 3 | .Xr free 3 | ||||
after use. | after use. | ||||
If the | If the | ||||
.Fa buf | .Fa buf | ||||
argument is non-null it must point to at least 65 characters of buffer space. | argument is non-null it must point to at least 65 characters of buffer space. | ||||
.Pp | |||||
The | |||||
.Li SHA384_ | |||||
functions are identical to the | |||||
.Li SHA512_ | |||||
functions except they use a different initial hash value and the output is | |||||
truncated to 384 bits. | |||||
.Pp | |||||
.Fn SHA384_End | |||||
is a wrapper for | |||||
.Fn SHA384_Final | |||||
which converts the return value to a 49-character | |||||
(including the terminating '\e0') | |||||
.Tn ASCII | |||||
string which represents the 384 bits in hexadecimal. | |||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr md4 3 , | .Xr md4 3 , | ||||
.Xr md5 3 , | .Xr md5 3 , | ||||
.Xr ripemd 3 , | .Xr ripemd 3 , | ||||
.Xr sha 3 | .Xr sha 3 | ||||
.Sh HISTORY | .Sh HISTORY | ||||
These functions appeared in | These functions appeared in | ||||
.Fx 9.0 . | .Fx 9.0 . | ||||
Show All 9 Lines |