Digest::ManberHash - a Perl package to calculate Manber Hashes
use Digest::ManberHash; $instance = Digest::ManberHash::new($maskbits, $prime, $charcount); $hash1 = $instance->DoHash($filename1); $hash2 = $instance->DoHash($filename2); $similarity = $instance->Compare($hash1, $hash2);
Use Digest::ManberHash::new. Parameters:
Digest::ManberHash::new
range 1 .. 30, default 11.
range 3 .. 65537, default 7.
range 8 .. 32768, default 64.
For a detailed description please read http://citeseer.nj.nec.com/manber94finding.html.
$hash = $instance->DoHash($filename);
This gives an object, which has an hash of hash values stored within.
$similarity = $instance->Compare($hash1, $hash2);
This gives an value of 0.0 .. 1.0, depending on the similariness. Help wanted: The calculation could do better than now!!
To install Digest::ManberHash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Digest::ManberHash
CPAN shell
perl -MCPAN -e shell install Digest::ManberHash
For more information on module installation, please visit the detailed CPAN module installation guide.