Skip to main content

Additional hashlib-compatible hashing digests

Project description

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

  • 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

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'

License

Copyright (c) 2019-2020 Ryan Finnie

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hashlib-additional-1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

hashlib_additional-1.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file hashlib-additional-1.1.tar.gz.

File metadata

  • Download URL: hashlib-additional-1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for hashlib-additional-1.1.tar.gz
Algorithm Hash digest
SHA256 ea8e8e7dd0e9140a8bd31f3486bc745fa16494341804f3c7d1dc7ca02b7ff288
MD5 fa0fa0af9db4b3cdbf6c7264d048d093
BLAKE2b-256 544d86ff5eb634d32032fe073be06b09fe8aaeac2e1c1a3ed7fa8b7fa0c2833f

See more details on using hashes here.

File details

Details for the file hashlib_additional-1.1-py3-none-any.whl.

File metadata

  • Download URL: hashlib_additional-1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for hashlib_additional-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5439a4275056e5d57f810be444c2a9efa572796b7e69f92606cb4a525f75b571
MD5 68e6ce0b93e8cdd8c0bee6d6a7415986
BLAKE2b-256 d1d0ef389d7b793dd2d944fb1d28a7f3c3bbdcb4f1116cbab33d32e2bccd7a10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page