Module: Ssdeep

Extended by:
FFI::Library
Defined in:
lib/ssdeep.rb,
lib/ssdeep/fuzzy_hash.rb

Defined Under Namespace

Classes: FuzzyHash

Constant Summary collapse

SPAMSUM_LENGTH =
64
FUZZY_MAX_RESULT =
(SPAMSUM_LENGTH + (SPAMSUM_LENGTH/2 + 20))

Class Method Summary collapse

Class Method Details

.compare_files(f1, f2) ⇒ Object



69
70
71
# File 'lib/ssdeep.rb', line 69

def self.compare_files(f1, f2)
  compare_hashes(hash_file(f1), hash_file(f2))
end

.compare_hashes(h1, h2) ⇒ Object



61
62
63
# File 'lib/ssdeep.rb', line 61

def self.compare_hashes(h1, h2)
  h1.compare(h2)
end

.compare_strings(s1, s2) ⇒ Object



65
66
67
# File 'lib/ssdeep.rb', line 65

def self.compare_strings(s1, s2)
  compare_hashes(hash_string(s1), hash_string(s2))
end

.hash_file(fname) ⇒ Object



57
58
59
# File 'lib/ssdeep.rb', line 57

def self.hash_file(fname)
  FuzzyHash.from_file(fname)
end

.hash_string(str) ⇒ Object



53
54
55
# File 'lib/ssdeep.rb', line 53

def self.hash_string(str)
  FuzzyHash.from_string(str)
end