Compare all files in a directory, and sort by similarity

view story

http://unix.stackexchange.com – In Unix, is there any way to compare every file in a directory to every other file in a directory, and then list each pair of files by similarity (meaning the amount of difference between each file)? There are already some command-line Unix programs (such as fdupes) that can find duplicate files in a directory, but I'm wondering if it's possible to find similar files using a shell script as well. (HowTos)