"Fossies" - the Fresh Open Source Software Archive

Member "zsync-0.6.2/librcksum/md4.h" (16 Sep 2010, 1886 Bytes) of package /linux/privat/old/zsync-0.6.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "md4.h" see the Fossies "Dox" file reference documentation.

    1 /*  $OpenBSD: md4.h,v 1.15 2004/06/22 01:57:30 jfb Exp $    */
    2 
    3 /*
    4  * This code implements the MD4 message-digest algorithm.
    5  * The algorithm is due to Ron Rivest.  This code was
    6  * written by Colin Plumb in 1993, no copyright is claimed.
    7  * This code is in the public domain; do with it what you wish.
    8  * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
    9  *
   10  * Equivalent code is available from RSA Data Security, Inc.
   11  * This code has been tested against that, and is equivalent,
   12  * except that you don't need to include two pages of legalese
   13  * with every copy.
   14  */
   15 
   16 #ifndef _MD4_H_
   17 #define _MD4_H_
   18 
   19 #include "zsglobal.h"
   20 
   21 #ifdef HAVE_INTTYPES_H
   22 #include <inttypes.h>
   23 #else
   24 #include <sys/types.h>
   25 #endif
   26 
   27 #define MD4_BLOCK_LENGTH        64
   28 #define MD4_DIGEST_LENGTH       16
   29 #define MD4_DIGEST_STRING_LENGTH    (MD4_DIGEST_LENGTH * 2 + 1)
   30 
   31 typedef struct MD4Context {
   32     uint32_t state[4];          /* state */
   33     uint64_t count;         /* number of bits, mod 2^64 */
   34     uint8_t buffer[MD4_BLOCK_LENGTH];   /* input buffer */
   35 } MD4_CTX;
   36 
   37 void     MD4Init(MD4_CTX *);
   38 void     MD4Update(MD4_CTX *, const uint8_t *, size_t)
   39         ZS_DECL_BOUNDED(__string__,2,3);
   40 void     MD4Pad(MD4_CTX *);
   41 void     MD4Final(uint8_t [MD4_DIGEST_LENGTH], MD4_CTX *)
   42         ZS_DECL_BOUNDED(__minbytes__,1,MD4_DIGEST_LENGTH);
   43 void     MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
   44         ZS_DECL_BOUNDED(__minbytes__,1,4)
   45         ZS_DECL_BOUNDED(__minbytes__,2,MD4_BLOCK_LENGTH);
   46 char    *MD4End(MD4_CTX *, char *)
   47         ZS_DECL_BOUNDED(__minbytes__,2,MD4_DIGEST_STRING_LENGTH);
   48 char    *MD4File(const char *, char *)
   49         ZS_DECL_BOUNDED(__minbytes__,2,MD4_DIGEST_STRING_LENGTH);
   50 char    *MD4FileChunk(const char *, char *, off_t, off_t)
   51         ZS_DECL_BOUNDED(__minbytes__,2,MD4_DIGEST_STRING_LENGTH);
   52 char    *MD4Data(const uint8_t *, size_t, char *)
   53         ZS_DECL_BOUNDED(__string__,1,2)
   54         ZS_DECL_BOUNDED(__minbytes__,3,MD4_DIGEST_STRING_LENGTH);
   55 
   56 #endif /* _MD4_H_ */