You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// K8sNameHash takes any number of string arguments and computes a hash out of it, which is then base32-encoded to be a valid k8s resource name.
16
+
// K8sNameHash takes any number of string arguments and computes a hash out of it, which is then base32-encoded to be a valid DNS1123Subdomain k8s resource name
18
17
// The arguments are joined with '/' before being hashed.
19
18
funcK8sNameHash(ids...string) string {
20
19
name:=strings.Join(ids, "/")
21
-
h:=sha1.New()
20
+
// since we are not worried about length-extension attacks (in fact we are not even using hashing for
21
+
// any security purposes), use sha2 for better performance compared to sha3
22
+
h:=sha256.New()
22
23
_, _=h.Write([]byte(name))
23
24
// we need base32 encoding as some base64 (even url safe base64) characters are not supported by k8s
24
25
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
0 commit comments