Skip to main content

SHEP64 and SHEP333 key generation, encryption, signing, and CLI tooling

Project description

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

pip install shep32

Install from source

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

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:

shep32 --help
pyshep --help

Open the interactive menu:

shep32 start

Common commands

Generate a fresh random key:

shep32 key

Generate a deterministic SHEP32 key from text:

shep32 hash --text "hello"

Generate a deterministic SHEP32 key from an integer:

shep32 hash --value 12345

Generate a SHEP333 key:

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

Generate a range:

shep32 range --start 0 --hashes 10

Encrypt text with an explicit SHEP32 key:

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

Encrypt text with an explicit SHEP333 key:

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

Encrypt text with a phrase in SHEP333 mode:

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

Encrypt a file:

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

Decrypt a token file with a key file:

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

Decrypt text with a phrase in SHEP333 mode:

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

Derive a public key:

shep32 pubkey --keyfile ./notes.pkey

Sign text:

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

Verify a signature:

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

Run a benchmark:

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:

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shep32-2.60.23.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shep32-2.60.23-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file shep32-2.60.23.tar.gz.

File metadata

  • Download URL: shep32-2.60.23.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for shep32-2.60.23.tar.gz
Algorithm Hash digest
SHA256 2128303b45846fd834eec6a5c7122462c51c38ef4159a0b2bff65eff9f06e832
MD5 f17b324953201bceb1f4ca1a5082df48
BLAKE2b-256 e269a17d591e41a405a3a06485e488dee0b552f5e771e033c770268dede955ba

See more details on using hashes here.

File details

Details for the file shep32-2.60.23-py3-none-any.whl.

File metadata

  • Download URL: shep32-2.60.23-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for shep32-2.60.23-py3-none-any.whl
Algorithm Hash digest
SHA256 026d2943d97f5612c68e1b3f2e6a15ac2f239842130154b1b940820aa1b41aaa
MD5 df333fb6f0aba830c2476ea5f0707fdd
BLAKE2b-256 d6b9390748af68a08d325c028de0ea217c68b1c1e2d510dd4dd0c237b04446e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page