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

Keccak256 based Binary Merklization #10

Merged
merged 7 commits into from
Mar 14, 2022
Merged

Keccak256 based Binary Merklization #10

merged 7 commits into from
Mar 14, 2022

Conversation

itzmeanjan
Copy link
Owner

I'm following https://keccak.team/files/Keccak-implementation-3.2.pdf for implementing keccak256 2-to-1 hash function, which is used for computing all intermediate nodes of binary merkle tree.

Note, keccak256 is almost similar to sha3-256, except padding rule difference

state[8] = 0b110ull;

vs

state[8] = 0b1ull;

@itzmeanjan
Copy link
Owner Author

As SHA3-256 and KECCAK-256 implementations are almost same, benchmark results are very close !

See https://github.com/itzmeanjan/merklize-sha/tree/3a5fa2998a0f51761c651eee1ac908e96dc26a2e/results/keccak-256 for keccak256 benchmark on multiple CPUs/ GPUs

@itzmeanjan
Copy link
Owner Author


running on Tesla V100-SXM2-16GB
Benchmarking Binary Merklization using KECCAK-256
leaf count execution time host-to-device tx time device-to-host tx time
2 ^ 20 751.924875 us 1.167792 ms 1.005363 ms
2 ^ 21 1.344910 ms 2.304931 ms 2.016678 ms
2 ^ 22 2.517974 ms 4.593017 ms 4.025208 ms
2 ^ 23 4.864380 ms 9.128906 ms 8.053345 ms
2 ^ 24 8.179686 ms 18.250488 ms 16.049194 ms
2 ^ 25 16.144776 ms 36.534668 ms 32.099121 ms

@itzmeanjan itzmeanjan merged commit ebcd785 into master Mar 14, 2022
@itzmeanjan itzmeanjan deleted the keccak256 branch March 14, 2022 04:52
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.

1 participant