8000 [Bugfix] Use MD5 instead of SHA256 for CRD Checksums (#1653) · arangodb/kube-arangodb@3a511c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a511c3

Browse files
authored
[Bugfix] Use MD5 instead of SHA256 for CRD Checksums (#1653)
1 parent 2397c75 commit 3a511c3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- (Bugfix) Prevent unexpected rotation in case of SecurityContext change
66
- (Bugfix) Ensure PDB is created
77
- (Bugfix) Fix Schema Apply Checksum
8+
- (Bugfix) Use MD5 instead of SHA256 for CRD Checksums
89

910
## [1.2.40](https://github.com/arangodb/kube-arangodb/tree/1.2.40) (2024-04-10)
1011
- (Feature) Add Core fields to the Scheduler Container Spec

pkg/crd/crds/crds.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ func (d DefinitionData) schemaDefinitionLoader() util.Loader[crdSchemas] {
4848

4949
func (d DefinitionData) Checksum() (definition, schema string) {
5050
if len(d.definition) > 0 {
51-
definition = util.SHA256(d.definition)
51+
definition = util.MD5(d.definition)
5252
}
5353
if len(d.schemaDefinition) > 0 {
54-
schema = util.SHA256(d.schemaDefinition)
54+
schema = util.MD5(d.schemaDefinition)
5555
}
5656
return
5757
}

pkg/util/checksum.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package util
2222

2323
import (
24+
"crypto/md5"
2425
"crypto/sha256"
2526
"fmt"
2627

@@ -35,6 +36,14 @@ func SHA256(data []byte) string {
3536
return fmt.Sprintf("%0x", sha256.Sum256(data))
3637
}
3738

39+
func MD5FromString(data string) string {
40+
return MD5([]byte(data))
41+
}
42+
43+
func MD5(data []byte) string {
44+
return fmt.Sprintf("%0x", md5.Sum(data))
45+
}
46+
3847
func SHA256FromJSON[T interface{}](a T) (string, error) {
3948
d, err := json.Marshal(a)
4049
if err != nil {

0 commit comments

Comments
 (0)
0