From a24fe4f33f94a526767e52162fa35b5838389502 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Sat, 12 Oct 2024 00:49:24 +0200 Subject: [PATCH] test: replace crypto/md5 usage with sha512 (#5768) this is only used in tests and to generate a unique id use sum384 since we need at most 63 chars --- pkg/testing/supported/batch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/testing/supported/batch.go b/pkg/testing/supported/batch.go index a53cf6364c5..6cf1479bedf 100644 --- a/pkg/testing/supported/batch.go +++ b/pkg/testing/supported/batch.go @@ -5,7 +5,7 @@ package supported import ( - "crypto/md5" + "crypto/sha512" "errors" "fmt" "strings" @@ -174,7 +174,7 @@ func createBatchID(batch common.OSBatch) string { // OGC will fail to instantiate the VM. maxIDLen := 63 if len(id) > maxIDLen { - hash := fmt.Sprintf("%x", md5.Sum([]byte(id))) + hash := fmt.Sprintf("%x", sha512.Sum384([]byte(id))) hashLen := utf8.RuneCountInString(hash) id = id[:maxIDLen-hashLen-1] + "-" + hash }