Metadata-Version: 2.4
Name: shep32
Version: 2.60.23
Summary: SHEP64 and SHEP333 key generation, encryption, signing, and CLI tooling
Author: Andrew Lehti
License-Expression: MIT
Project-URL: Homepage, http://metopedia.com
Project-URL: Source, https://github.com/andylehti/SHEP32
Keywords: shep32,shep333,crypto,cli,encryption,signing,hashing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Environment :: Console
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42.0.0
Dynamic: license-file

# shep32

`shep32` packages the Python implementation of the SHEP32 and SHEP333 tooling with both a Python API and a console CLI.

## What it includes

- SHEP32 primary key generation
- SHEP333 extended key generation
- Text and file encryption/decryption to `.sh32`
- Detached body/meta encryption mode
- Ed25519 public key derivation, signing, and verification
- Range generation and benchmark commands
- Interactive CLI mode

## Key formats

- **SHEP32** is the primary key format. It is a **32-byte** key, typically represented as a **64-character hexadecimal string**.
- **SHEP333** is the extended key format. It uses the extended derivation path and produces the wider mixed-alphabet extended key equal to **333 bits**.

## Install

### Install from PyPI

```bash
pip install shep32
```

### Install from source

Clone the repository, then change into the Python package directory that contains `pyproject.toml` and install it:

```bash
git clone https://github.com/andylehti/SHEP32.git
cd SHEP32/python/shep32
python3 -m pip install -e .
```

## CLI entry points

After installation, both of these commands work:

```bash
shep32 --help
pyshep --help
```

Open the interactive menu:

```bash
shep32 start
```

## Common commands

Generate a fresh random key:

```bash
shep32 key
```

Generate a deterministic SHEP32 key from text:

```bash
shep32 hash --text "hello"
```

Generate a deterministic SHEP32 key from an integer:

```bash
shep32 hash --value 12345
```

Generate a SHEP333 key:

```bash
shep32 hash --mode 1 --text "hello"
```

Generate a range:

```bash
shep32 range --start 0 --hashes 10
```

Encrypt text with an explicit SHEP32 key:

```bash
shep32 enc --text "secret" --key "9ab70f801ba94395af24ad2a5b1aedba3d428202bd6aa27a78c700bbe04707dd"
```

Encrypt text with an explicit SHEP333 key:

```bash
shep32 enc --text "secret" --key "<shep333-key>" --mode 1
```

Encrypt text with a phrase in SHEP333 mode:

```bash
shep32 enc --text "secret" --phrase "1234" --mode 1
```

Encrypt a file:

```bash
shep32 enc --file ./notes.txt --phrase "password"
```

Decrypt a token file with a key file:

```bash
shep32 dec --file ./notes.sh32 --keyfile ./notes.pkey
```

Decrypt text with a phrase in SHEP333 mode:

```bash
shep32 dec --text "<token>" --phrase "1234" --mode 1
```

Derive a public key:

```bash
shep32 pubkey --keyfile ./notes.pkey
```

Sign text:

```bash
shep32 sign --text "message" --keyfile ./notes.pkey
```

Verify a signature:

```bash
shep32 verify --text "message" --signature <signature> --public-key <publicKey>
```

Run a benchmark:

```bash
shep32 bench --hashes 1000 --compare
```

## Key input rules for `enc`, `dec`, `pubkey`, and `sign`

- `--key` means an **explicit SHEP32 or SHEP333 key**
- `--phrase` means an **explicit phrase**, even if it looks like a valid key
- `--keyfile` means a file containing an **explicit SHEP32 or SHEP333 key**
- `--mode 0` selects **SHEP32** behavior
- `--mode 1` selects **SHEP333** behavior

Examples:

```bash
shep32 enc --text "secret" --key "<shep32-key>"
shep32 enc --text "secret" --key "<shep333-key>" --mode 1
shep32 enc --text "secret" --phrase "1234" --mode 1
shep32 dec --text "<token>" --key "<shep32-key>"
shep32 dec --text "<token>" --phrase "1234" --mode 1
```

## Python API

```python
from shep32 import generateKey, encryptData, decryptData, signData, verifySignature

key = generateKey("hello", mode = 0)
cipher, usedKey = encryptData("secret", key)
plain = decryptData(cipher, usedKey)

sig = signData("message", usedKey)
ok = verifySignature("message", sig["signature"], sig["publicKey"])
```

## License

MIT License: https://github.com/andylehti/SHEP32/blob/main/LICENSE
