https://github.com/brett-lempereur/ish
A collection of algorithms for comparing the similarity of images using perceptual hashes
https://github.com/brett-lempereur/ish
dfir forensics golang library perceptual-hashing
Last synced: 4 months ago
JSON representation
A collection of algorithms for comparing the similarity of images using perceptual hashes
- Host: GitHub
- URL: https://github.com/brett-lempereur/ish
- Owner: brett-lempereur
- License: bsd-2-clause
- Created: 2016-10-11T18:36:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-14T15:04:59.000Z (over 9 years ago)
- Last Synced: 2024-07-30T19:50:27.732Z (almost 2 years ago)
- Topics: dfir, forensics, golang, library, perceptual-hashing
- Language: Go
- Homepage:
- Size: 15.4 MB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ish
A collection of algorithms for comparing the similarity of images.
## Usage
This [example program](example/dhash.go) will compute the difference hash of a
list of images from the command-line arguments:
```go
package main
import (
"encoding/hex"
"fmt"
"os"
"github.com/brett-lempereur/ish"
)
func main() {
hasher := ish.NewDifferenceHash(8, 8)
for _, filename := range os.Args[1:] {
img, ft, err := ish.LoadFile(filename)
if err != nil {
fmt.Printf("%s: %s\n", filename, err.Error())
continue
}
dh, err := hasher.Hash(img)
if err != nil {
fmt.Printf("%s <%s>: %s", filename, ft, err)
} else {
dhs := hex.EncodeToString(dh)
fmt.Printf("%s <%s>: %s\n", filename, ft, dhs)
}
}
}
```
Running this program against the test data in this repository gives:
```
[brett@saito ish]$ go run example/dhash.go testdata/*
testdata/house-32x32-Gray.png : df8681cbc31986d9
testdata/house-4MP-CMYK.png : df8681cbcb19861b
testdata/house-4MP-Gray.png : df8681cbc3198699
testdata/house-4MP-RGBA.jpeg : df8681cbcb19865b
testdata/house-4MP-RGBA.png : df8681cbcb19861b
testdata/house-8MP-CMYK.png : df8681cbcb19861b
testdata/house-8MP-Gray.png : df8681cbc3198699
testdata/house-8MP-RGBA.jpeg : df8681cbcb19865b
testdata/house-8MP-RGBA.png : df8681cbcb19861b
```
## Installation
Use `go get` to pull the package and dependencies into your `GOPATH`:
go get -u github.com/brett-lempereur/ish
## Thanks
Thanks to Dr. Neal Krawetz for documenting some efficient image similarity
hashing algorithms over at the [HackerFactor][hf].
## License
Released under the [BSD license](LICENSE.md).
[hf]: http://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html