Skip to content

This package is a Python wrapper for ssdeep by Jesse Kornblum, which is a library for computing Context Triggered Piecewise Hashes (CTPH).

License

Notifications You must be signed in to change notification settings

drobotun/pyssdeep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The python-wrapper for ssdeep

https://img.shields.io/github/license/drobotun/virustotalapi3?style=flat https://readthedocs.org/projects/pyssdeep/badge/?version=latest https://travis-ci.com/drobotun/pyssdeep.svg?branch=master https://codecov.io/gh/drobotun/pyssdeep/branch/master/graph/badge.svg?token=VHQQRO279Z https://img.shields.io/pypi/dm/pyssdeep

This package is a Python wrapper for ssdeep by Jesse Kornblum, which is a library for computing Context Triggered Piecewise Hashes (CTPH).

Installation

$ pip install pyssdeep

Usage

Get a fuzzy hash value for a string:

import pyssdeep

try:
    result = pyssdeep.get_hash_buffer(
        'The string for which you want to calculate a fuzzy hash'
    )
escept pyssdeep.FuzzyHashError as err:
    print(err)
except TypeError as err:
    print(err)
print('The fuzzy hash value is {}'.format(result))

Get a fuzzy hash value for a file:

import pyssdeep

try:
    result = pyssdeep.get_hash_file('e:/file.txt')
escept pyssdeep.FuzzyHashError as err:
    print(err)
except IOError as err:
    print(err)
print('The fuzzy hash value is {}'.format(result))

Get a fuzzy hash value for a file (using the pep 452 API):

import pyssdeep

buffer_size = 1024
fuzzy_hash_obj = pyssdeep.new()
with open('e:/file.txt', 'rb') as file:
    buffer = file.read(buffer_size)
    while len(buffer) > 0:
        fuzzy_hash_obj.update(buffer)
        buffer = file.read(buffer_size)
result = fuzzy_hash_obj.digest()

License

MIT Copyright (c) 2020 Evgeny Drobotun

About

This package is a Python wrapper for ssdeep by Jesse Kornblum, which is a library for computing Context Triggered Piecewise Hashes (CTPH).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages