MirBSD manpage: whirlpool(3), WHIRLPOOLData(3), WHIRLPOOLEnd(3), WHIRLPOOLFile(3), WHIRLPOOLFileChunk(3), WHIRLPOOLFinal(3), WHIRLPOOLInit(3), WHIRLPOOLPad(3), WHIRLPOOLUpdate(3)

WHIRLPOOL(3)               BSD Programmer's Manual                WHIRLPOOL(3)

NAME

     WHIRLPOOLInit, WHIRLPOOLUpdate, WHIRLPOOLPad, WHIRLPOOLFinal,
     WHIRLPOOLEnd, WHIRLPOOLFile, WHIRLPOOLFileChunk, WHIRLPOOLData -
      calculate the WHIRLPOOL message digest

SYNOPSIS

     #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);

DESCRIPTION

     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.

EXAMPLES

     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));

SEE ALSO

     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

HISTORY

     The WHIRLPOOL functions appeared in MirBSD #10.

AUTHORS

     The reference implementation of WHIRLPOOL was written by Paulo S. L. M.
     Barreto <pbarreto@scopus.com.br> and
     Vincent Rijmen <vincent.rijmen@cryptomathic.com> and was dedicated into
     public domain. It has been tweaked for inclusion into MirBSD by
     Thorsten Glaser <tg@mirbsd.de> 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.

MirBSD #10-current            September 4, 2020                              1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung