dhash implementation for python