@@ -2,7 +2,7 @@ package mage
22
33import (
44 "bytes"
5- "crypto/sha1 "
5+ "crypto/sha3 "
66 "errors"
77 "flag"
88 "fmt"
@@ -173,7 +173,7 @@ func ParseAndRun(stdout, stderr io.Writer, stdin io.Reader, args []string) int {
173173 case None :
174174 return Invoke (inv )
175175 default :
176- panic (fmt .Errorf ("Unknown command type: %v" , cmd ))
176+ panic (fmt .Errorf ("unknown command type: %v" , cmd ))
177177 }
178178}
179179
@@ -656,13 +656,13 @@ func ExeName(goCmd, cacheDir string, files []string) (string, error) {
656656 }
657657 // hash the mainfile template to ensure if it gets updated, we make a new
658658 // binary.
659- hashes = append (hashes , fmt .Sprintf ("%x" , sha1 . Sum ([]byte (mageMainfileTplString ))))
659+ hashes = append (hashes , fmt .Sprintf ("%x" , sha3 . Sum256 ([]byte (mageMainfileTplString ))))
660660 sort .Strings (hashes )
661661 ver , err := internal .OutputDebug (goCmd , "version" )
662662 if err != nil {
663663 return "" , err
664664 }
665- hash := sha1 . Sum ([]byte (strings .Join (hashes , "" ) + magicRebuildKey + ver ))
665+ hash := sha3 . Sum256 ([]byte (strings .Join (hashes , "" ) + magicRebuildKey + ver ))
666666 filename := fmt .Sprintf ("%x" , hash )
667667
668668 out := filepath .Join (cacheDir , filename )
@@ -679,7 +679,7 @@ func hashFile(fn string) (string, error) {
679679 }
680680 defer f .Close ()
681681
682- h := sha1 . New ()
682+ h := sha3 . New256 ()
683683 if _ , err := io .Copy (h , f ); err != nil {
684684 return "" , fmt .Errorf ("can't write data to hash: %v" , err )
685685 }
0 commit comments