Skip to main content

Pure Python hash length extension.

Project description

PureHLE

Pure Python hash length extension.

Installation

pip install purehle

Usage

Information used in the examples:

  • Hash of key + DE: 2ecdde3959051d913f61b14579ea136d
  • Length of key: 3
  • Data to append: F

CLI

> purehle -d 2ecdde3959051d913f61b14579ea136d -o DE -l 3 -a F

Using hash type MD5.
Hash (hex): d542ef0939e3c366f3eca18d4fa0bc77
Hash (bytes): b'\xd5B\xef\t9\xe3\xc3f\xf3\xec\xa1\x8dO\xa0\xbcw'
Data (hex): 4445800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280000000000000046
Data (bytes): 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\x00F'

Module

import purehle

hle = purehle.MD5(bytes.fromhex("2ecdde3959051d913f61b14579ea136d"), b"DE")
padding, m = hle.with_length(3)
m.update(b"F")
data = hle.original + padding + b"F"

data  # 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\x00F"
m.hexdigest() # d542ef0939e3c366f3eca18d4fa0bc77

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.1.tar.gz (6.1 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.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: purehle-1.0.1.tar.gz
  • Upload date:
  • Size: 6.1 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.1.tar.gz
Algorithm Hash digest
SHA256 c35342a9566cd589c03b2859f873f9e1c25cce0ed11e82d4df9a91b39865e09d
MD5 fd5f3f435c9e7cb586b52e20dae31df1
BLAKE2b-256 9d8b8686980265a0224d2f43180abc2f96a01068e326d3ea55dce5502ed3faef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: purehle-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf6a03896b1789eb1c5e0f00e732395b584720a573ea9fa38622ee9fd6a6d0e8
MD5 5cf9b27ebab6af95d2bd55fab191a47d
BLAKE2b-256 6c7d3a79ddafc5fa47deb9d2ac32ce2ee99344c707aa0234b5683a15ff2c2910

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