Metadata-Version: 2.4
Name: philiprehberger-hash-utils
Version: 0.1.0
Summary: Simplified hashing helpers for strings, files, and checksums
Project-URL: Homepage, https://github.com/philiprehberger/py-hash-utils
Project-URL: Repository, https://github.com/philiprehberger/py-hash-utils
Project-URL: Issues, https://github.com/philiprehberger/py-hash-utils/issues
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Keywords: checksum,file-hash,hash,md5,sha256
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# philiprehberger-hash-utils

Simplified hashing helpers for strings, files, and checksums.

## Installation

```bash
pip install philiprehberger-hash-utils
```

## Usage

### Hash Strings and Bytes

```python
from philiprehberger_hash_utils import hash_string, hash_bytes

hash_string("hello world")                # SHA-256 hex digest
hash_string("hello world", "md5")         # MD5 hex digest
hash_bytes(b"\x00\x01\x02", "sha512")    # SHA-512 hex digest
```

### Hash Files

```python
from philiprehberger_hash_utils import hash_file

digest = hash_file("large_file.bin")  # Streams in chunks
digest = hash_file("data.csv", algorithm="blake2b")
```

### Hash Dictionaries

```python
from philiprehberger_hash_utils import hash_dict

# Deterministic — key order doesn't matter
hash_dict({"b": 2, "a": 1}) == hash_dict({"a": 1, "b": 2})  # True
```

### Verify Checksums

```python
from philiprehberger_hash_utils import verify_checksum

# Timing-safe comparison
is_valid = verify_checksum("download.zip", expected_sha256)
```

### Supported Algorithms

`md5`, `sha1`, `sha256` (default), `sha512`, `blake2b`

## API

- `hash_string(s, algorithm="sha256")` — Hash a string
- `hash_bytes(data, algorithm="sha256")` — Hash raw bytes
- `hash_file(path, algorithm="sha256", chunk_size=8192)` — Hash a file (streaming)
- `hash_dict(d, algorithm="sha256")` — Deterministic dict hash
- `verify_checksum(path, expected, algorithm="sha256")` — Timing-safe file verification

## License

MIT
