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

Replace blake2-rfc with blake2 #111

Merged
merged 1 commit into from
Sep 15, 2022
Merged

Replace blake2-rfc with blake2 #111

merged 1 commit into from
Sep 15, 2022

Conversation

davxy
Copy link
Member

@davxy davxy commented Sep 15, 2022

Currently Parity-DB is the only crate used by Substrate that is using blake2-rfc.

Everything else has been recently ported to RustCrypto blake2.


Please refer to this Substrate PR for some more details: paritytech/substrate#12266

@davxy davxy requested review from cheme and arkpar September 15, 2022 15:17
Comment on lines +145 to +146
let mut ctx = Blake2bMac::<U32>::new_with_salt_and_personal(salt, &[], &[])
.expect("Salt length (32) is a valid key length (<= 64)");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the naming is a bit misleading.

That is, with previous implementation the salt was used as the blake2b-rfc "key" argument while the key was used as the "data" argument.

The new_with_salt_and_personal has a dedicated parameter (the 2nd) for the salt. But to obtain the same MAC as before we have to pass salt as the 1st parameter

@davxy davxy merged commit 37245c7 into master Sep 15, 2022
@arkpar arkpar deleted the davxy/replace-blake2-rfc branch September 15, 2022 15:55
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

Successfully merging this pull request may close these issues.

3 participants