Compare commits

..

5 Commits

Author SHA1 Message Date
Thomas Boerger 125c08a2e6 Merge pull request #9 from patrickjahns/fix_checksum_miscalculation
fix comparison for sha256 checksum
2018-09-26 07:38:35 +02:00
Patrick Jahns 64bc79b1db fix comparison for sha256 checksum 2018-09-25 22:38:06 +02:00
Thomas Boerger ce7e9cd1c9 Merge pull request #8 from patrickjahns/fix_checksumming
fixed typo regards to sha checksumming
2018-09-25 21:01:32 +02:00
Patrick Jahns 77d760c2b9 provide legacy fallback option to avoid breaking changes 2018-09-25 19:33:31 +02:00
Patrick Jahns a367d8be06 fixed typo regards to sha checksumming 2018-09-25 16:29:22 +02:00
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -57,9 +57,9 @@ func main() {
EnvVar: "PLUGIN_MD5",
},
cli.StringFlag{
Name: "sha265-checksum",
Usage: "checksum in sha265 format",
EnvVar: "PLUGIN_SHA265",
Name: "sha256-checksum",
Usage: "checksum in sha256 format",
EnvVar: "PLUGIN_SHA256,PLUGIN_SHA265",
},
}
@@ -78,7 +78,7 @@ func run(c *cli.Context) error {
Password: c.String("password"),
SkipVerify: c.Bool("skip-verify"),
MD5: c.String("md5-checksum"),
SHA265: c.String("sha265-checksum"),
SHA256: c.String("sha256-checksum"),
},
}
+4 -4
View File
@@ -26,7 +26,7 @@ type (
Password string
SkipVerify bool
MD5 string
SHA265 string
SHA256 string
}
Plugin struct {
@@ -121,7 +121,7 @@ func (p Plugin) Exec() error {
}
}
if p.Config.SHA265 != "" {
if p.Config.SHA256 != "" {
h := sha256.New()
if _, err := io.Copy(h, resp.Body); err != nil {
@@ -130,8 +130,8 @@ func (p Plugin) Exec() error {
check := fmt.Sprintf("%x", h.Sum(nil))
if p.Config.MD5 != check {
return fmt.Errorf("checksum doesn't match, got %s and expected %s", check, p.Config.SHA265)
if p.Config.SHA256 != check {
return fmt.Errorf("checksum doesn't match, got %s and expected %s", check, p.Config.SHA256)
}
}