Package emissary.kff

Class Ssdeep


  • public final class Ssdeep
    extends Object
    A java port of the ssdeep code for "fuzzy hashing". http://ssdeep.sourceforge.net There are a number of ports out there that all look basically the same. This one is from https://opensourceprojects.eu/p/triplecheck/code/23/tree/tool/src/ssdeep/ A new ssdeep hash gets calculated and saved at each level of unwrapping.
    • Constructor Detail

      • Ssdeep

        public Ssdeep()
    • Method Detail

      • fuzzyHash

        public String fuzzyHash​(byte[] data)
        Calculate the SpamSum hash for a byte array.
        Parameters:
        data - The bytes to be hashed.
        Returns:
        The SpamSum signature for the bytes.
      • fuzzyHashFile

        public String fuzzyHashFile​(File file)
                             throws IOException
        Calculates the SpamSum hash for specified stream.
        Parameters:
        file - The input file to be hashed.
        Returns:
        The SpamSum signature for the file.
        Throws:
        IOException - If there is some I/O problem accessing the file.
      • fuzzyHashFile

        public String fuzzyHashFile​(String fileName)
                             throws IOException
        Calculates the SpamSum hash for specified file.
        Parameters:
        fileName - The path to the file to be hashed.
        Returns:
        The SpamSum signature for the file.
        Throws:
        IOException - If there is some I/O problem accessing the file.
      • compare

        public int compare​(@Nullable
                           SpamSumSignature signature1,
                           @Nullable
                           SpamSumSignature signature2)
        Given two spamsum signature return a value indicating the degree to which they match.
        Parameters:
        signature1 - The first signature.
        signature2 - The second signature.
        Returns:
        The score for the two signatures. The value is in the range 0..100, where 0 is a terrible match and 100 is a great match.