Skip to content
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

Consider using keyed Blake instead of prepend the tag? #32

Closed
AnomalRoil opened this issue Jul 15, 2022 · 2 comments
Closed

Consider using keyed Blake instead of prepend the tag? #32

AnomalRoil opened this issue Jul 15, 2022 · 2 comments

Comments

@AnomalRoil
Copy link
Member

Currently we prepend a fixed tag to our mesages when we are hashing data:

kyber/encrypt/ibe/ibe.go

Lines 132 to 138 in a780ab2

h3, err := blake2s.NewXOF(maxSize, nil)
if err != nil {
panic(err)
}
if _, err := h3.Write(H3Tag()); err != nil {
return nil, fmt.Errorf("err hashing h3 tag: %v", err)
}

I think we should consider using keyed Blake instead of prepend the tag. It would be as simply as replacing the nil in the Blake2s instantiation with the H3Tag.

@nikkolasg It would simplify a bit the code and also, keyed hash functions are there exactly for this usecase, no?

@nikkolasg
Copy link

nikkolasg commented Jul 16, 2022

I'd like to have the possibility to run any hash function and methods we want, extract this bit into a generic or something or config, so we can change it - it's already an issue here #29
Here's blake2s but if we want to use this in a solidity context, I think we might want to go back to like sha256 or keccak and keep the simple "tags" to differentiate the "hash functions" as in the paper.
Maybe something like

IbeHashing interface {
   H1() hash.Hash
   H2() hash.Hash
   H3() hash.Hash
}

@AnomalRoil
Copy link
Member Author

Solved in #34 I'd say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants