hashy


Namehashy JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/jamesabel/hashy
Summarysimple hash library for string, file, dict, set and list
upload_time2024-10-14 16:22:26
maintainerNone
docs_urlNone
authorabel
requires_pythonNone
licenseMIT License
keywords hash
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
# 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

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jamesabel/hashy",
    "name": "hashy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "hash",
    "author": "abel",
    "author_email": "j@abel.co",
    "download_url": "https://github.com/jamesabel/hashy",
    "platform": null,
    "description": "\r\n# hashy\r\n\r\nAnother hash library.\r\n\r\nhashy provides an md5, sha256 or sha512 for string, file, dict, list and set.\r\n\r\nString and file hashes are conventional and can be compared to other implementations. For example\r\nyou can go to an online hash calculator for \"a\" and get the same hash as hashy generates.\r\n\r\nHashes for complex data types like dict, list and set are specific to hashy.\r\n\r\n## cachy\r\n\r\n`hashy` also provides `cachy`, a decorator that can be used to persistently cache the results of a function to \r\ndisk. It is similar to `@functools.cache`, except:\r\n\r\n- Persistent (saved to local disk)\r\n  - Optionally can be saved to a user-specified directory, otherwise it's the usual cache directory for the OS\r\n- Optional user-specified cache life.\r\n- Doesn't require arguments be frozen and/or pickle-able. Uses hashy to create a hash of the arguments.\r\n\r\n\r\n# Example\r\n\r\n```\r\n\r\nfrom hashy import get_string_sha256, cachy\r\n\r\nprint(get_string_sha256(\"a\"))  # prints ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb\r\n\r\n@cachy()\r\ndef func(a):\r\n    return a + a\r\n\r\nprint(func(2))  # prints 4\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "simple hash library for string, file, dict, set and list",
    "version": "0.5.1",
    "project_urls": {
        "Download": "https://github.com/jamesabel/hashy",
        "Homepage": "https://github.com/jamesabel/hashy"
    },
    "split_keywords": [
        "hash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d20dcb1f4ef9bf242cac8523b6114e64a31ab5c60f731924f7d656108d3969b",
                "md5": "6b89da4b713c5b48e7e56b3b57e971d7",
                "sha256": "1d5dab11b757a7f8817e299b08f04b272573aee6672a44e3a03a35d834fc6e64"
            },
            "downloads": -1,
            "filename": "hashy-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b89da4b713c5b48e7e56b3b57e971d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8285,
            "upload_time": "2024-10-14T16:22:26",
            "upload_time_iso_8601": "2024-10-14T16:22:26.557057Z",
            "url": "https://files.pythonhosted.org/packages/2d/20/dcb1f4ef9bf242cac8523b6114e64a31ab5c60f731924f7d656108d3969b/hashy-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-14 16:22:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jamesabel",
    "github_project": "hashy",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "hashy"
}
        
Elapsed time: 0.44565s