---
name: "SKEIN1024_Data"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/SKEIN1024_Data"
---

# SKEIN1024\_Data(3)

calculate the \`\`SKEIN'' family of message digests

## NAME

**SKEIN256\_Init**, **SKEIN256\_Update**, **SKEIN256\_Final**, **SKEIN256\_End**, **SKEIN256\_Fd**, **SKEIN256\_FdChunk**, **SKEIN256\_File**, **SKEIN256\_FileChunk**, **SKEIN256\_Data**, **SKEIN512\_Init**, **SKEIN512\_Update**, **SKEIN512\_Final**, **SKEIN512\_End**, **SKEIN512\_Fd**, **SKEIN512\_FdChunk**, **SKEIN512\_File**, **SKEIN512\_FileChunk**, **SKEIN512\_Data**, **SKEIN1024\_Init**, **SKEIN1024\_Update**, **SKEIN1024\_Final**, **SKEIN1024\_End**, **SKEIN1024\_Fd**, **SKEIN1024\_FdChunk**, **SKEIN1024\_File**, **SKEIN1024\_FileChunk**, **SKEIN1024\_Data** – calculate the \`\`SKEIN'' family of message digests

## LIBRARY

library “libmd”

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<skein.h\>**

*void*\

**SKEIN256\_Init**(*SKEIN256\_CTX \*context*);

*void*\

**SKEIN256\_Update**(*SKEIN256\_CTX \*context*, *const unsigned char \*data*, *size\_t len*);

*void*\

**SKEIN256\_Final**(*unsigned char digest\[32\]*, *SKEIN256\_CTX \*context*);

*char \**\

**SKEIN256\_End**(*SKEIN256\_CTX \*context*, *char \*buf*);

*char \**\

**SKEIN256\_Fd**(*int fd*, *char \*buf*);

*char \**\

**SKEIN256\_FdChunk**(*int fd*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN256\_File**(*const char \*filename*, *char \*buf*);

*char \**\

**SKEIN256\_FileChunk**(*const char \*filename*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN256\_Data**(*const unsigned char \*data*, *unsigned int len*, *char \*buf*);

*void*\

**SKEIN512\_Init**(*SKEIN512\_CTX \*context*);

*void*\

**SKEIN512\_Update**(*SKEIN512\_CTX \*context*, *const unsigned char \*data*, *size\_t len*);

*void*\

**SKEIN512\_Final**(*unsigned char digest\[64\]*, *SKEIN512\_CTX \*context*);

*char \**\

**SKEIN512\_End**(*SKEIN512\_CTX \*context*, *char \*buf*);

*char \**\

**SKEIN512\_Fd**(*int fd*, *char \*buf*);

*char \**\

**SKEIN512\_FdChunk**(*int fd*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN512\_File**(*const char \*filename*, *char \*buf*);

*char \**\

**SKEIN512\_FileChunk**(*const char \*filename*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN512\_Data**(*const unsigned char \*data*, *unsigned int len*, *char \*buf*);

*void*\

**SKEIN1024\_Init**(*SKEIN1024\_CTX \*context*);

*void*\

**SKEIN1024\_Update**(*SKEIN1024\_CTX \*context*, *const unsigned char \*data*, *size\_t len*);

*void*\

**SKEIN1024\_Final**(*unsigned char digest\[128\]*, *SKEIN1024\_CTX \*context*);

*char \**\

**SKEIN1024\_End**(*SKEIN1024\_CTX \*context*, *char \*buf*);

*char \**\

**SKEIN1024\_Fd**(*int fd*, *char \*buf*);

*char \**\

**SKEIN1024\_FdChunk**(*int fd*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN1024\_File**(*const char \*filename*, *char \*buf*);

*char \**\

**SKEIN1024\_FileChunk**(*const char \*filename*, *char \*buf*, *off\_t offset*, *off\_t length*);

*char \**\

**SKEIN1024\_Data**(*const unsigned char \*data*, *unsigned int len*, *char \*buf*);

## DESCRIPTION

Skein is a new family of cryptographic hash functions based on the Threefish large-block cipher. Its design combines speed, security, simplicity, and a great deal of flexibility in a modular package that is easy to analyze. Skein is defined for three different internal state sizes—256 bits, 512 bits, and 1024 bits—and any output size. This allows Skein to be a drop-in replacement for the entire SHA family of hash functions.

The **SKEIN256\_Init**(), **SKEIN256\_Update**(), and **SKEIN256\_Final**() functions are the core functions. Allocate an *SKEIN256\_CTX*, initialize it with **SKEIN256\_Init**(), run over the data with **SKEIN256\_Update**(), and finally extract the result using **SKEIN256\_Final**(), which will also erase the *SKEIN256\_CTX*.

**SKEIN256\_End**() is a wrapper for **SKEIN256\_Final**() which converts the return value to a 33-character (including the terminating '\\0') ASCII string which represents the 256 bits in hexadecimal.

**SKEIN256\_File**() calculates the digest of a file, and uses **SKEIN256\_End**() to return the result. If the file cannot be opened, a null pointer is returned. **SKEIN256\_FileChunk**() is similar to **SKEIN256\_File**(), but it only calculates the digest over a byte-range of the file specified, starting at *offset* and spanning *length* bytes. If the *length* parameter is specified as 0, or more than the length of the remaining part of the file, **SKEIN256\_FileChunk**() calculates the digest from *offset* to the end of file. **SKEIN256\_Data**() calculates the digest of a chunk of data in memory, and uses **SKEIN256\_End**() to return the result.

The **SKEIN256\_Fd**() and **SKEIN256\_FdChunk**() functions are identical to their **SKEIN256\_File**() and **SKEIN256\_FileChunk**() counterparts, with the exception that the first argument is an *fd* instead of a *filename*.

When using **SKEIN256\_End**(), **SKEIN256\_File**(), or **SKEIN256\_Data**(), the *buf* argument can be a null pointer, in which case the returned string is allocated with [malloc(3)](/malloc/3.md) and subsequently must be explicitly deallocated using [free(3)](/free/3.md) after use. If the *buf* argument is non-null it must point to at least 33 characters of buffer space.

The SKEIN512\_ and SKEIN1024\_ functions are similar to the SKEIN256\_ functions except they produce a 512-bit, 65 character, or 1024-bit, 129 character, output.

## ERRORS

The **SKEIN256\_End**() function called with a null buf argument may fail and return NULL if:

- \[ENOMEM\]

  Insufficient storage space is available.

The **SKEIN256\_File**() and **SKEIN256\_FileChunk**() may return NULL when underlying [open(2)](/open/2.md), [fstat(2)](/fstat/2.md), [lseek(2)](/lseek/2.md), or [SKEIN256\_End(3)](/SKEIN256_End/3.md) fail.

## SEE ALSO

[md4(3)](/md4/3.md), [md5(3)](/md5/3.md), [ripemd(3)](/ripemd/3.md), [sha(3)](/sha/3.md), [sha256(3)](/sha256/3.md), [sha512(3)](/sha512/3.md)

## HISTORY

These functions appeared in FreeBSD 11.0.

## AUTHORS

The core hash routines were imported from version 1.3 of the optimized Skein reference implementation written by Doug Whiting as submitted to the NSA SHA-3 contest. The algorithms were developed by Niels Ferguson, Stefan Lucks, Bruce Schneier, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas, and Jesse Walker.
