void sha3_512_test (const void *msg, int len, void *out) { sha3_ctx ctx; rhash_sha3_512_init (&ctx); rhash_sha3_update (&ctx, msg, len); rhash_sha3_final (&ctx, out); }
static inline void HashFunction_Update(hash_ctx *const ctx, const unsigned char *const msg, const size_t size) { switch(ctx->hashType) { case STD_HASHTYPE_CRC_32: rhash_crc32_update(&ctx->data.crc32, msg, size); return; case STD_HASHTYPE_MD5_128: rhash_md5_update(&ctx->data.md5, msg, size); return; case STD_HASHTYPE_SHA1_160: rhash_sha1_update(&ctx->data.sha1, msg, size); return; case STD_HASHTYPE_SHA2_224: case STD_HASHTYPE_SHA2_256: rhash_sha256_update(&ctx->data.sha256, msg, size); return; case STD_HASHTYPE_SHA2_384: case STD_HASHTYPE_SHA2_512: rhash_sha512_update(&ctx->data.sha512, msg, size); return; case STD_HASHTYPE_SHA3_224: case STD_HASHTYPE_SHA3_256: case STD_HASHTYPE_SHA3_384: case STD_HASHTYPE_SHA3_512: rhash_sha3_update(&ctx->data.sha3, msg, size); return; case STD_HASHTYPE_BLK2_224: case STD_HASHTYPE_BLK2_256: case STD_HASHTYPE_BLK2_384: case STD_HASHTYPE_BLK2_512: if(blake2b_update(&ctx->data.balke2, msg, size) != 0) { MessageBox(NULL, T("Blake2_Update internal error, going to abort!"), T("StdUtils::HashFunction_Update"), MB_ICONSTOP | MB_TOPMOST); abort(); } return; default: MessageBox(NULL, T("Inconsistent state detected, going to abort!"), T("StdUtils::HashFunction_Update"), MB_ICONSTOP | MB_TOPMOST); abort(); } }