Research preview

Getting Started

Install vortex-pqc, run your first key exchange, and save keys as PEM files in under five minutes.

Skip to content

Before you begin

RequirementDetails
Python3.10 or newer
C compilerOptional — enables the fast native backend
Operating systemLinux · macOS · Windows (pure-Python path)
Runtime dependenciesNone

Step 1 · Install

From PyPI

bash
pip install vortex-pqc

From source

bash
git clone https://github.com/bajpai-labs/vortex-pqc.git
cd vortex-pqc
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
Which backend am I using?
python
import vortex_pqc
print(vortex_pqc.native_backend())
OutputMeaning
vortex-pqc-native-aarch64C extension active (fast)
vortex-pqc-native-x86_64C extension active (fast)
vortex-pqc-pure-pythonReference implementation (always correct)

Step 2 · Your first key exchange

python
from vortex_pqc import generate_keypair, encapsulate, decapsulate

# Alice generates a key pair
alice = generate_keypair()

# Bob encapsulates a shared secret to Alice's public key
bob = encapsulate(alice.public_key)

# Bob sends bob.data (768 bytes) over the network …

# Alice recovers the same secret
alice_secret = decapsulate(bob.data, alice.private_key)

assert alice_secret == bob.shared_secret

Step 3 · Object sizes

python
from vortex_pqc import (
    PUBLIC_KEY_BYTES,     # 800
    PRIVATE_KEY_BYTES,    # 1248
    CIPHERTEXT_BYTES,     # 768
    SHARED_SECRET_BYTES,  # 32
)
ObjectBytesWho holds it
Public key800Alice (published)
Private key1248Alice (secret)
Ciphertext768Sent by Bob → Alice
Shared secret32Both parties (derived)

Step 4 · PEM key files

VORTEX uses standard Base64 PEM — not hex — so it works with ordinary PEM tooling.

python
from vortex_pqc import (
    PEMKind,
    generate_keypair,
    encapsulate,
    write_pem_file,
    read_pem_file,
)

alice = generate_keypair()
bob   = encapsulate(alice.public_key)

write_pem_file("alice_pub.pem",   PEMKind.PUBLIC_KEY,    alice.public_key)
write_pem_file("alice_key.pem",   PEMKind.PRIVATE_KEY,   alice.private_key)
write_pem_file("ciphertext.pem",  PEMKind.CIPHERTEXT,    bob.data)
write_pem_file("secret.pem",      PEMKind.SHARED_SECRET, bob.shared_secret)

# Read back
sk = read_pem_file("alice_key.pem", PEMKind.PRIVATE_KEY)

A private key file looks like:

-----BEGIN VORTEX256 PRIVATE KEY-----
AQDQABAAABAAAA0AAAAAAPDP/gzQAhAAAAAAAA3QAA0AAPDPAQAAASAAAADQ/wwA
AAAAAA//zPAC0AAO3PARAAAQAAAP3PAQDQAPDPAiAAABAAAA0A/wzQARAAARAA
...
-----END VORTEX256 PRIVATE KEY-----

Private key files are written with permissions 0600.

→ Full spec: PEM Format

Step 5 · C library

bash
cd c
make lib      # → build/libvortex_pqc.a
make test     # unit tests
make demo     # Alice–Bob CLI demo
c
#include "vortex_pqc.h"
#include <stdio.h>
#include <string.h>

int main(void) {
    uint8_t pk[VORTEX_PUBLIC_KEY_BYTES];
    uint8_t sk[VORTEX_PRIVATE_KEY_BYTES];
    uint8_t ct[VORTEX_CIPHERTEXT_BYTES];
    uint8_t ss_enc[VORTEX_SHARED_SECRET_BYTES];
    uint8_t ss_dec[VORTEX_SHARED_SECRET_BYTES];

    vortex_keypair(pk, sk);
    vortex_enc(pk, ct, ss_enc);
    vortex_dec(ct, sk, ss_dec);

    printf("Match: %s\n",
           memcmp(ss_enc, ss_dec, 32) == 0 ? "yes" : "no");
    return 0;
}

Benchmarking

python
from vortex_pqc import benchmark_throughput

stats = benchmark_throughput(operations=50)
for op, result in stats.items():
    print(f"{op:8s}  {result['mean_ops']:,.0f} ops/s")

Optional extras:

bash
pip install "vortex-pqc[benchmark]"

Troubleshooting

ErrorCauseFix
Invalid public key lengthWrong byte count to encapsulatePass exactly 800 bytes
Invalid ciphertext lengthWrong byte count to decapsulatePass exactly 768 bytes
invalid data length for PEMData size doesn't match PEMKindCheck kind matches your bytes
Shared secrets don't matchMismatched keys or tampered ciphertextVerify pk/sk/ct belong together

What's next?

Integrating into your app?API Reference

Need the math?Cryptography

Contributing?Development Guide

Understanding the codebase?Architecture