Skip to main content

Open Subtitles Hash implementation

Project description


OpenSubtitles Hash implementation.

This algorithm is focused on speed because unlike other algorithms, OSHash doesn't read the whole file. This makes it a perfect algorithm for hashing large files.


The latest stable release can be installed from PyPI:

$ pip install oshash

API usage

Simply import oshash and call oshash function with your file path.

import oshash

file_hash = oshash.oshash("/path/to/file")

Command usage

You can compute OSHash directly from the terminal.

$ oshash <file_path>

For example:

$ oshash /path/to/video.mp4
OSHash (/path/to/video.mp4) = d315edebf53a4af3


A short comparison with other algorithms:

320p video (61.7 MB) 1080p video (339.4 MB)

You can create a comparison for any file with the following command:

$ python3 scripts/ <file_path>

If you want to view graphics, make sure you have matplotlib installed.

How It Works?

In pseudo-code, the hash is computed in the following way:

file_buffer = open("/path/to/file/")

head_checksum = checksum(file_buffer.head(64 * 1024))  # 64KB
tail_checksum = checksum(file_buffer.tail(64 * 1024))  # 64KB

file_hash = file_buffer.size + head_checksum + tail_checksum

You can read more in Wiki


Thanks to the team for this algorithm.

Project details

Download files

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

Files for oshash, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size oshash-0.1.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page