Skip to main content

Hashwise Python Library

This library provides a set of functions for hashing and brute forcing hashes using various algorithms. It leverages CUDA for GPU computation to speed up the process.

Source Code

The source code for this project is available on GitHub. You can access it here.

PyPi Package

The Hashwise library is also available as a package on PyPi. You can view it here.

Installation

pip install hashwise

Dependencies

The library depends on the following third-party Python packages:

  • tqdm
  • pathlib

It also requires CUDA libraries for GPU computation. The required Dynamic-Link Library (DLL) is expected to be located in the "cuda-libraries" directory relative to the location of the library file.

Functions

The library provides the following functions:

  • blake2b(payload:bytes)
  • blake2s(payload:bytes)
  • md5(payload:bytes)
  • sha1(payload:bytes)
  • sha224(payload:bytes)
  • sha256(payload:bytes)
  • sha384(payload:bytes)
  • sha512(payload:bytes)
  • sha3_224(payload:bytes)
  • sha3_256(payload:bytes)
  • sha3_384(payload:bytes)
  • sha3_512(payload:bytes)
  • shake_128(payload:bytes, length:int)
  • shake_256(payload:bytes, length:int)

These functions take a byte as input and return the hashed value of the input.

The library also provides the following functions for brute forcing hashes:

  • brute_force_hash(hash_algorithm, possible_elements, target:str, len_permutation:int=None, string_encoding:str='utf-8', use_gpu=None, numBlocks=32, numThreadsPerBlock=32, show_progress_bar=False)
  • brute_force_time_estimate(hash_algorithm, possible_elements, length:int=None, string_encoding:str='utf-8', units='seconds', num_trials=None)

The brute_force_hash function attempts to find the original value of a hashed string by brute force. The brute_force_time_estimate function estimates the time it would take to brute force a hashed string using a specified hash algorithm and possible elements.

Exceptions

The library defines the following exceptions:

  • DependencyNotFoundError
  • GPUNotAccessibleError
  • NotImplementedError
  • UnknownGPUError

These exceptions are raised when there are issues with dependencies, GPU access, or unknown errors during computation.

Usage

In order to see if a CUDA-enabled GPU is available, call the following:

import hashwise

# Returns a list of all the GPU devices available. An empty list means that no GPUs were found.
hashwise.DeviceStatus.devices()

# Alternatively, this method will return true if a GPU is available and false if otherwise.
hashwise.DeviceStatus.device_available()

To use the library, import the required functions and call them with the appropriate arguments. For example:

hashed_value = hashwise.sha256(b'hello world')
original_value = hashwise.brute_force_hash(hashwise.sha256, 'abcdefghijklmnopqrstuvwxyz', hashed_value)

This will hash the string 'hello world' using the SHA256 algorithm, and then attempt to find the original value of the hashed string by brute force.

Additionally, we can specify the following parameters to enable GPU acceleration and specify the number of blocks and threads to be allocated. If these numbers aren't defined, an estimate of the optimal configuration will be used.

original_value = hashwise.brute_force_hash(
    hash_algorithm=hashwise.sha256,
    possible_elements="abcdefghijklmnopqrstuvwxyz",
    target=hashwise.sha256(b'hello world'),
    use_gpu=True,
    numBlocks=512,
    numThreadsPerBlock=64
)

Metadata

Release files for hashwise 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hashwise 0.0.4
File Size Uploaded Provenance Actions
hashwise-0.0.4.tar.gz 412.5 kB Without provenance Details for hashwise-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hashwise 0.0.4
File Interpreter ABI Platform Actions
hashwise-0.0.4-py3-none-any.whl Python 3 none any Details for hashwise-0.0.4-py3-none-any.whl

Total release size: 824.2 kB

Release files / hashwise-0.0.4.tar.gz

Download URL hashwise-0.0.4.tar.gz
Size 412.5 kB
Tags Source
SHA-256 checksum
How to use checksums
69fda425e4bad5fb1320f177b7fb5513f6fd96f7c5a86012a0fe3e7fe4878339
BLAKE2b-256 checksum
How to use checksums
5cec7b522f534a41afd0873bafbc3ea567190a37e0ec62fe3af53f4c4380f687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / hashwise-0.0.4-py3-none-any.whl

Download URL hashwise-0.0.4-py3-none-any.whl
Size 411.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa01bab4e1b6f5c92a4de1c833adfb8bb5cd3e7bc195629132a2a3f7a258ce83
BLAKE2b-256 checksum
How to use checksums
405b112b5577c8b75e55509447b831e2269f2361cf07c56dfcc0bd567d56c79a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for hashwise 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page