Switch from SHA2 to BLAKE3 #151
dr-orlovsky
started this conversation in
General
Replies: 1 comment 6 replies
-
Do we know if SHA operations take a significant amount of the validation time? It doesn't look like SHA is used so extensively to actually have a big impact. If the advantage of migrating is not significant I'd rather stay with SHA2-256 as it remaining secure is an assumption that RGB needs to do anyway since it works on top of Bitcoin, while using another hash function adds another unnecessary assumption that also BLAKE3 will remain secure. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
BLAKE3 is 10+ faster (i.e. by an order of magnitude) than SHA2-256 encoding. It also supports streaming and will be used for working with consignments. It is also used in the new
strict-type
library which is our downstream dependency. It provides a native rust implementation written by the creators of the protocol, which is well-maintained.I propose to start using BLAKE3 as a default hash functionin all layer 2+ projects. Of course, we can't change bitcoin part (layer 1), but that is not necessary. However, we can switch to BLAKE3 in RGB (together with other consensus changes), making validation faster.
The switch doesn't add new dependencies (
blacke3
is already in the dependency tree due tostrict-types
) and is a highly-trivial. In fact, it reduces amount of code since the use ofbitcoin_hashes
involves a lot of boilerplate and creation of different hash types is much simpler and laconic with BLAKE3 APIs.CC @fedsten @cryptoquick
Beta Was this translation helpful? Give feedback.
All reactions