less than 1 minute read

pHash is an open source software library released under the GPLv3 license that implements several perceptual hashing algorithms, and provides a C-like API to use those functions in your own programs. pHash itself is written in C++.
From pHash.org: A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output, perceptual hashes are "close" to one another if the features are similar.

Ubuntu has a package libphash0 and libphash0-dev, but for this tutorial we will be installing from source.

Installation of pHash on Ubuntu (from source). This tutorial assumes you have build tools, like build-essential, installed.

Packages: apt-get install libavformat-dev libmpg123-dev libsamplerate-dev libsndfile-dev cimg-dev libavcodec-dev ffmpeg libswscale-dev

Next download pHash source from: http://phash.org/download/
Version at the time of this writing: 0.9.6

Extract the tar: tar -xvf pHash-0.9.6.tar.gz
Standard configure and make:  ./configure && make && make install

Remember this is just the library. For PHP bindings try this: http://useranswer.com/answer/compile-phash-on-centos-php-extension/