diff --git a/common/basetilecreator.go b/common/basetilecreator.go index 9e02df5..397411e 100644 --- a/common/basetilecreator.go +++ b/common/basetilecreator.go @@ -172,7 +172,7 @@ func (btc *BaseTileCreator) CreateTile(x, z int16, i, j int) (bool, error) { return true, SaveAsPNG(path, image) } - if btc.update(i, j, SHA1Image(image)) { + if btc.update(i, j, HashImage(image)) { log.Printf("Writing (%d, %d) to file %s.\n", x, z, path) return true, SaveAsPNGAtomic(path, image) } diff --git a/common/image.go b/common/image.go index b2feeee..2fed583 100644 --- a/common/image.go +++ b/common/image.go @@ -7,7 +7,6 @@ package common import ( "bufio" "bytes" - "crypto/sha1" "errors" "image" "image/color" @@ -18,6 +17,8 @@ import ( "sync" "time" + "golang.org/x/crypto/blake2b" + "github.com/bamiaux/rez" ) @@ -112,9 +113,9 @@ func LoadPNG(path string, bg color.RGBA) image.Image { return img } -func SHA1Image(img *image.RGBA) []byte { +func HashImage(img *image.RGBA) []byte { - hash := sha1.New() + hash, _ := blake2b.New256(nil) w, h := img.Rect.Dx()*4, img.Rect.Dy() pos := img.PixOffset(img.Rect.Min.X, img.Rect.Min.Y)