Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
dHash algorithm was originally described at Kind of Like That - The Hacker Factor Blog
pip install dhashpy -U
pip install git+https://github.com/akamhy/dhashpy.git
>>> from dhashpy import DHash
>>> file = "/home/akamhy/Pictures/map_of_maths.png"
>>> dhash_file = DHash(file)
>>> dhash_file
DHash(hash=0b0110010000000011101010111100110111001101100011111000111100001110, hash_hex=0x6403abcdcd8f8f0e, path=/home/akamhy/Pictures/map_of_maths.png)
>>>
>>> dhash_file.hash # A 64-bit hash, notice the prefix "0b" indicating it's binary. Total string length = 64 + 2 = 66
'0b0110010000000011101010111100110111001101100011111000111100001110'
>>>
>>> len(dhash_file)
66
>>> dhash_file.bits_in_hash
64
>>>
>>> dhash_file.hash_hex
'0x6403abcdcd8f8f0e'
>>>
>>> dhash_file - "0x6403abcdcd8f8f0e"
0
>>>
>>> dhash_file == "0x6403abcdcd8f8f0e"
True
>>>
>>> dhash_file - "0b0110010000000011101010111100110111001101100011111000111100001110"
0
>>>
>>> dhash_file
dhash_file
>>> dir(dhash_file)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__weakref__', 'bin2hex', 'bits_in_hash', 'calc_hash', 'hamming_distance', 'hash', 'hash_hex', 'height', 'hex2bin', 'image', 'path', 'width']
>>> dhash_file.height
8
>>> dhash_file.width
9
>>> dhash_file.image
<PIL.Image.Image image mode=L size=9x8 at 0x7F9D324C0580>
>>>
Released under the MIT License. See license for details.
FAQs
Row-wise gradient dHash (difference hash) algorithm implementation in python.
We found that dhashpy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.