The playground is a small web page for experimenting with Phoenix without writing code. It runs entirely on your machine and calls the real library, so what you see is what the Python API does.
$ phoenix playground
Phoenix playground running at http://127.0.0.1:8765/ (Ctrl+C to stop)
Your browser opens automatically. Use --port to pick another port and
--no-browser to only print the address.
phoenix keygen.Things worth trying:
a, change the field to b, then unseal.Runs textbook NTRU on the toy parameters (N = 7, p = 3, q = 41) and prints
every intermediate polynomial: f, g, both inverses, the public key h,
the ciphertext e, and each stage of decryption.
Leave the inputs empty for random values, or enter up to seven coefficients
from the constant term upwards. Load the docs example fills in the values
used in The NTRU algorithm so you can follow
along. Compare the rows a and p·r·g + f·m: they are identical, which is
the whole reason decryption works.
Runs the number of rounds you ask for. Each round generates a new key pair, encapsulates, decapsulates and checks that both sides derived the same secret, then flips one bit of the ciphertext and checks that the secret changes. You get pass counts and mean/min/max timings for each operation.
Lists the built-in sets with their sizes, and the worst-case coefficient next to the limit it must stay under (see why decryption never fails).
127.0.0.1 only and rejects requests whose Host
header is not localhost or 127.0.0.1.The page talks to a JSON API you can also call yourself. All endpoints are
POST with a JSON object body; errors come back as status 400 with
{"error": "…"}.
| Endpoint | Body | Returns |
|---|---|---|
/api/params |
{} |
every built-in parameter set with sizes |
/api/keygen |
{"params": "phoenix677"} |
armored public and private, sizes, ms |
/api/seal |
{"public", "plaintext", "aad"} |
armored sealed, sizes, ms |
/api/unseal |
{"private", "sealed", "aad"} |
plaintext, ms |
/api/tamper |
{"sealed"} |
sealed with one bit flipped, and which byte/bit |
/api/toy |
optional f, g, m, r |
steps, ok, largest_coefficient |
/api/benchmark |
{"params", "rounds"} |
pass counts and timings |
$ curl -s -X POST http://127.0.0.1:8765/api/benchmark \
-d '{"params": "phoenix509", "rounds": 10}'