/[cvs]/ccvs/lib/md5.h
ViewVC logotype

Diff of /ccvs/lib/md5.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by dprice, Mon May 23 17:44:31 2005 UTC revision 1.7 by dprice, Mon Sep 19 16:24:56 2005 UTC
# Line 1  Line 1 
1  /* md5.h - Declaration of functions and data types used for MD5 sum  /* Declaration of functions and data types used for MD5 sum computing
2     computing library functions.     library functions.
3       Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1999, 2000, 2003, 2004 Free Software  
    Foundation, Inc.  
4    
5     NOTE: The canonical source of this file is maintained with the GNU C     NOTE: The canonical source of this file is maintained with the GNU C
6     Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.     Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
# Line 33  Line 31 
31  # include <stdint.h>  # include <stdint.h>
32  #endif  #endif
33    
34    #ifndef __GNUC_PREREQ
35    # if defined __GNUC__ && defined __GNUC_MINOR__
36    #  define __GNUC_PREREQ(maj, min) \
37            ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
38    # else
39    #  define __GNUC_PREREQ(maj, min) 0
40    # endif
41    #endif
42    
43    #ifndef __THROW
44    # if defined __cplusplus && __GNUC_PREREQ (2,8)
45    #  define __THROW       throw ()
46    # else
47    #  define __THROW
48    # endif
49    #endif
50    
51    #ifndef __attribute__
52    # if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
53    #  define __attribute__(x)
54    # endif
55    #endif
56    
57    #ifndef _LIBC
58    # define __md5_buffer md5_buffer
59    # define __md5_finish_ctx md5_finish_ctx
60    # define __md5_init_ctx md5_init_ctx
61    # define __md5_process_block md5_process_block
62    # define __md5_process_bytes md5_process_bytes
63    # define __md5_read_ctx md5_read_ctx
64    # define __md5_stream md5_stream
65    #endif
66    
67  typedef uint32_t md5_uint32;  typedef uint32_t md5_uint32;
68    
69  /* Structure to save state of computation between the single steps.  */  /* Structure to save state of computation between the single steps.  */
# Line 45  struct md5_ctx Line 76  struct md5_ctx
76    
77    md5_uint32 total[2];    md5_uint32 total[2];
78    md5_uint32 buflen;    md5_uint32 buflen;
79    char buffer[128];    char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
80  };  };
81    
82  /*  /*
# Line 55  struct md5_ctx Line 86  struct md5_ctx
86    
87  /* Initialize structure containing state of computation.  /* Initialize structure containing state of computation.
88     (RFC 1321, 3.3: Step 3)  */     (RFC 1321, 3.3: Step 3)  */
89  extern void md5_init_ctx (struct md5_ctx *ctx);  extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
90    
91  /* Starting with the result of former calls of this function (or the  /* Starting with the result of former calls of this function (or the
92     initialization function update the context for the next LEN bytes     initialization function update the context for the next LEN bytes
93     starting at BUFFER.     starting at BUFFER.
94     It is necessary that LEN is a multiple of 64!!! */     It is necessary that LEN is a multiple of 64!!! */
95  extern void md5_process_block (const void *buffer, size_t len,  extern void __md5_process_block (const void *buffer, size_t len,
96                                 struct md5_ctx *ctx);                                   struct md5_ctx *ctx) __THROW;
97    
98  /* Starting with the result of former calls of this function (or the  /* Starting with the result of former calls of this function (or the
99     initialization function update the context for the next LEN bytes     initialization function update the context for the next LEN bytes
100     starting at BUFFER.     starting at BUFFER.
101     It is NOT required that LEN is a multiple of 64.  */     It is NOT required that LEN is a multiple of 64.  */
102  extern void md5_process_bytes (const void *buffer, size_t len,  extern void __md5_process_bytes (const void *buffer, size_t len,
103                                 struct md5_ctx *ctx);                                   struct md5_ctx *ctx) __THROW;
104    
105  /* Process the remaining bytes in the buffer and put result from CTX  /* Process the remaining bytes in the buffer and put result from CTX
106     in first 16 bytes following RESBUF.  The result is always in little     in first 16 bytes following RESBUF.  The result is always in little
# Line 78  extern void md5_process_bytes (const voi Line 109  extern void md5_process_bytes (const voi
109    
110     IMPORTANT: On some systems it is required that RESBUF be correctly     IMPORTANT: On some systems it is required that RESBUF be correctly
111     aligned for a 32 bits value.  */     aligned for a 32 bits value.  */
112  extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);  extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
113    
114    
115  /* Put result from CTX in first 16 bytes following RESBUF.  The result is  /* Put result from CTX in first 16 bytes following RESBUF.  The result is
# Line 87  extern void *md5_finish_ctx (struct md5_ Line 118  extern void *md5_finish_ctx (struct md5_
118    
119     IMPORTANT: On some systems it is required that RESBUF is correctly     IMPORTANT: On some systems it is required that RESBUF is correctly
120     aligned for a 32 bits value.  */     aligned for a 32 bits value.  */
121  extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);  extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
122    
123    
124  /* Compute MD5 message digest for bytes read from STREAM.  The  /* Compute MD5 message digest for bytes read from STREAM.  The
125     resulting message digest number will be written into the 16 bytes     resulting message digest number will be written into the 16 bytes
126     beginning at RESBLOCK.  */     beginning at RESBLOCK.  */
127  extern int md5_stream (FILE *stream, void *resblock);  extern int __md5_stream (FILE *stream, void *resblock) __THROW;
128    
129  /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The  /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
130     result is always in little endian byte order, so that a byte-wise     result is always in little endian byte order, so that a byte-wise
131     output yields to the wanted ASCII representation of the message     output yields to the wanted ASCII representation of the message
132     digest.  */     digest.  */
133  extern void *md5_buffer (const char *buffer, size_t len, void *resblock);  extern void *__md5_buffer (const char *buffer, size_t len,
134                               void *resblock) __THROW;
135    
136  #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )  #endif /* md5.h */
   
 #endif  

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26