Skip to main content

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.

Metadata

Release files for abhedya 1.0.40

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abhedya 1.0.40
File Size Uploaded
abhedya-1.0.40.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for abhedya 1.0.40
File Interpreter ABI Platform
abhedya-1.0.40-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / abhedya-1.0.40.tar.gz

Download URL abhedya-1.0.40.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7221b85693c2e4bcaf8e62b35acd0ee2da0242d08272ba0d3d9d2b28c3dea4f1
BLAKE2b-256 checksum
How to use checksums
18d32f15bc61773afaa45b85c24820882e303836151179f26672ea9bfc19ce81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / abhedya-1.0.40-py3-none-any.whl

Download URL abhedya-1.0.40-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f12e3435ece7a2d3cc2ac856cca0259cce2201764590402036447115384482d
BLAKE2b-256 checksum
How to use checksums
6a9c1b626147467cbb4176a48328b95ba5d6b9560a70e3c5798178652969292a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.0.40 This release

2 release files

1.0.39

2 release files

1.0.35

2 release files

1.0.34

2 release files

1.0.33

2 release files

1.0.32

2 release files

1.0.31

2 release files

1.0.30

2 release files

1.0.29

2 release files

1.0.28

2 release files

1.0.27

2 release files

1.0.26

2 release files

1.0.24

2 release files

1.0.23

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page