github.com/blend/go-sdk@v1.20220411.3/shardutil/hash.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package shardutil 9 10 import "hash/fnv" 11 12 // Hash hashes a given string as an integer. 13 func Hash(value []byte) int { 14 h := fnv.New32a() 15 _, _ = h.Write(value) 16 return int(h.Sum32()) 17 } 18 19 // HashString hashes a given string as an integer. 20 func HashString(value string) int { 21 return Hash([]byte(value)) 22 }