### Install and Activate Virtual Environment for Pre-commit Source: https://github.com/dinotools/python-ssdeep/blob/master/CONTRIBUTING.rst Set up a virtual environment and install pre-commit. This isolates pre-commit dependencies. ```bash python3 -m venv venv_git source venv_git/bin/activate pip install pre-commit ``` -------------------------------- ### Install python-ssdeep with pip Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/index.md Install the python-ssdeep library using pip. This is the recommended method for most users. ```console pip install ssdeep ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/dinotools/python-ssdeep/blob/master/CONTRIBUTING.rst Install the pre-commit hooks into your local repository. These hooks run automatically before each commit. ```bash pre-commit install ``` -------------------------------- ### Install ssdeep Wrapper Source: https://github.com/dinotools/python-ssdeep/blob/master/README.rst Installs the ssdeep Python wrapper using pip. This command assumes the ssdeep library is already installed on the system. ```console $ pip install ssdeep ``` -------------------------------- ### Install and Activate Virtual Environment for Git Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/contributing.md Set up a virtual environment for managing Python dependencies related to Git hooks. Activate the environment before installing pre-commit. ```bash $ python3 -m venv venv_git $ source venv_git/bin/activate $ pip install pre-commit ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/contributing.md Install the pre-commit framework's hooks into your local repository. This ensures code quality checks are run before commits. ```bash $ pre-commit install ``` -------------------------------- ### Install ssdeep Wrapper with included library Source: https://github.com/dinotools/python-ssdeep/blob/master/README.rst Installs the ssdeep Python wrapper using pip, building the included version of the ssdeep library. Use this command if the ssdeep library is not pre-installed. ```console $ BUILD_LIB=1 pip install ssdeep ``` -------------------------------- ### Install Python 2 ssdeep Module Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs the ssdeep Python 2 package using pip. ```bash $ sudo pip install ssdeep ``` -------------------------------- ### Install Python 3 ssdeep Module Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs the ssdeep Python 3 package using pip3. ```bash $ sudo pip3 install ssdeep ``` -------------------------------- ### Install Python Module on Ubuntu 12.04 (Python 3, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs pip for Python 3 and then builds and installs the ssdeep Python module using its included ssdeep library on Ubuntu 12.04 for Python 3. ```bash sudo easy_install3 pip sudo BUILD_LIB=1 pip3 install ssdeep ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/dinotools/python-ssdeep/blob/master/README.rst Builds the documentation locally by navigating to the docs directory, installing requirements, and running the make html command. This is useful for developers who want to view or modify the documentation. ```console $ cd docs $ pip install -r requirements.txt $ make html ``` -------------------------------- ### Clone the Repository Locally Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/contributing.md Download the python-ssdeep repository to your local machine. Navigate into the cloned directory to begin setup. ```bash $ git clone https://github.com/DinoTools/python-ssdeep.git $ cd python-ssdeep ``` -------------------------------- ### Install Packages on CentOS 7 (Python 2, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs development tools, EPEL repository, and necessary libraries for building the ssdeep Python module with its included library on CentOS 7 for Python 2. ```bash sudo yum groupinstall "Development Tools" sudo yum install epel-release sudo yum install libffi-devel python-devel python-pip automake autoconf libtool ``` -------------------------------- ### Install Packages on Ubuntu 12.04 (Python 3, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs build essentials, development libraries, Python 3 setuptools, and packaging tools for building the ssdeep Python module with its included library on Ubuntu 12.04 for Python 3. ```bash sudo apt-get install build-essential libffi-dev python3 python3-dev python3-setuptools automake autoconf libtool ``` -------------------------------- ### Install Packages on CentOS 7 (Python 2, Use EPEL ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs development tools, EPEL repository, and ssdeep development packages from EPEL for building the ssdeep Python module on CentOS 7 for Python 2. ```bash sudo yum groupinstall "Development Tools" sudo yum install epel-release sudo yum install libffi-devel python-devel python-pip ssdeep-devel ssdeep-libs ``` -------------------------------- ### Install Python Module on Ubuntu 16.04 (Python 3, Use Ubuntu Repo ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using the ssdeep library from the Ubuntu repository on Ubuntu 16.04 for Python 3. ```bash pip3 install ssdeep ``` -------------------------------- ### Install Packages on Debian 7 (Python 2, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs build essentials, development libraries, and Python packaging tools for building the ssdeep Python module with its included library on Debian 7 for Python 2. ```bash sudo apt-get install build-essential libffi-dev python python-dev python-pip automake autoconf libtool ``` -------------------------------- ### Install Packages on Debian 7 (Python 3, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs build essentials, development libraries, and Python 3 packaging tools for building the ssdeep Python module with its included library on Debian 7 for Python 3. ```bash sudo apt-get install build-essential libffi-dev python3 python3-dev python3-pip automake autoconf libtool ``` -------------------------------- ### Install Python Module on Ubuntu 16.04 (Python 2, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using its included ssdeep library on Ubuntu 16.04 for Python 2. ```bash BUILD_LIB=1 pip install ssdeep ``` -------------------------------- ### Install Python Module on CentOS 7 (Python 2, Use EPEL ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using the ssdeep library from the EPEL repository on CentOS 7 for Python 2. ```bash sudo pip install ssdeep ``` -------------------------------- ### Install Python Module on Ubuntu 16.04 (Python 3, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using its included ssdeep library on Ubuntu 16.04 for Python 3. ```bash BUILD_LIB=1 pip3 install ssdeep ``` -------------------------------- ### Install Python 3 ssdeep Dependencies on Fedora Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs development tools, Python 3 headers, pip, and ssdeep libraries required for building the Python 3 ssdeep module. ```bash $ sudo dnf groupinstall "Development Tools" $ sudo dnf install libffi-devel python3-devel python3-pip ssdeep-devel ssdeep-libs ``` -------------------------------- ### Install Python 2 ssdeep Dependencies on Fedora Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs development tools, Python 2 headers, pip, and ssdeep libraries required for building the Python 2 ssdeep module. ```bash $ sudo dnf groupinstall "Development Tools" $ sudo dnf install libffi-devel python-devel python-pip ssdeep-devel ssdeep-libs ``` -------------------------------- ### Install Python Module on Debian 8/9 (Python 3, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using its included ssdeep library on Debian 8/9 for Python 3. ```bash sudo BUILD_LIB=1 pip3 install ssdeep ``` -------------------------------- ### Install Packages on Debian 8/9 (Python 3, Use Debian Repo ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs build essentials, development libraries, and ssdeep development packages from Debian repository for building the ssdeep Python module on Debian 8/9 for Python 3. ```bash sudo apt-get install build-essential libffi-dev python3 python3-dev python3-pip libfuzzy-dev ``` -------------------------------- ### Install Packages on Debian 8/9 (Python 2, Use Debian Repo ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Installs build essentials, development libraries, and ssdeep development packages from Debian repository for building the ssdeep Python module on Debian 8/9 for Python 2. ```bash sudo apt-get install build-essential libffi-dev python python-dev python-pip libfuzzy-dev ``` -------------------------------- ### Configure Git User Information Source: https://github.com/dinotools/python-ssdeep/blob/master/CONTRIBUTING.rst Set your username and email for Git commits. This is a one-time setup for your local environment. ```bash git config user.name 'Your Name' git config user.email 'your.email@example.org' ``` -------------------------------- ### Configure Git User Information Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/contributing.md Set your username and email for Git commits. This is a one-time setup for your local environment. ```bash $ git config user.name 'Your Name' $ git config user.email 'your.email@example.org' ``` -------------------------------- ### Install Python Module on CentOS 7 (Python 2, Use Included ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using its included ssdeep library on CentOS 7 for Python 2. ```bash sudo BUILD_LIB=1 pip install ssdeep ``` -------------------------------- ### Install Python Module on Debian 8/9 (Python 3, Use Debian Repo ssdeep lib) Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/installation.md Builds and installs the ssdeep Python module using the ssdeep library from the Debian repository on Debian 8/9 for Python 3. ```bash sudo pip3 install ssdeep ``` -------------------------------- ### Compare Hashes Resulting in 0 Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/faq.md This example demonstrates a scenario where comparing two identical hashes might result in 0 due to algorithm limitations with short or pattern-deficient data. Ensure sufficient data length for accurate comparisons. ```pycon >>> hash1 = ssdeep.hash('foo' * 4096) >>> hash2 = ssdeep.hash('foo' * 4096) >>> ssdeep.compare(hash1, hash2) 0 ``` -------------------------------- ### Compare Two Fuzzy Hashes Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/usage.md Use the ssdeep.compare() function to get a match score between two fuzzy hashes. The score ranges from 0 (no match) to 100. ```pycon >>> ssdeep.compare(hash1, hash2) 22 ``` -------------------------------- ### Hash Class Interface Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/usage.md Utilize the ssdeep.Hash class for a hashlib-like interface to compute hashes incrementally. Use update() to feed data and digest() to get the current hash. ```pycon >>> h = ssdeep.Hash() >>> h.update('Also called fuzzy hashes, ') >>> h.digest() '3:AXGBicFlF:AXGHR' >>> h.update('Ctph can match inputs that have homologies.') >>> h.digest() '3:AXGBicFlgVNhBGcL6wCrFQEv:AXGHsNhxLsr2C' ``` -------------------------------- ### Clone python-ssdeep Repository Source: https://github.com/dinotools/python-ssdeep/blob/master/CONTRIBUTING.rst Clone the main repository locally and navigate into the project directory. This is the first step after forking the project. ```bash git clone https://github.com/DinoTools/python-ssdeep.git cd python-ssdeep ``` -------------------------------- ### Import ssdeep Module Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/usage.md Import the necessary ssdeep module before use. ```pycon >>> import ssdeep ``` -------------------------------- ### Add Fork as a Remote Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/contributing.md Configure a remote named 'fork' to push your changes to your GitHub fork. Replace with your actual GitHub username. ```bash $ git remote add fork https://github.com//python-ssdeep ``` -------------------------------- ### Add Fork as Git Remote Source: https://github.com/dinotools/python-ssdeep/blob/master/CONTRIBUTING.rst Add your forked repository as a remote named 'fork' to push your changes. Replace with your GitHub username. ```bash git remote add fork https://github.com//python-ssdeep ``` -------------------------------- ### Compute Fuzzy Hash from File Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/usage.md Use the ssdeep.hash_from_file() function to compute the fuzzy hash of a file's contents by providing its filename. ```pycon >>> ssdeep.hash_from_file('/etc/resolv.conf') '3:S3yE29cFrrMOoiECAaHJgvn:S3m+COoiUCuvn' ``` -------------------------------- ### Compute Fuzzy Hash Source: https://github.com/dinotools/python-ssdeep/blob/master/README.rst Computes a fuzzy hash for a given string. Use this function to generate a hash for comparison. ```pycon >>> import ssdeep >>> hash1 = ssdeep.hash('Also called fuzzy hashes, Ctph can match inputs that have homologies.') >>> hash1 '3:AXGBicFlgVNhBGcL6wCrFQEv:AXGHsNhxLsr2C' >>> hash2 = ssdeep.hash('Also called fuzzy hashes, CTPH can match inputs that have homologies.') >>> hash2 '3:AXGBicFlIHBGcL6wCrFQEv:AXGH6xLsr2C' ``` -------------------------------- ### Compute Fuzzy Hash of a String Source: https://github.com/dinotools/python-ssdeep/blob/master/docs/source/usage.md Use the ssdeep.hash() function to compute a fuzzy hash for a given string. Note the difference in hash output for minor input variations. ```pycon >>> hash1 = ssdeep.hash('Also called fuzzy hashes, Ctph can match inputs that have homologies.') >>> hash1 '3:AXGBicFlgVNhBGcL6wCrFQEv:AXGHsNhxLsr2C' >>> hash2 = ssdeep.hash('Also called fuzzy hashes, CTPH can match inputs that have homologies.') >>> hash2 '3:AXGBicFlIHBGcL6wCrFQEv:AXGH6xLsr2C' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.