This can be uber useful for a lot of stuff. We developed something functionally very similar to detect image spam at my $employer a couple of years ago. Good stuff.
It says 'pHash is an open source software library released under the GPLv3 license that implements several perceptual hashing algorithms, and provides a C++ API to use those functions in your own programs.' right on the frontpage, looks pretty clear to me