304 field agnostic fiat shamir challenge names#308
Merged
Conversation
…ic-fiat-shamir-challenge-names
gbotrel
approved these changes
Feb 10, 2023
|
|
||
| // TODO @ThomasPiellard shouldn't Sum() returns an error if there is no data? | ||
| if len(d.data) == 0 { | ||
| // TODO: @Tabaie, @Thomas Piellard Now sure what to make of this |
Collaborator
There was a problem hiding this comment.
2 solutions I guess;
- since
checksumis called inSumandSumcan return an error, we could do that if there is no data to hash. - refer to other Hash impl in Go std and see how Sum behaves with empty buffer.
Contributor
Author
There was a problem hiding this comment.
Took a look at SHA256, turns out for conventional hashes hashing nothing makes sense, and provides a valid input. I think our choice is between returning 0 or throwing an error.
| @@ -98,23 +98,22 @@ func (d *digest) BlockSize() int { | |||
| // If len(p) is not a multiple of BlockSize and any of the []byte in p represent an integer | |||
| // larger than fr.Modulus, this function returns an error. | |||
| // | |||
Collaborator
There was a problem hiding this comment.
add in godoc a warning to say that this method may error (whereas Hash interface{} say it may not)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes a solution to #304 by introducing an interface called
ArithmeticHashwith aWriteStringfunction that decomposes its message before writing it. Used for long fiatshamir challenge names and signatures.THE ABOVE IS OUTDATED: We decided on a more lightweight solution: the idea of keeping the hash interface but returning error on non-field-element input is held on to, but the decompose method is replaced with hashes to field.