Skip to content

Commit

Permalink
test: replace crypto/md5 usage with sha512 (#5768)
Browse files Browse the repository at this point in the history
this is only used in tests and to generate a unique id
use sum384 since we need at most 63 chars
  • Loading branch information
kruskall authored Oct 11, 2024
1 parent 0a96561 commit a24fe4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/testing/supported/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package supported

import (
"crypto/md5"
"crypto/sha512"
"errors"
"fmt"
"strings"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit a24fe4f

Please sign in to comment.