+2001-11-19 Sam Hartman <hartmans@mit.edu>
+
+ * yhash.h: Work around sha1 implementation using host byte order
+
2001-11-19 Danilo Almeida <dalmeida@mit.edu>
* Makefile.in: Fix typo OUTP -> OUTPRE.
#define HASH_Init(x) shsInit(x)
#define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz)
#define HASH_Final(x, tdigest) do { \
- shsFinal(x); \
- memcpy((tdigest), (void *) (x)->digest, SHS_DIGESTSIZE); \
+ int loopvar; \
+ unsigned char *out = (void *)(tdigest); \
+ HASH_CTX *ctx = (x); \
+ shsFinal(ctx); \
+for (loopvar=0; loopvar<(sizeof(ctx->digest)/sizeof(ctx->digest[0])); loopvar++) { \
+ out[loopvar*4] = (ctx->digest[loopvar]>>24)&0xff; \
+ out[loopvar*4+1] = (ctx->digest[loopvar]>>16)&0xff; \
+ out[loopvar*4+2] = (ctx->digest[loopvar]>>8)&0xff; \
+ out[loopvar*4+3] = ctx->digest[loopvar]&0xff; \
+} \
} while(0)