int winpr_Digest(int md, const BYTE* input, size_t ilen, BYTE* output) { WINPR_DIGEST_CTX ctx; if (winpr_Digest_Init(&ctx, md) != 0) return -1; if (winpr_Digest_Update(&ctx, input, ilen) != 0) return -1; if (winpr_Digest_Final(&ctx, output) != 0) return -1; return 0; }
BOOL winpr_Digest(int md, const BYTE* input, size_t ilen, BYTE* output, size_t olen) { BOOL result = FALSE; WINPR_DIGEST_CTX *ctx = winpr_Digest_New(); if (!ctx) return FALSE; if (!winpr_Digest_Init(ctx, md)) goto out; if (!winpr_Digest_Update(ctx, input, ilen)) goto out; if (!winpr_Digest_Final(ctx, output, olen)) goto out; result = TRUE; out: winpr_Digest_Free(ctx); return result; }