simple hash library for string, file, dict, set and list
Project description
hashy
Another hash library.
hashy provides an md5, sha256 or sha512 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.
Hashes for complex data types like dict, list and set are specific to hashy.
cachy
hashy
also provides cachy
, a decorator that can be used to persistently cache the results of a function to
disk. It is similar to @functools.cache
, except:
- Persistent (saved to local disk)
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
hashy-0.5.1-py3-none-any.whl
(8.3 kB
view details)
File details
Details for the file hashy-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: hashy-0.5.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d5dab11b757a7f8817e299b08f04b272573aee6672a44e3a03a35d834fc6e64 |
|
MD5 | 6b89da4b713c5b48e7e56b3b57e971d7 |
|
BLAKE2b-256 | 2d20dcb1f4ef9bf242cac8523b6114e64a31ab5c60f731924f7d656108d3969b |