1 |
/* crypto/md5/md5.h */ |
/* crypto/md5/md5.h */ |
2 |
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 |
* All rights reserved. |
* All rights reserved. |
4 |
* |
* |
5 |
* This package is an SSL implementation written |
* This package is an SSL implementation written |
63 |
extern "C" { |
extern "C" { |
64 |
#endif |
#endif |
65 |
|
|
66 |
|
#ifdef NO_MD5 |
67 |
|
#error MD5 is disabled. |
68 |
|
#endif |
69 |
|
|
70 |
|
/* |
71 |
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
72 |
|
* ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! |
73 |
|
* ! MD5_LONG_LOG2 has to be defined along. ! |
74 |
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
75 |
|
*/ |
76 |
|
|
77 |
|
#if defined(WIN16) || defined(__LP32__) |
78 |
|
#define MD5_LONG unsigned long |
79 |
|
#elif defined(_CRAY) || defined(__ILP64__) |
80 |
|
#define MD5_LONG unsigned long |
81 |
|
#define MD5_LONG_LOG2 3 |
82 |
|
/* |
83 |
|
* _CRAY note. I could declare short, but I have no idea what impact |
84 |
|
* does it have on performance on none-T3E machines. I could declare |
85 |
|
* int, but at least on C90 sizeof(int) can be chosen at compile time. |
86 |
|
* So I've chosen long... |
87 |
|
* <appro@fy.chalmers.se> |
88 |
|
*/ |
89 |
|
#else |
90 |
|
#define MD5_LONG unsigned int |
91 |
|
#endif |
92 |
|
|
93 |
#define MD5_CBLOCK 64 |
#define MD5_CBLOCK 64 |
94 |
#define MD5_LBLOCK 16 |
#define MD5_LBLOCK (MD5_CBLOCK/4) |
|
#define MD5_BLOCK 16 |
|
|
#define MD5_LAST_BLOCK 56 |
|
|
#define MD5_LENGTH_BLOCK 8 |
|
95 |
#define MD5_DIGEST_LENGTH 16 |
#define MD5_DIGEST_LENGTH 16 |
96 |
|
|
97 |
typedef struct MD5state_st |
typedef struct MD5state_st |
98 |
{ |
{ |
99 |
unsigned long A,B,C,D; |
MD5_LONG A,B,C,D; |
100 |
unsigned long Nl,Nh; |
MD5_LONG Nl,Nh; |
101 |
unsigned long data[MD5_LBLOCK]; |
MD5_LONG data[MD5_LBLOCK]; |
102 |
int num; |
int num; |
103 |
} MD5_CTX; |
} MD5_CTX; |
104 |
|
|
|
#ifndef NOPROTO |
|
105 |
void MD5_Init(MD5_CTX *c); |
void MD5_Init(MD5_CTX *c); |
106 |
void MD5_Update(MD5_CTX *c, unsigned char *data, unsigned long len); |
void MD5_Update(MD5_CTX *c, const void *data, unsigned long len); |
107 |
void MD5_Final(unsigned char *md, MD5_CTX *c); |
void MD5_Final(unsigned char *md, MD5_CTX *c); |
108 |
unsigned char *MD5(unsigned char *d, unsigned long n, unsigned char *md); |
unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); |
109 |
void MD5_Transform(MD5_CTX *c, unsigned char *b); |
void MD5_Transform(MD5_CTX *c, const unsigned char *b); |
|
#else |
|
|
void MD5_Init(); |
|
|
void MD5_Update(); |
|
|
void MD5_Final(); |
|
|
unsigned char *MD5(); |
|
|
void MD5_Transform(); |
|
|
#endif |
|
|
|
|
110 |
#ifdef __cplusplus |
#ifdef __cplusplus |
111 |
} |
} |
112 |
#endif |
#endif |