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.18.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.18-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: abhedya-1.0.18.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.18.tar.gz
Algorithm Hash digest
SHA256 f87d4f5ad45679ca947a8695b5006213b79d483092ba4b8b3258fa89838b1e20
MD5 1f32eb6a5a7aa9d19e100faf679d4544
BLAKE2b-256 7ae309171db42ad38031e0afc9869d63a5446e906904089fdc4e8bec95233b55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: abhedya-1.0.18-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.18-py3-none-any.whl
Algorithm Hash digest
SHA256 13b0bd46b6562ec21b2a20f634243c012c0a418d5349cc1b7d025ddc81677a0e
MD5 c4fe51f89066e3713377c0c82f4635b9
BLAKE2b-256 abae874caeec3b18660fa0200aae98acae1ec125f218097324d42e56ae36d7c2

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