{"id":21206195,"url":"https://github.com/rtmigo/litehash_py","last_synced_at":"2025-03-14T23:11:50.646Z","repository":{"id":46321381,"uuid":"385752241","full_name":"rtmigo/litehash_py","owner":"rtmigo","description":"Fast coarse hashes from files","archived":false,"fork":false,"pushed_at":"2022-06-20T14:34:05.000Z","size":254,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"staging","last_synced_at":"2025-02-21T22:37:47.360Z","etag":null,"topics":["crc32","fast","fibonacci","file","hashing","md5","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/litehash/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-13T22:40:16.000Z","updated_at":"2022-07-18T19:49:20.000Z","dependencies_parsed_at":"2022-08-25T12:32:00.763Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/litehash_py","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flitehash_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flitehash_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flitehash_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Flitehash_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/litehash_py/tar.gz/refs/heads/staging","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658274,"owners_count":20326467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crc32","fast","fibonacci","file","hashing","md5","python"],"created_at":"2024-11-20T20:54:46.405Z","updated_at":"2025-03-14T23:11:50.624Z","avatar_url":"https://github.com/rtmigo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [litehash](https://github.com/rtmigo/litehash_py)\n\nCalculates fast coarse hashes from files. Instead of hashing entire files, we take individual bytes, add the size of the file, and calculate the hash from that.\n\nThis allows you to get hashes of large files very quickly. However, it\nmay not display small differences in file content.\n\n## Install\n\n``` bash\n$ pip3 install litehash\n```\n\n## Use\n\n### Fibonacci\n\nCalculate the checksum based on the bytes located at an increasing distance from\neach other, and the file size. We will read more bytes from the\nfile header than from the body.\n\n``` python3\nfrom pathlib import Path\nfrom litehash import file_to_hash_fibonacci\n\nprint(file_to_hash_fibonacci(Path('/path/to/file.dat')))\n```\n\n### Equidistant\n\nCalculate the checksum based on ten equidistant bytes, and the file size. \nThe very first and the very last byte of the file will be among the ten read.\n\n``` python3\nfrom pathlib import Path\nfrom litehash import file_to_hash_equidistant \n\nprint(file_to_hash_equidistant(Path('/path/to/file.dat'), n=10))\n```\n\n\n### HashAlgo\n\nThe optional `HashAlgo` argument allows you to select a hashing algorithm.\n\nBy default, MD5 is used as a compromise between speed and size.\n\n\n| Algorithm         | Digest Size (bytes) |\n|-------------------|---------------------|\n| `HashAlgo.crc32`  | 4                   |\n| `HashAlgo.md5`    | 24                  |\n| `HashAlgo.sha256` | 32                  |\n\n```python3\nfrom pathlib import Path\nfrom litehash import file_to_hash_fibonacci, HashAlgo\n\nprint(file_to_hash_fibonacci(Path('/path/to/file.dat'), algo=HashAlgo.crc32))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Flitehash_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Flitehash_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Flitehash_py/lists"}