#define _MD5_EXPLICIT_INIT 1 #include "md5c.c" /* Pascal interface It's easier to define Pascal functions in THINK C than it is to call C functions from THINK Pascal */ /* THINK Pascal < 4 doesn't load libraries' DATA resources. Call this function once to initialize global state, but only if you need it! */ pascal void InitLibP() { PADDING = (unsigned char *) NewPtrClear(64); PADDING[0] = 0x80; } #ifdef _MD5_EXPLICIT_INIT /* MD5InitP - initialize the MD5 context */ pascal void MD5InitP(MD5_CTX *ctx) { MD5Init(ctx); } #endif /* MD5UpdateP - update an MD5 digest with a Str255 This doesn't use pascal.h because that would insert a null byte. */ pascal void MD5UpdateP(MD5_CTX *ctx, unsigned char *input) { int len = (int) *input++; MD5Update(ctx, input, len); } /* MD5Final - finalize an MD5 context, retrieving the digest into a Str255. This doesn't use pascal.h because that would expect a null byte to indicate length. */ pascal void MD5FinalP(unsigned char *digest, MD5_CTX *ctx) { *(digest++) = 16; MD5Final(digest, ctx); }