mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-10 03:13:15 +00:00
Co-authored-by: Cory Miller <cory-miller@github.com> Co-authored-by: Nikola Jokic <nikola-jokic@github.com> Co-authored-by: Ava Stancu <AvaStancu@github.com> Co-authored-by: Ferenc Hammerl <fhammerl@github.com> Co-authored-by: Francesco Renzi <rentziass@github.com> Co-authored-by: Bassem Dghaidi <Link-@github.com>
25 lines
428 B
Go
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()))
|
|
}
|