Skip to main content

Sanskrit-Encoded Post-Quantum Cryptography SDK

Project description

Abhedya: Sanskrit-Encoded Post-Quantum Cryptography

Unmatched Speed. Unbreakable Security.

Abhedya is a high-performance Post-Quantum Cryptography (PQC) library that implements a Lattice-based (LWE) cryptosystem with a unique capability: Linguistic Steganography. It can encode ciphertexts into valid, prosodically correct Sanskrit verse.

Features

  • Post-Quantum Security: Based on the Learning With Errors (LWE) problem ($N=768, Q=3329$).
  • Sanskrit Steganography: "Metered Mode" produces ciphertexts that follow classical Anushtubh meter (Sloka).
  • High Performance: Sub-microsecond encryption (<1ms) via optimized Rust core.
  • Cross-Platform: Python bindings for the core Rust implementation.

Installation

pip install abhedya

Note: This package requires a compatible C runtime (provided in wheels for Linux/macOS/Windows).

Quick Start

from abhedya import Abhedya, EncryptionMode

# Initialize
crypto = Abhedya()

# 1. Generate Keys (Kyber-style LWE)
pk, sk = crypto.keygen()
print(f"Public Key Size: {len(pk)} bytes")

# 2. Encrypt (Standard Mode - High Speed)
message = b"Secret Message"
ciphertext = crypto.encrypt(pk, message, mode=EncryptionMode.STANDARD)
print(f"Ciphertext: {len(ciphertext)} bytes")

# 3. Decrypt
decrypted = crypto.decrypt(sk, ciphertext)
print(f"Decrypted: {decrypted.decode('utf-8')}")

Advanced Usage: Metered Mode (Steganography)

To generate ciphertext that mimics the statistical properties of Sanskrit verse (Poetry), use EncryptionMode.METERED.

# Encrypt with Metering (Slower, but steganographic)
ciphertext_verse = crypto.encrypt(pk, message, mode=EncryptionMode.METERED)

# The output binary is shaped to map to Sanskrit syllables
# adhering to Laghu/Guru (Light/Heavy) weight patterns.

API Reference

Abhedya(lib_path: str = None)

Initializes the library. Automatically finds the shared object if installed via pip.

keygen() -> (bytes, bytes)

Generates a new Keypair.

  • Returns: (public_key, secret_key)

encrypt(pk: bytes, msg: bytes, mode: int) -> bytes

Encrypts a message.

  • mode:
    • 0 (Standard): Raw LWE output.
    • 1 (Metered): Prosody-compliant output.

decrypt(sk: bytes, ct: bytes) -> bytes

Decrypts the ciphertext.

License

MIT License. See Repository for details.

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

abhedya-1.0.26.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

abhedya-1.0.26-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file abhedya-1.0.26.tar.gz.

File metadata

  • Download URL: abhedya-1.0.26.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for abhedya-1.0.26.tar.gz
Algorithm Hash digest
SHA256 0332060876123a20635fb20494dae1a4fc092558365750092ad540d5bd55a4a5
MD5 08d606fe32316b01001ecd5d6bd199b0
BLAKE2b-256 b144914b35150a84e2a8e7ad6a17dff3ecee137d216eb64d77258c487bbbd75f

See more details on using hashes here.

File details

Details for the file abhedya-1.0.26-py3-none-any.whl.

File metadata

  • Download URL: abhedya-1.0.26-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for abhedya-1.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 55f174670a2bfa45721b9455605589ae663adf0935ad2aaff45e10b6fe7a5bdf
MD5 cd92bc9480e4098ba545601962da136d
BLAKE2b-256 37533ddf2afe042c34dd902931542dd2ca3fbd61e7573870af8d3e52ae6da916

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