Skip to main content

hashy

CI codecov PyPI version Python versions Downloads License: MIT Ruff

Another hash library, but with a twist. It provides a simple interface to generate hashes for strings, files, dicts, lists and sets. It also provides a decorator to cache the results of a function to disk and (optionally) memory.

Installation

pip install hashy

Introduction

hashy provides an md5, sha256, sha512 or crc64nvme for string, file, dict, list and set.

String and file hashes are conventional and can be compared to other implementations. For example, you can go to an online hash calculator for "a" and get the same hash as hashy generates.

crc64nvme is the CRC-64/NVME checksum (as used by the NVMe specification and AWS S3 object integrity checking), returned as a 16-character hex string.

Hashes for complex data types like dict, list and set are specific to hashy.

cachy supports multithreading and multiprocessing via the msqlite library, which retries SQLite's database is locked errors with jittered backoff. A store that still cannot be written after 30 seconds (hashy.cache.LOCK_TIMEOUT_S) is logged as a warning and counted in get_counters().cache_store_failed_counter; the caller always receives the computed result.

Requires Python 3.12 or later. Free-threaded Python is supported and tested (3.14t and 3.15t): hashy and its dependencies run with the GIL off, and cachy and its counters are safe to use from threads running in parallel.

cachy

hashy also provides cachy, a decorator that can be used to persistently cache the results of a function to disk and (optionally) memory. It is similar to @functools.cache, except:

  • Persistent (saved to local disk in a sqlite database)
    • Optionally can be saved to a user-specified directory, otherwise it's the usual cache directory for the OS
  • Optional user-specified cache life.
  • Doesn't require arguments be frozen and/or pickle-able. Uses hashy to create a hash of the arguments.

Example


from hashy import get_string_sha256, cachy

print(get_string_sha256("a"))  # prints ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb

@cachy()
def func(a):
    return a + a

print(func(2))  # prints 4

Metadata

Release files for hashy 0.15.2

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

Source distribution (sdist)

Source distribution for hashy 0.15.2
File Size Uploaded Provenance Actions
hashy-0.15.2.tar.gz 32.3 kB With provenance Details for hashy-0.15.2.tar.gz

Built distribution (wheel)

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

Total release size: 51.9 kB

Release files / hashy-0.15.2.tar.gz

Download URL hashy-0.15.2.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e7476ee4dc3a87f07ac76ec1701b15a46051b51dadf56bdafc5766bd183f9033
BLAKE2b-256 checksum
How to use checksums
eb6bb4f49613e72cec44a262dba8d7569a0c605b53ccd93251e53b7027bb79d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / hashy-0.15.2-py3-none-any.whl

Download URL hashy-0.15.2-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a7b5774d65a8e972fa10f35008ef8c3deaf1a4a289b18a0221ba7bfd96a176e
BLAKE2b-256 checksum
How to use checksums
4583bfaf66dd2aafa840b741be1b453dcb19e96b4934a6c3cf7fa36bbdd8abc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for hashy 0.15.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hashy-0.15.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.15.2 This release

2 release files Full provenance

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