1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include <stdint.h>
- #include <stdio.h>
- #include <string.h>
- #include "md5.h"
- #define MD_CTX MD5_CTX
- #define MDInit MD5_Init
- #define MDUpdate MD5_Update
- #define MDFinal MD5_Final
- extern void AuthCodeCalMD5(
- uint8_t *string,
- uint8_t *MD5Result,
- uint16_t LengthOfstring
- )
- {
- MD_CTX context;
- uint8_t digest[16];
- MDInit (&context);
- MDUpdate (&context, string, LengthOfstring);
- MDFinal (digest, &context);
- memcpy(MD5Result,digest,16);
- }
- unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
- {
- MD5_CTX c;
- static unsigned char m[16];
- if (md == NULL) md=m;
- MD5_Init(&c);
- MD5_Update(&c,(unsigned char *)d,n);
- MD5_Final(md,&c);
- return(md);
- }
|