-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
16 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
#include "blake2b.h" | ||
|
||
bool blake2b_256_init(cx_blake2b_t* ctx) { | ||
return cx_blake2b_init_no_throw(ctx, 256) == 0; | ||
return cx_blake2b_init_no_throw(ctx, 256) == CX_OK; | ||
} | ||
|
||
bool blake2b_update(cx_blake2b_t* ctx, const uint8_t* data, size_t len) { | ||
return cx_hash_no_throw((cx_hash_t*) ctx, 0, data, len, NULL, 0) == 0; | ||
return cx_hash_no_throw((cx_hash_t*) ctx, 0, data, len, NULL, 0) == CX_OK; | ||
} | ||
|
||
bool blake2b_256_finalize(cx_blake2b_t* ctx, uint8_t out[static BLAKE2B_256_DIGEST_LEN]) { | ||
bool blake2b_256_finalize(cx_blake2b_t* ctx, uint8_t out[static CX_BLAKE2B_256_SIZE]) { | ||
return cx_hash_no_throw((cx_hash_t*) ctx, | ||
CX_LAST | CX_NO_REINIT, | ||
NULL, | ||
0, | ||
out, | ||
BLAKE2B_256_DIGEST_LEN) == 0; | ||
CX_BLAKE2B_256_SIZE) == CX_OK; | ||
} | ||
|
||
bool blake2b_256(const uint8_t* data, size_t len, uint8_t out[static BLAKE2B_256_DIGEST_LEN]) { | ||
cx_blake2b_t ctx; | ||
if (!blake2b_256_init(&ctx)) return false; | ||
return cx_hash_no_throw((cx_hash_t*) &ctx, | ||
CX_LAST | CX_NO_REINIT, | ||
data, | ||
len, | ||
out, | ||
BLAKE2B_256_DIGEST_LEN) == 0; | ||
bool blake2b_256(const uint8_t* data, size_t len, uint8_t out[static CX_BLAKE2B_256_SIZE]) { | ||
return cx_blake2b_256_hash(data, len, out) == CX_OK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters