resource: Use MD5 to identify image files
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 27 Dec 2017 18:31:42 +0000 (19:31 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 28 Dec 2017 16:41:51 +0000 (17:41 +0100)
commite50a8c7a142487d88fe0780c24873c1b95a2283c
tree29b1c4ad4e1dd9af49f45fb7b329d2909c511155
parent7e76a6fd3bc78363ed31d712c63e6b17734797d7
resource: Use MD5 to identify image files

But only a set of byte chunks spread around in the image file to calculate the fingerprint, which is much faster than reading the whole file:

```bash
BenchmarkMD5FromFileFast/full=false-4            300000       4356 ns/op      240 B/op        5 allocs/op
BenchmarkMD5FromFileFast/full=true-4              30000      42899 ns/op    32944 B/op        5 allocs/op
```

Fixes #4186
Gopkg.lock
Gopkg.toml
helpers/general.go
helpers/general_test.go
resource/image.go
resource/image_test.go
resource/resource.go