Advertisement
FlyFar

md5/md5.h

May 16th, 2024
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.68 KB | Cybersecurity | 0 0
  1.  
  2.  
  3. #ifndef _MD5_H
  4. #define _MD5_H 1
  5.  
  6. #include <stdio.h>
  7.  
  8. #if defined HAVE_LIMITS_H || _LIBC
  9. # include <limits.h>
  10. #endif
  11.  
  12.  
  13. #ifdef _LIBC
  14. # include <sys/types.h>
  15. typedef u_int32_t md5_uint32;
  16. #else
  17. # if defined __STDC__ && __STDC__
  18. #  define UINT_MAX_32_BITS 4294967295U
  19. # else
  20. #  define UINT_MAX_32_BITS 0xFFFFFFFF
  21. # endif
  22.  
  23.  
  24. # ifndef UINT_MAX
  25. #  define UINT_MAX UINT_MAX_32_BITS
  26. # endif
  27.  
  28. # if UINT_MAX == UINT_MAX_32_BITS
  29.    typedef unsigned int md5_uint32;
  30. # else
  31. #  if USHRT_MAX == UINT_MAX_32_BITS
  32.     typedef unsigned short md5_uint32;
  33. #  else
  34. #   if ULONG_MAX == UINT_MAX_32_BITS
  35.      typedef unsigned long md5_uint32;
  36. #   else
  37.      /* The following line is intended to evoke an error.
  38.         Using #error is not portable enough.  */
  39.      "Cannot determine unsigned 32-bit data type."
  40. #   endif
  41. #  endif
  42. # endif
  43. #endif
  44.  
  45. #undef __P
  46. #if defined (__STDC__) && __STDC__
  47. #define __P(x) x
  48. #else
  49. #define __P(x) ()
  50. #endif
  51.  
  52.  
  53. struct md5_ctx
  54. {
  55.   md5_uint32 A;
  56.   md5_uint32 B;
  57.   md5_uint32 C;
  58.   md5_uint32 D;
  59.  
  60.   md5_uint32 total[2];
  61.   md5_uint32 buflen;
  62.   char buffer[128];
  63. };
  64.  
  65.  
  66. extern void md5_init_ctx __P ((struct md5_ctx *ctx));
  67.  
  68.  
  69. extern void md5_process_block __P ((const void *buffer, size_t len,
  70.                     struct md5_ctx *ctx));
  71.  
  72. extern void md5_process_bytes __P ((const void *buffer, size_t len,
  73.                     struct md5_ctx *ctx));
  74.  
  75.  
  76. extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
  77.  
  78.  
  79.  
  80. extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
  81.  
  82.  
  83.  
  84. extern int md5_stream __P ((FILE *stream, void *resblock));
  85.  
  86.  
  87. extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
  88.  
  89. #endif
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement