Files
actions-runner-controller/hash/fnv.go
T
622eaa34f8 Introduce new preview auto-scaling mode for ARC. (#2153)
Co-authored-by: Cory Miller <[email protected]>
Co-authored-by: Nikola Jokic <[email protected]>
Co-authored-by: Ava Stancu <[email protected]>
Co-authored-by: Ferenc Hammerl <[email protected]>
Co-authored-by: Francesco Renzi <[email protected]>
Co-authored-by: Bassem Dghaidi <[email protected]>
2023-01-17 12:06:20 -05:00

25 lines
428 B
Go

package hash
import (
"fmt"
"hash/fnv"
"k8s.io/apimachinery/pkg/util/rand"
)
func FNVHashStringObjects(objs ...interface{}) string {
hash := fnv.New32a()
for _, obj := range objs {
DeepHashObject(hash, obj)
}
return rand.SafeEncodeString(fmt.Sprint(hash.Sum32()))
}
func FNVHashString(name string) string {
hash := fnv.New32a()
hash.Write([]byte(name))
return rand.SafeEncodeString(fmt.Sprint(hash.Sum32()))
}