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

How to modify the number of rounds for blake3? #393

Open
ShallMate opened this issue May 8, 2024 · 2 comments
Open

How to modify the number of rounds for blake3? #393

ShallMate opened this issue May 8, 2024 · 2 comments
Labels
question Further information is requested

Comments

@ShallMate
Copy link

Hello. Our current requirement is to reduce the number of rounds for Blake3 because our requirement is quite special. We may not need such a secure hash algorithm. The simplest way may be to reduce its number of rounds. How can I reduce the number of rounds in the code?

@oconnor663
Copy link
Member

If you just wanted to see what the hash output would be with a reduced number of rounds, you could remove some rounds from the reference implementation here. But making the same change in the high-performance implementation is a lot of sensitive work, because that number is hardcoded in many different places. There are separate implementation files for AVX-512, AVX2, SSE4.1, SSE2, NEON, and portable code. Most of those are assembly code, which comes in three different flavors (Unix, Windows MSVC, and Windows GNU). For example, to change the number of rounds in just the Unix AVX-512 implementation, you'd need to delete unrolled rounds here and here, and you'd need to change loop bounds in five different places that look like this.

@ShallMate
Copy link
Author

@oconnor663 Thank you very much. I will try to make the modifications you pointed out. But actually, I have a doubt now. I am not familiar with the Rust language. Yesterday, I tried to comment out the code for the reference implementation, and then I recompiled the project. I see that the hash value obtained using b3sum has not changed, why is this? I am certain that I deleted the target folders under Blake3 and b3sum and rerun "cargo build -- release". And perform hash calculations on the same file using the regenerated b3sum.

@BurningEnlightenment BurningEnlightenment added the question Further information is requested label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants