New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: Add blake2b Test Cases #8901
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
I think this should be added to the hash tests, no need for a whole new binary.
Also please add trailing new lines so that GitHub doesn't complain and change the commit title to something like "tests: add blake2b test cases" to be more inline with other commits.
Thanks. Actually I considered adding it into the hash test, but the reason why I went with the new binary is that bounty specifically asks for a new |
b6f9299
to
e09c8a8
Compare
Commit message and No trailing newline (editor issue) fixed. |
|
I changed the commit and added the test logic to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking closer at the distinction between tests/crypto
and tests/hash
, I agree with @selsta that tests/hash
would be more appropriate.
0d91474
to
d94939b
Compare
Will change the PR to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple small comments.
tests/hash/main.cpp
Outdated
static void hash_blake2b(const void *data, size_t length, char *key_out){ | ||
// key_out is two buffer, first portion is key, second portion is out | ||
return (void) blake2b(key_out + BLAKE2B_KEYBYTES, BLAKE2B_OUTBYTES, data, length, key_out, BLAKE2B_KEYBYTES); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void hash_blake2b(const void *data, size_t length, char *key_out){ | |
// key_out is two buffer, first portion is key, second portion is out | |
return (void) blake2b(key_out + BLAKE2B_KEYBYTES, BLAKE2B_OUTBYTES, data, length, key_out, BLAKE2B_KEYBYTES); | |
} | |
static void hash_blake2b(const void *data, size_t length, char *hash_out){ | |
// data = key || hash data | |
return (void) blake2b(hash_out, BLAKE2B_OUTBYTES, data + BLAKE2B_KEYBYTES, length, data, BLAKE2B_KEYBYTES); | |
} |
The key_out
is an out-param, it should not contain input data.
* Adding blake2b test function to src/tests/hash * New files for testvector. * Adding the test to CMakeLists.txt * Adding brief documentation for the test.
LGTM, I need to check the test vector data then will approve. |
The test data is identical to the expected vectors. |
Removing preprocessor macro and replacing it with constexpr. Co-authored-by: Jeffro <jeffreyryan@tutanota.com>
@UkoeHB @jeffro256 @selsta Thanks everyone for reviewing this. This is my first PR to the Monero repository and I am planning to send more PR regularly. After @UkoeHB approval, I think at this point I am waiting for final approval. |
Yup, it's the same file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed locally that the test vectors are being tested properly.
|
@0xFFFC0000 that is a statistical test that fails periodically, not related to this PR. |
@UkoeHB thanks. |
Link to bounty:
https://bounties.monero.social/posts/75/6-500m-blake2b-c-dev-challenge-seraphis