Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def areImageSigsSimilar(sig1, sig2):
""" Compare 2 image "signatures" and return True if they seem to come from a similar image, False otherwise. """
return bitarray.bitdiff(sig1, sig2) < 100
def hamming_distance(self, fingerprint1, fingerprint2):
"""
Return hamming distance between two given fingerprints.
Hamming distance is the difference in the bits of two binary string.
Files with fingerprints whose hamming distance are less tends to be more similar.
"""
distance = bitdiff(fingerprint1, fingerprint2)
result = int(distance)
return result
def equalBitArrays(ba1, ba2):
return bitdiff(ba1, ba2) == 0