oshash
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.
Installation
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
Comparison
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/compare_algorithms.py <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 OpenSubtitles.org Wiki
Acknowledgements
Thanks to the OpenSubtitles.org team for this algorithm.
Metadata
Release files for oshash 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| oshash-0.1.1.tar.gz | 3.4 kB | Without provenance | Details |
Release files / oshash-0.1.1.tar.gz
| Download URL | oshash-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7eb7dfdd7d976d3a06fcc14ba8cf8265cd387c99e57bdd310e0ab847b7b7f0b7
|
|
BLAKE2b-256 checksum How to use checksums |
82ea074c82c08eb702e4f1a52beb0c59db5dcbb8054befcc647b9b5be7264805
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.0
|
Security for oshash 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.