Skip to main content

Pure Python hash length extension.

Project description

PureHLE

Pure Python hash length extension.

Installation

pip install purehle

Usage

import hashlib

import purehle

hle = purehle.MD5(hashlib.md5(b"ABCDE").digest(), b"DE")
padding, m = hle.with_length(3)
m.update(b"FG")
message = hle.original + padding + b"FG"

message  # b"DE\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00FG"
m.hexdigest() # 4bbc3725884dad7b4e1358c51959f0b0

hashlib.md5(b"ABC" + message).digest() == m.digest()

Supported Hash Algorithms

  • MD5 (MD%)
  • SHA-1 (SHA1)
  • SHA-256 (SHA256)
  • SHA-512 (SHA512)

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

purehle-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

purehle-1.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file purehle-1.0.0.tar.gz.

File metadata

  • Download URL: purehle-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for purehle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3051e917b64920afaab30e6c9c10ba2344618a69ad72d9715d743de42b1a6873
MD5 b1974fcf07f2a1f96124bd6d1b092f6e
BLAKE2b-256 f8b3e03a42d5118651360bf178a408197b0ca13f1ecba43b66a336fa8439bc57

See more details on using hashes here.

File details

Details for the file purehle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: purehle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for purehle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57a32ca9475567d197e8deb21e3a036441689b0b3cfd089569e6f415781dacd0
MD5 6d6b94c83dbb8c7f8640dd7b80680e4c
BLAKE2b-256 7bfb99fa35f7581e2dd35d97232b15f1372d0befc677cc7faef2c2dbef37c0f9

See more details on using hashes here.

Supported by

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