Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/asdfjkl/pyky
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfjkl committed Sep 9, 2022
2 parents 8af7973 + 01efb6a commit 0322ed5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Kyber512 in Python

## About

- just a toy implementation to better understand the algorithm
- for now, 512 only but should be easily extendable to 768 and 1024 sec levels.
- ported from the [Go Implementation](https://github.com/kudelskisecurity/crystals-go), so not the fanciest Python code
- not hardened against (timing/other) side channel attacks

## How To Use

Just take a look at `cakem.py`. Functions

- `kem_keygen512()`,
- `kem_encaps512(pubkey, seed=None)` and
- `kem_decaps512(private_key, ciphertext)`

correspond directly to the [spec](https://pq-crystals.org/). For `kem_encaps` you can optionally provide a custom `m` which is useful for debugging.

Typical kem would be

````
priv, pub = kem_keygen512()
secret1, cipher = kem_encaps512(pub)
secret2 = kem_decaps512(priv, cipher)
````

0 comments on commit 0322ed5

Please sign in to comment.