in chialisp sha256tree why we use sha256 1 or sha256 2
1 Like
When we hash the puzzle we start at the leaves of the tree and hash our way up, concatenating either a 1 or a 2 to denote that it’s either an atom or a cons box.
This is so that atoms and cons boxes with the same value are differentiated. For example, if we didn’t prefix them with those values, then both (3)
and 3
would have the same hash, since (3)
is the same as (3 . ())
and ()
has no bytes.
2 Likes