Convenience hashing facilities.
*Latest release 20241207*:
BaseHashCode.hashclass: raise ValueError from unknown hash function name with greater detail on the underlying failure.
## <a name="BaseHashCode"></a>Class `BaseHashCode(builtins.bytes)`
Base class for hashcodes, subclassed by `SHA1`, `SHA256` et al.
You can obtain the class for a particular hasher by name, example:
SHA256 = BaseHashCode.hashclass('sha256')
*`BaseHashCode.__str__(self)`*:
Return `f'{self.hashname}:{self.hex()}'`.
*`BaseHashCode.from_buffer(bfr: cs.buffer.CornuCopyBuffer)`*:
Compute hashcode from the contents of the `CornuCopyBuffer` `bfr`.
*`BaseHashCode.from_data(bs)`*:
Compute hashcode from the data `bs`.
*`BaseHashCode.from_fspath(fspath, **kw)`*:
Compute hashcode from the contents of the file `fspath`.
*`BaseHashCode.from_hashbytes(hashbytes)`*:
Factory function returning a `BaseHashCode` object from the hash bytes.
*`BaseHashCode.from_hashbytes_hex(hashhex: str)`*:
Factory function returning a `BaseHashCode` object
from the hash bytes hex text.
*`BaseHashCode.from_named_hashbytes_hex(hashname, hashhex)`*:
Factory function to return a `HashCode` object
from the hash type name and the hash bytes hex text.
*`BaseHashCode.from_prefixed_hashbytes_hex(hashtext: str)`*:
Factory function returning a `BaseHashCode` object
from the hash bytes hex text prefixed by the hashname.
This is the reverse of `__str__`.
*`BaseHashCode.get_hashfunc(hashname: str)`*:
Fetch the hash function implied by `hashname`.
*`BaseHashCode.hashclass(hashname: str, hashfunc=None, **kw)`*:
Return the class for the hash function named `hashname`.
Parameters:
* `hashname`: the name of the hash function
* `hashfunc`: optional hash function for the class
*`BaseHashCode.hashname`*:
The hash code type name, derived from the class name.
*`BaseHashCode.hex(self) -> str`*:
Return the hashcode bytes transcribes as a hexadecimal ASCII `str`.
*`BaseHashCode.promote(obj)`*:
Promote to a `BaseHashCode` instance.
## <a name="MD5"></a>Class `MD5(BaseHashCode)`
Hash class for the 'md5' algorithm.
*`MD5.hashfunc`*
## <a name="SHA1"></a>Class `SHA1(BaseHashCode)`
Hash class for the 'sha1' algorithm.
*`SHA1.hashfunc`*
## <a name="SHA224"></a>Class `SHA224(BaseHashCode)`
Hash class for the 'sha224' algorithm.
*`SHA224.hashfunc`*
## <a name="SHA256"></a>Class `SHA256(BaseHashCode)`
Hash class for the 'sha256' algorithm.
*`SHA256.hashfunc`*
## <a name="SHA384"></a>Class `SHA384(BaseHashCode)`
Hash class for the 'sha384' algorithm.
*`SHA384.hashfunc`*
## <a name="SHA512"></a>Class `SHA512(BaseHashCode)`
Hash class for the 'sha512' algorithm.
*`SHA512.hashfunc`*
# Release Log
*Release 20241207*:
BaseHashCode.hashclass: raise ValueError from unknown hash function name with greater detail on the underlying failure.
*Release 20240412*:
* BaseHashCode.hashclass(hashname): fall back to looking for blake3 from the blake3 module.
* BaseHashCode: new get_hashfunc(hashname) static method.
*Release 20240316*:
Fixed release upload artifacts.
*Release 20240211*:
Initial PyPI release: BaseHashCode(bytes) and subclasses for various hash algorithms.
Raw data
{
"_id": null,
"home_page": null,
"name": "cs-hashutils",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python3",
"author": null,
"author_email": "Cameron Simpson <cs@cskk.id.au>",
"download_url": "https://files.pythonhosted.org/packages/83/77/b60d41ddf3385b55830567ba4cc456c52c557ec896475601f5aefed94324/cs_hashutils-20241207.tar.gz",
"platform": null,
"description": "Convenience hashing facilities.\n\n*Latest release 20241207*:\nBaseHashCode.hashclass: raise ValueError from unknown hash function name with greater detail on the underlying failure.\n\n## <a name=\"BaseHashCode\"></a>Class `BaseHashCode(builtins.bytes)`\n\nBase class for hashcodes, subclassed by `SHA1`, `SHA256` et al.\n\nYou can obtain the class for a particular hasher by name, example:\n\n SHA256 = BaseHashCode.hashclass('sha256')\n\n*`BaseHashCode.__str__(self)`*:\nReturn `f'{self.hashname}:{self.hex()}'`.\n\n*`BaseHashCode.from_buffer(bfr: cs.buffer.CornuCopyBuffer)`*:\nCompute hashcode from the contents of the `CornuCopyBuffer` `bfr`.\n\n*`BaseHashCode.from_data(bs)`*:\nCompute hashcode from the data `bs`.\n\n*`BaseHashCode.from_fspath(fspath, **kw)`*:\nCompute hashcode from the contents of the file `fspath`.\n\n*`BaseHashCode.from_hashbytes(hashbytes)`*:\nFactory function returning a `BaseHashCode` object from the hash bytes.\n\n*`BaseHashCode.from_hashbytes_hex(hashhex: str)`*:\nFactory function returning a `BaseHashCode` object\nfrom the hash bytes hex text.\n\n*`BaseHashCode.from_named_hashbytes_hex(hashname, hashhex)`*:\nFactory function to return a `HashCode` object\nfrom the hash type name and the hash bytes hex text.\n\n*`BaseHashCode.from_prefixed_hashbytes_hex(hashtext: str)`*:\nFactory function returning a `BaseHashCode` object\nfrom the hash bytes hex text prefixed by the hashname.\nThis is the reverse of `__str__`.\n\n*`BaseHashCode.get_hashfunc(hashname: str)`*:\nFetch the hash function implied by `hashname`.\n\n*`BaseHashCode.hashclass(hashname: str, hashfunc=None, **kw)`*:\nReturn the class for the hash function named `hashname`.\n\nParameters:\n* `hashname`: the name of the hash function\n* `hashfunc`: optional hash function for the class\n\n*`BaseHashCode.hashname`*:\nThe hash code type name, derived from the class name.\n\n*`BaseHashCode.hex(self) -> str`*:\nReturn the hashcode bytes transcribes as a hexadecimal ASCII `str`.\n\n*`BaseHashCode.promote(obj)`*:\nPromote to a `BaseHashCode` instance.\n\n## <a name=\"MD5\"></a>Class `MD5(BaseHashCode)`\n\nHash class for the 'md5' algorithm.\n\n*`MD5.hashfunc`*\n\n## <a name=\"SHA1\"></a>Class `SHA1(BaseHashCode)`\n\nHash class for the 'sha1' algorithm.\n\n*`SHA1.hashfunc`*\n\n## <a name=\"SHA224\"></a>Class `SHA224(BaseHashCode)`\n\nHash class for the 'sha224' algorithm.\n\n*`SHA224.hashfunc`*\n\n## <a name=\"SHA256\"></a>Class `SHA256(BaseHashCode)`\n\nHash class for the 'sha256' algorithm.\n\n*`SHA256.hashfunc`*\n\n## <a name=\"SHA384\"></a>Class `SHA384(BaseHashCode)`\n\nHash class for the 'sha384' algorithm.\n\n*`SHA384.hashfunc`*\n\n## <a name=\"SHA512\"></a>Class `SHA512(BaseHashCode)`\n\nHash class for the 'sha512' algorithm.\n\n*`SHA512.hashfunc`*\n\n# Release Log\n\n\n\n*Release 20241207*:\nBaseHashCode.hashclass: raise ValueError from unknown hash function name with greater detail on the underlying failure.\n\n*Release 20240412*:\n* BaseHashCode.hashclass(hashname): fall back to looking for blake3 from the blake3 module.\n* BaseHashCode: new get_hashfunc(hashname) static method.\n\n*Release 20240316*:\nFixed release upload artifacts.\n\n*Release 20240211*:\nInitial PyPI release: BaseHashCode(bytes) and subclasses for various hash algorithms.\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 or later (GPLv3+)",
"summary": "Convenience hashing facilities.",
"version": "20241207",
"project_urls": {
"MonoRepo Commits": "https://bitbucket.org/cameron_simpson/css/commits/branch/main",
"Monorepo Git Mirror": "https://github.com/cameron-simpson/css",
"Monorepo Hg/Mercurial Mirror": "https://hg.sr.ht/~cameron-simpson/css",
"Source": "https://github.com/cameron-simpson/css/blob/main/lib/python/cs/hashutils.py"
},
"split_keywords": [
"python3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c29dcda9bfc048500f69e25d8a512fba9caeeddb2105f8816093dc5d0d333749",
"md5": "99be768cf1f909892aea3f1c6862751e",
"sha256": "8da4d430be1c9bd2664e8c053b709670db259c2042f25cef4e2762f2b7ffa8da"
},
"downloads": -1,
"filename": "cs_hashutils-20241207-py3-none-any.whl",
"has_sig": false,
"md5_digest": "99be768cf1f909892aea3f1c6862751e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4851,
"upload_time": "2024-12-06T23:32:18",
"upload_time_iso_8601": "2024-12-06T23:32:18.809989Z",
"url": "https://files.pythonhosted.org/packages/c2/9d/cda9bfc048500f69e25d8a512fba9caeeddb2105f8816093dc5d0d333749/cs_hashutils-20241207-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8377b60d41ddf3385b55830567ba4cc456c52c557ec896475601f5aefed94324",
"md5": "b0a92f82eede8aea3dec851efcb9c785",
"sha256": "f2d6609e64fa7ba7e1a8034b865420342cfaa3e6c73ab7afc5aeed96cb39c880"
},
"downloads": -1,
"filename": "cs_hashutils-20241207.tar.gz",
"has_sig": false,
"md5_digest": "b0a92f82eede8aea3dec851efcb9c785",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4811,
"upload_time": "2024-12-06T23:32:20",
"upload_time_iso_8601": "2024-12-06T23:32:20.556175Z",
"url": "https://files.pythonhosted.org/packages/83/77/b60d41ddf3385b55830567ba4cc456c52c557ec896475601f5aefed94324/cs_hashutils-20241207.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 23:32:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cameron-simpson",
"github_project": "css",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cs-hashutils"
}