hashlib-additional - Additional hashlib-compatible hashing digests
About
This module packages several additional hashing digests in a hashlib-compatible format. It implements the following digests:
- null - Always outputs null byte "hashes", with a configurable digest_size
- random - Always outputs random "hashes", with a configurable digest_size
- crc32 - CRC32 digest, 4 byte digest_size
- adler32 - Adler-32 digest, 4 byte digest_size
- fletcher16 - Fletcher 8-bit implementation, 2 byte digest_size
- fletcher32 - Fletcher 16-bit implementation, 4 byte digest_size
- fletcher64 - Fletcher 32-bit implementation, 8 byte digest_size
- fnv0 - Fowler-Noll-Vo hash version 0, 4 (default) through 128 byte configurable digest_size
- fnv1 - Fowler-Noll-Vo hash version 1, 4 (default) through 128 byte configurable digest_size
- fnv1a - Fowler-Noll-Vo hash version 1a, 4 (default) through 128 byte configurable digest_size
- cksum - Unix cksum checksum, 4 byte digest_size
- sysv - Unix System V checksum, 2 byte digest_size
- bsd - BSD checksum, 2 byte digest_size
- udp - UDP checksum, 2 byte digest_size
- twoping - 2ping checksum, 2 byte digest_size
- sdbm - sdbm (ndbm reimplementation) checksum, 4 byte digest_size
- djb2 - Daniel J. Bernstein's checksum, 4 byte digest_size
Unless stated, all digest outputs are big-endian (network byte order).
"sysv", "bsd" and "cksum" results are just the hash (in byte form), even though technically the full checksum (as returned by "sum" and "cksum") is comprised of the decimal hash and input length, separated by a space.
Example
>>> import hashlib_additional
>>> digest = hashlib_additional.new('crc32')
>>> digest.update(b'foo')
>>> digest.hexdigest()
'8c736521'
>>> hashlib_additional.algorithms_available
{'adler32', 'bsd', 'cksum', 'crc32', 'fletcher16', 'fletcher32',
'fletcher64', 'null', 'random', 'sysv', 'twoping', 'udp'}
>>> digest = hashlib_additional.twoping(b'bar')
>>> digest.digest()
b'+\x9e'
>>> import io
>>> import hashlib
>>> digest = hashlib.file_digest(io.BytesIO(b'bar'), hashlib_additional.twoping)
>>> digest.digest()
b'+\x9e'
License
Copyright © 2019 Ryan Finnie ryan@finnie.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This document is provided under the following license:
SPDX-PackageName: python-hashlib-additional
SPDX-PackageSupplier: Ryan Finnie <ryan@finnie.org>
SPDX-PackageDownloadLocation: https://github.com/rfinnie/python-hashlib-additional
SPDX-FileCopyrightText: © 2019 Ryan Finnie <ryan@finnie.org>
SPDX-License-Identifier: MIT
Metadata
Release files for hashlib-additional 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hashlib_additional-1.2.tar.gz | 10.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hashlib_additional-1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / hashlib_additional-1.2.tar.gz
| Download URL | hashlib_additional-1.2.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4e73c165a5123fd99fedd088c4148078042d52f59e284a11b8f5314e89baef1
|
|
BLAKE2b-256 checksum How to use checksums |
945d04f60a3a3e2d6bfdc7573c8d0e25fd9dfe2a9c6556a4b4ecff86f859016c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / hashlib_additional-1.2-py3-none-any.whl
| Download URL | hashlib_additional-1.2-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc6346ad4df4a4ff943ffec9ae58351ffd681df42a718241b72cbe5cf314ca1c
|
|
BLAKE2b-256 checksum How to use checksums |
931b79094b41bb41619fbe83654f1359458e49fc32a4876caa4f8cadce612028
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for hashlib-additional 1.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.
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.