github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/utils/hash.go (about)

     1  /*
     2   * Copyright (c) 2020-present unTill Pro, Ltd.
     3   * @author Denis Gribanov
     4   */
     5  
     6  package coreutils
     7  
     8  import "hash/fnv"
     9  
    10  // returns FNV-1 hash as int64
    11  func HashBytes(b []byte) int64 {
    12  	fnvHash := fnv.New64()
    13  	if _, err := fnvHash.Write(b); err != nil {
    14  		// notest
    15  		panic(err)
    16  	}
    17  	return int64(fnvHash.Sum64())
    18  }