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

Uploaded Python 3

File details

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

File metadata

  • Download URL: abhedya-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f045bac0cb03aeb7b3c9dc21d1877dd8ffe6f9573e5c0f121b8b982b0fb1788f
MD5 8ce16167bc8e0f13e66bd947e01b53a1
BLAKE2b-256 8f5b34d38219e4a2dfccd0ddfbd47dc771257e39f95765d36c8dafe137cdfc2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: abhedya-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb8f1cd9991e054dbb2420bd7f23e247874eb61d2bcf1de8c4e58114cafc93bc
MD5 d5481f35b1dfa45909c4e15afb34ebc7
BLAKE2b-256 a4990e3aa40f44508e0df1fabf662e33f69e8f1d49c4d7733faa30e0c96df9e4

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