-
Notifications
You must be signed in to change notification settings - Fork 27
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
Replacing Blake2s compression function by Blake2s hash function #190
Conversation
size_t to_pad = input_size % BLAKE2s_block_size; | ||
for (size_t i = 0; i < BLAKE2s_block_size - to_pad; i++) { | ||
padded_input.push_back(FieldT("0")); | ||
} |
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.
Seems like here you will still pad with 0's even if input_size % BLAKE2s_block_size == 0
. In fact the result of your mod
is stored in to_pad
, and to_pad
is not used inside a conditional to pad only if to_pad != 0
as suggested in your comment above. If to_pad
is 0 here - assuming input_size = BLAKE2s_block_size
, then your padded_input
vector will be of length 2*BLAKE2s_block_size
.
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.
Updated.
@rrtoledo please make sure to rebase your branch on top of develop since the build has been repaired. |
45e00a1
to
5037687
Compare
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.
Rebased onto develop
and fixed a few build issues.
libzeth/circuits/blake2s/blake2s.hpp
Outdated
@@ -165,6 +165,7 @@ template<typename FieldT> class BLAKE2s_256 : public libsnark::gadget<FieldT> | |||
}; | |||
|
|||
} // namespace libzeth | |||
|
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.
Not sure this is consistent with the other hpp/tcc
files where we wrote the include on the line following the }
closing the libzeh namespace
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.
Ah, I didn't realise it had been switched to that.
It seems slightly unnatural since in all other cases we have a line before #include
blocks, and line between } // namespace ...
and following code (hence it stood out).
Anyway changed for now to be consistent.
Replacing Blake2s compression function by Blake2s hash function
Tackles #158