Beispiel #1
0
        public int GetHashDistance(ImageHashData other)
        {
            if (hashMD5 != null && other.hashMD5 != null && hashMD5.Length == other.hashMD5.Length)
            {
                bool isMatching = true;
                for (int idx = 0; idx < hashMD5.Length; idx++)
                {
                    if (hashMD5[idx] != other.hashMD5[idx])
                    {
                        isMatching = false;
                        break;
                    }
                }

                if (isMatching)
                {
                    return(0);
                }
            }

            if (hashTLSH != null && other.hashTLSH != null)
            {
                return(hashTLSH.TotalDiff(other.hashTLSH, false));
            }

            return(int.MaxValue);
        }
Beispiel #2
0
        public int FindDistance(HashCollection other)
        {
            if (ComplexHash != null && other.ComplexHash != null)
            {
                return(ComplexHash.TotalDiff(other.ComplexHash, false));
            }

            if (SimpleHash != null && other.SimpleHash != null)
            {
                return(SimpleHash.GetDistance(other.SimpleHash));
            }

            return(int.MaxValue);
        }