# Install
$ pip3 install litehash
Use
Fibonacci
Calculate the checksum based on the bytes located at an increasing distance from each other, and the file size. We will read more bytes from the file header than from the body.
from pathlib import Path
from litehash import file_to_hash_fibonacci
print(file_to_hash_fibonacci(Path('/path/to/file.dat')))
Equidistant
Calculate the checksum based on ten equidistant bytes, and the file size. The very first and the very last byte of the file will be among the ten read.
from pathlib import Path
from litehash import file_to_hash_equidistant
print(file_to_hash_equidistant(Path('/path/to/file.dat'), n=10))
HashAlgo
The optional HashAlgo argument allows you to select a hashing algorithm.
By default, MD5 is used as a compromise between speed and size.
| Algorithm | Digest Size (bytes) |
|---|---|
HashAlgo.crc32 |
4 |
HashAlgo.md5 |
24 |
HashAlgo.sha256 |
32 |
from pathlib import Path
from litehash import file_to_hash_fibonacci, HashAlgo
print(file_to_hash_fibonacci(Path('/path/to/file.dat'), algo=HashAlgo.crc32))
Release files for litehash 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| litehash-0.2.2.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| litehash-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / litehash-0.2.2.tar.gz
| Download URL | litehash-0.2.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2938cfb9bf1a54d3e27e8dc88ebdd928469dd03dd1275633e95cb0b585d56ca
|
|
BLAKE2b-256 checksum How to use checksums |
5fb512db500c12ec11f7ffc3cc95bac0d3df0edff5fa140165c7aaf241aee614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / litehash-0.2.2-py3-none-any.whl
| Download URL | litehash-0.2.2-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9bde6ac0f9c405cd3aa85ff3e25a9230fa03f32c81a2f533fea711d39403d7a
|
|
BLAKE2b-256 checksum How to use checksums |
7abfb8bfc2a89384198b93790ec825318eef1b255ed79479b3907f90709ff4ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|