fingerprint algorithm (string similarity) in javascript