DataHoarder
a458a18f07
All checks were successful
continuous-integration/drone/push Build is passing
15 lines
386 B
Go
15 lines
386 B
Go
package randomx
|
|
|
|
import "golang.org/x/crypto/blake2b"
|
|
|
|
// CalculateCommitment Calculate a RandomX commitment from a RandomX hash and its input.
|
|
func CalculateCommitment(input []byte, hashIn, hashOut *[RANDOMX_HASH_SIZE]byte) {
|
|
hasher, err := blake2b.New(RANDOMX_HASH_SIZE, nil)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
hasher.Write(input)
|
|
hasher.Write(hashIn[:])
|
|
hasher.Sum(hashOut[:0])
|
|
}
|