2 .\" Copyright (c) 2016 Allan Jude
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nm SKEIN256_FdChunk ,
37 .Nm SKEIN256_FileChunk ,
44 .Nm SKEIN512_FdChunk ,
46 .Nm SKEIN512_FileChunk ,
49 .Nm SKEIN1024_Update ,
53 .Nm SKEIN1024_FdChunk ,
55 .Nm SKEIN1024_FileChunk ,
57 .Nd calculate the ``SKEIN'' family of message digests
64 .Fn SKEIN256_Init "SKEIN256_CTX *context"
66 .Fn SKEIN256_Update "SKEIN256_CTX *context" "const unsigned char *data" "size_t len"
68 .Fn SKEIN256_Final "unsigned char digest[32]" "SKEIN256_CTX *context"
70 .Fn SKEIN256_End "SKEIN256_CTX *context" "char *buf"
72 .Fn SKEIN256_Fd "int fd" "char *buf"
74 .Fn SKEIN256_FdChunk "int fd" "char *buf" "off_t offset" "off_t length"
76 .Fn SKEIN256_File "const char *filename" "char *buf"
78 .Fn SKEIN256_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
80 .Fn SKEIN256_Data "const unsigned char *data" "unsigned int len" "char *buf"
82 .Fn SKEIN512_Init "SKEIN512_CTX *context"
84 .Fn SKEIN512_Update "SKEIN512_CTX *context" "const unsigned char *data" "size_t len"
86 .Fn SKEIN512_Final "unsigned char digest[64]" "SKEIN512_CTX *context"
88 .Fn SKEIN512_End "SKEIN512_CTX *context" "char *buf"
90 .Fn SKEIN512_Fd "int fd" "char *buf"
92 .Fn SKEIN512_FdChunk "int fd" "char *buf" "off_t offset" "off_t length"
94 .Fn SKEIN512_File "const char *filename" "char *buf"
96 .Fn SKEIN512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
98 .Fn SKEIN512_Data "const unsigned char *data" "unsigned int len" "char *buf"
100 .Fn SKEIN1024_Init "SKEIN1024_CTX *context"
102 .Fn SKEIN1024_Update "SKEIN1024_CTX *context" "const unsigned char *data" "size_t len"
104 .Fn SKEIN1024_Final "unsigned char digest[128]" "SKEIN1024_CTX *context"
106 .Fn SKEIN1024_End "SKEIN1024_CTX *context" "char *buf"
108 .Fn SKEIN1024_Fd "int fd" "char *buf"
110 .Fn SKEIN1024_FdChunk "int fd" "char *buf" "off_t offset" "off_t length"
112 .Fn SKEIN1024_File "const char *filename" "char *buf"
114 .Fn SKEIN1024_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
116 .Fn SKEIN1024_Data "const unsigned char *data" "unsigned int len" "char *buf"
119 is a new family of cryptographic hash functions based on the
122 Its design combines speed, security, simplicity, and a great deal of
123 flexibility in a modular package that is easy to analyze.
125 is defined for three different internal state sizes\(em256 bits, 512 bits, and
126 1024 bits\(emand any output size.
127 This allows Skein to be a drop-in replacement for the entire SHA family
132 .Fn SKEIN256_Update ,
135 functions are the core functions.
140 run over the data with
141 .Fn SKEIN256_Update ,
142 and finally extract the result using
144 which will also erase the
150 which converts the return value to a 33-character
151 (including the terminating '\e0')
152 ASCII string which represents the 256 bits in hexadecimal.
155 calculates the digest of a file, and uses
157 to return the result.
158 If the file cannot be opened, a null pointer is returned.
159 .Fn SKEIN256_FileChunk
162 but it only calculates the digest over a byte-range of the file specified,
170 parameter is specified as 0, or more than the length of the remaining part
172 .Fn SKEIN256_FileChunk
173 calculates the digest from
177 calculates the digest of a chunk of data in memory, and uses
179 to return the result.
185 functions are identical to their
188 .Fn SKEIN256_FileChunk
189 counterparts, with the exception that the first argument is an
201 argument can be a null pointer, in which case the returned string
204 and subsequently must be explicitly deallocated using
209 argument is non-null it must point to at least 33 characters of buffer space.
215 functions are similar to the
217 functions except they produce a 512-bit, 65 character,
218 or 1024-bit, 129 character, output.
222 function called with a null buf argument may fail and return NULL if:
225 Insufficient storage space is available.
231 .Fn SKEIN256_FileChunk
232 may return NULL when underlying
247 These functions appeared in
251 The core hash routines were imported from version 1.3 of the optimized
252 Skein reference implementation written by
254 as submitted to the NSA SHA-3 contest.
255 The algorithms were developed by
261 .An Tadayoshi Kohno ,