Python wrapper for the mmdt library
Project description
python_mmdt
python_mmdt is a python-based mmdt library implementation. This library allows you to use mmdt through python to calculate sensitive hashes.
mmdt is a sensitive hash implementation that can be used to calculate file similarity
Pre-Install
cmake
: 2.6 and abovewindows
: The current version (0.0.1) requiresminGW
to be installed on windows
Install from Pypi
$ pip install python_mmdt
Install by Whl
.whl
download from Release
$ pip install python_mmdt-xxx.whl
Usage
Command Line
# calculate mmdt sensitive
$ mmdt-hash $file_path
# calculate file similarity
$ mmdt-compare $file_path1 $file_path2
python code
# -*- coding: utf-8 -*-
import unittest
import os
from python_mmdt.mmdt.mmdt import MMDT
class Testmmdt(unittest.TestCase):
def test_process(self):
mmdt = MMDT()
test_path = os.path.dirname(__file__)
test_samples = os.path.join(test_path, "samples")
files = os.listdir(test_samples)
for f in files:
file_path = os.path.join(test_samples, f)
r1 = mmdt.mmdt_hash(file_path)
print(r1)
r2 = mmdt.mmdt_hash_streaming(file_path)
print(r2)
sim1 = mmdt.mmdt_compare(file_path, file_path)
print(sim1)
sim2 = mmdt.mmdt_compare_hash(r1, r2)
print(sim2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_mmdt-0.0.2.tar.gz
(19.1 kB
view hashes)
Built Distribution
Close
Hashes for python_mmdt-0.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f001387aefd0c4939f74f8211088033bb7b5f84e114bb9293b4fbbaeb06c94ba |
|
MD5 | 6b8903260e059e4b47e1d9319ea72fdb |
|
BLAKE2b-256 | 1bea367f8f75132e4b5dd5bd96a2ff04f20ffc4380ddbd33e81cb7706a1265f0 |