WHIRLPOOL(3) BSD Programmer's Manual WHIRLPOOL(3)
WHIRLPOOLInit, WHIRLPOOLUpdate, WHIRLPOOLPad, WHIRLPOOLFinal, WHIRLPOOLEnd, WHIRLPOOLFile, WHIRLPOOLFileChunk, WHIRLPOOLData - calcu- late the WHIRLPOOL message digest
#include <sys/types.h> #include <whirlpool.h> void WHIRLPOOLInit(WHIRLPOOL_CTX *ctx); void WHIRLPOOLUpdate(WHIRLPOOL_CTX *ctx, const uint8_t *data, size_t noctets); void WHIRLPOOLPad(WHIRLPOOL_CTX *ctx); void WHIRLPOOLFinal(uint8_t digest[WHIRLPOOL_DIGEST_LENGTH], WHIRLPOOL_CTX *ctx); char * WHIRLPOOLEnd(WHIRLPOOL_CTX *ctx, char *digest); char * WHIRLPOOLFile(const char *filename, char *digest); char * WHIRLPOOLFileChunk(const char *filename, char *digest, off_t offset, off_t length); char * WHIRLPOOLData(const uint8_t *data, size_t len, char *digest);
The WHIRLPOOL functions implement the 512-bit WHIRLPOOL message digest hash algorithm. The WHIRLPOOL functions are of a different family than the md4(3), md5(3), rmd160(3), sha1(3), and sha2(3) functions, as well of a different family from the tiger(3) functions and, despite not having been cryp- tanalysed that much, are considered pretty secure. All share a similar interface, though. The WHIRLPOOLInit() function initialises a WHIRLPOOL_CTX context for use with WHIRLPOOLUpdate() and WHIRLPOOLFinal(). The WHIRLPOOLUpdate() func- tion adds (condenses) data of length noctets to the context. WHIRLPOOLFi- nal() is called after processing and stores a message digest in the digest parameter. For a description of the other functions, please refer e.g. the rmd160(3) manual page.
The follow code fragment will calculate the digest for the string "abc", which is "4e2448a4c6f486bb16b6562c73b4020bf3043e3a731bce721ae1b303d97e6d4c\ 7181eebdb6c57e277d0e34957114cbd6c797fc9d95d8b582d225292076d4eef5". WHIRLPOOL_CTX context; uint8_t result[WHIRLPOOL_DIGEST_LENGTH]; const char buf = "abc"; size_t n = strlen(buf); WHIRLPOOLInit(&context); WHIRLPOOLUpdate(&context, buf, n); WHIRLPOOLFinal(result, &context); /* print the digest as one long sedecimal value */ printf("0x"); for (n = 0; n < WHIRLPOOL_DIGEST_LENGTH; n++) printf("%02x", result[n]); putchar('\n'); Alternately, the helper functions could be used in the following way: WHIRLPOOL_CTX context; uint8_t output[WHIRLPOOL_DIGEST_STRING_LENGTH]; const char buf = "abc"; printf("0x%s\n", WHIRLPOOLData(buf, strlen(buf), output));
cksum(1), adler32(3), md4(3), md5(3), rmd160(3), sfv(3), sha1(3), sha2(3), suma(3), tiger(3), http://planeta.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html
The WHIRLPOOL functions appeared in MirOS #10.
The reference implementation of WHIRLPOOL was written by Paulo S. L. M. Barreto <firstname.lastname@example.org> and Vincent Rijmen <email@example.com> and was dedicated into public domain. It has been tweaked for inclusion into MirOS by Thorsten Glaser <firstname.lastname@example.org> modelled after the TIGER implementation already in libc. The WHIRLPOOLEnd(), WHIRLPOOLFile(), WHIRLPOOLFileChunk(), and WHIRLPOOL- Data() helper functions are derived from code written by Poul-Henning Kamp. MirOS BSD #10-current November 22, 2009 1
Generated on 2015-10-06 19:36:22 by $MirOS: src/scripts/roff2htm,v 1.80 2015/01/02 13:54:19 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.