Skip to main content

HTTP Headers Hashing (HHHash)

HTTP Headers Hashing (HHHash) is a technique used to create a fingerprint of an HTTP server based on the headers it returns. HHHash employs one-way hashing to generate a hash value for the set of header keys returned by the server.

For more details about HHHash background, HTTP Headers Hashing (HHHash) or improving correlation of crawled content.

Calculation of the HHHash

To calculate the HHHash, we concatenate the list of headers returned by the HTTP server. This list is ordered according to the sequence in which the headers appear in the server's response. Each header value is separated with :.

The HHHash value is the SHA256 of the list.

HHHash format

hhh:1:20247663b5c63bf1291fe5350010dafb6d5e845e4c0daaf7dc9c0f646e947c29

prefix:version:SHA 256 value

Example

Calculating HHHash from a curl command

Curl will attempt to run the request using HTTP2 by default. In order to get the same hash as the python requests module (which doesn't supports HTTP2), you need to specify the version with the --http1.1 switch.

curl --http1.1 -s -D - https://www.circl.lu/ -o /dev/null  | awk 'NR != 1' | cut -f1 -d: | sed '/^[[:space:]]*$/d' | sed -z 's/\n/:/g' | sed 's/.$//' | sha256sum | cut -f1 -d " " | awk {'print "hhh:1:"$1'}

Output value

hhh:1:78f7ef0651bac1a5ea42ed9d22242ed8725f07815091032a34ab4e30d3c3cefc

Limitations

HHHash is an effective technique; however, its performance is heavily reliant on the characteristics of the HTTP client requests. Therefore, it is important to note that correlations between a set of hashes are typically established when using the same crawler or HTTP client parameters.

HTTP2 requires the headers to be lowercase. It will then changes the hash so you need to be aware of the HTTP version you're using.

hhhash - Python Library

The hhhash package can be installed via a pip install hhhash or build with Poetry from this repository poetry build and poetry install.

Usage

In [1]: import hhhash

In [2]: hhhash.buildhash(url="https://www.misp-lea.org", debug=False)
Out[2]: 'hhh:1:adca8a87f2a537dbbf07ba6d8cba6db53fde257ae2da4dad6f3ee6b47080c53f'

In [3]: hhhash.buildhash(url="https://www.misp-project.org", debug=False)
Out[3]: 'hhh:1:adca8a87f2a537dbbf07ba6d8cba6db53fde257ae2da4dad6f3ee6b47080c53f'

In [4]: hhhash.buildhash(url="https://www.circl.lu", debug=False)
Out[4]: 'hhh:1:334d8ab68f9e935f3af7c4a91220612f980f2d9168324530c03d28c9429e1299'

In [5]:

Other libraries

Release files for hhhash 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hhhash 0.4
File Size Uploaded
hhhash-0.4.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hhhash 0.4
File Interpreter ABI Platform
hhhash-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / hhhash-0.4.tar.gz

Download URL hhhash-0.4.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fd6312e7a078b2a85409eb18ad21b65a1c64167a869e15320c82787af1594374
BLAKE2b-256 checksum
How to use checksums
0af2ea79550b4b9d9e308f6e189c91793b756afa126f1af671ed9e89bd1e1ca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.8.10 Linux/5.15.0-78-generic

Release files / hhhash-0.4-py3-none-any.whl

Download URL hhhash-0.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80d80c3d707fcfb8b8a87c6a2e823b74cd46a1f4397304c880cd6ff27e02286f
BLAKE2b-256 checksum
How to use checksums
e0b76abf6ac2c66b23980388296eb5302ccc8f50592aab4b8ffe6b875709e35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.8.10 Linux/5.15.0-78-generic

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page