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
37 .Nm SKEIN256_FileChunk ,
44 .Nm SKEIN512_FileChunk ,
47 .Nm SKEIN1024_Update ,
51 .Nm SKEIN1024_FileChunk ,
53 .Nd calculate the ``SKEIN'' family of message digests
60 .Fn SKEIN256_Init "SKEIN256_CTX *context"
62 .Fn SKEIN256_Update "SKEIN256_CTX *context" "const unsigned char *data" "size_t len"
64 .Fn SKEIN256_Final "unsigned char digest[32]" "SKEIN256_CTX *context"
66 .Fn SKEIN256_End "SKEIN256_CTX *context" "char *buf"
68 .Fn SKEIN256_File "const char *filename" "char *buf"
70 .Fn SKEIN256_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
72 .Fn SKEIN256_Data "const unsigned char *data" "unsigned int len" "char *buf"
74 .Fn SKEIN512_Init "SKEIN512_CTX *context"
76 .Fn SKEIN512_Update "SKEIN512_CTX *context" "const unsigned char *data" "size_t len"
78 .Fn SKEIN512_Final "unsigned char digest[64]" "SKEIN512_CTX *context"
80 .Fn SKEIN512_End "SKEIN512_CTX *context" "char *buf"
82 .Fn SKEIN512_File "const char *filename" "char *buf"
84 .Fn SKEIN512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
86 .Fn SKEIN512_Data "const unsigned char *data" "unsigned int len" "char *buf"
88 .Fn SKEIN1024_Init "SKEIN1024_CTX *context"
90 .Fn SKEIN1024_Update "SKEIN1024_CTX *context" "const unsigned char *data" "size_t len"
92 .Fn SKEIN1024_Final "unsigned char digest[128]" "SKEIN1024_CTX *context"
94 .Fn SKEIN1024_End "SKEIN1024_CTX *context" "char *buf"
96 .Fn SKEIN1024_File "const char *filename" "char *buf"
98 .Fn SKEIN1024_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
100 .Fn SKEIN1024_Data "const unsigned char *data" "unsigned int len" "char *buf"
103 is a new family of cryptographic hash functions based on the
106 Its design combines speed, security, simplicity, and a great deal of
107 flexibility in a modular package that is easy to analyze.
109 is defined for three different internal state sizes\(em256 bits, 512 bits, and
110 1024 bits\(emand any output size.
111 This allows Skein to be a drop-in replacement for the entire SHA family
116 .Fn SKEIN256_Update ,
119 functions are the core functions.
124 run over the data with
125 .Fn SKEIN256_Update ,
126 and finally extract the result using
128 which will also erase the
134 which converts the return value to a 33-character
135 (including the terminating '\e0')
137 string which represents the 256 bits in hexadecimal.
140 calculates the digest of a file, and uses
142 to return the result.
143 If the file cannot be opened, a null pointer is returned.
144 .Fn SKEIN256_FileChunk
147 but it only calculates the digest over a byte-range of the file specified,
155 parameter is specified as 0, or more than the length of the remaining part
157 .Fn SKEIN256_FileChunk
158 calculates the digest from
162 calculates the digest of a chunk of data in memory, and uses
164 to return the result.
173 argument can be a null pointer, in which case the returned string
176 and subsequently must be explicitly deallocated using
181 argument is non-null it must point to at least 33 characters of buffer space.
187 functions are similar to the
189 functions except they produce a 512-bit, 65 character,
190 or 1024-bit, 129 character, output.
194 function called with a null buf argument may fail and return NULL if:
197 Insufficient storage space is available.
203 .Fn SKEIN256_FileChunk
204 may return NULL when underlying
219 These functions appeared in
223 The core hash routines were imported from version 1.3 of the optimized
224 Skein reference implementation written by
226 as submitted to the NSA SHA-3 contest.
227 The algorithms were developed by
233 .An Tadayoshi Kohno ,