Skip to content

Commit

Permalink
feat: change the default checksum algorithm to sha256 (#2445)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke authored Nov 10, 2023
1 parent 41de48c commit 311bdd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/config/registry/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *Checksum) GetEnabled() bool {

func (c *Checksum) GetAlgorithm() string {
if !c.GetEnabled() {
return "sha512"
return "sha256"
}
return c.Algorithm
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/updatechecksum/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func (c *Controller) updateRegistry(ctx context.Context, logE *logrus.Entry, che
}
defer ghContentFile.Close()
content := ghContentFile.Reader()
algorithm := "sha512"
chk, err := checksum.CalculateReader(content, "sha512")
algorithm := "sha256"
chk, err := checksum.CalculateReader(content, algorithm)
if err != nil {
return fmt.Errorf("calculate a checksum of Registry: %w", err)
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func (c *Controller) dlAssetAndGetChecksum(ctx context.Context, logE *logrus.Ent
return fmt.Errorf("download an asset: %w", err)
}
defer file.Close()
algorithm := "sha512"
algorithm := "sha256"
fields["algorithm"] = algorithm
chk, err := checksum.CalculateReader(file, algorithm)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/installpackage/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (is *Installer) verifyChecksum(ctx context.Context, logE *logrus.Entry, par
checksums.Set(checksumID, chksum)
}

algorithm := "sha512"
algorithm := "sha256"
if chksum != nil {
algorithm = chksum.Algorithm
}
Expand Down

0 comments on commit 311bdd1

Please sign in to comment.