Elichai Turkel 45edacfbfa
Replace Double-SHA256 with blake2b and implement domain seperation (#1245)
* Replace default hasher (Double-SHA256) with domain seperated blake2b

* Replace all hashes with domain seperated blake2b

* Update the genesis blocks

* Replace OP_HASH256 with OP_BLAKE2B

* Fix the merkle tree by appending zeros instead of duplicating the hash when there is 1 branch left

* Update tests

* Add a payloadHash function

* Update gitignore to ignore binaries

* Fix a bug in the blake2b opcode
2020-12-21 12:51:45 +02:00

11 lines
283 B
Go

package hashes
import "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
// PayloadHash returns the payload hash.
func PayloadHash(payload []byte) *externalapi.DomainHash {
writer := NewPayloadHashWriter()
writer.InfallibleWrite(payload)
return writer.Finalize()
}