implement average hash as a function.
index/search with average hash