diff --git a/.gitignore b/.gitignore index a224939..3959358 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/.DS_Store -__pycache__ \ No newline at end of file +__pycache__ +docs/build diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..14dd391 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,26 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - pdf + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: requirements.txt + - requirements: docs/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..6c5d5d4 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx-rtd-theme diff --git a/docs/source/aes256_ctr_drbg.rst b/docs/source/aes256_ctr_drbg.rst new file mode 100644 index 0000000..4dcf0f0 --- /dev/null +++ b/docs/source/aes256_ctr_drbg.rst @@ -0,0 +1,7 @@ +aes256\_ctr\_drbg module +======================== + +.. automodule:: aes256_ctr_drbg + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/api.rst b/docs/source/api.rst new file mode 100644 index 0000000..c231f39 --- /dev/null +++ b/docs/source/api.rst @@ -0,0 +1,15 @@ +API +=== + +.. toctree:: + aes256_ctr_drbg + benchmark_kyber + kyber + ml_kem + modules + modules_generic + ntt_helper + polynomials + polynomials_generic + run_kyber + utils diff --git a/docs/source/benchmark_kyber.rst b/docs/source/benchmark_kyber.rst new file mode 100644 index 0000000..0668c34 --- /dev/null +++ b/docs/source/benchmark_kyber.rst @@ -0,0 +1,7 @@ +benchmark\_kyber module +======================= + +.. automodule:: benchmark_kyber + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..291c668 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,39 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Code location ----------------------------------------------------------- + +import os +import sys + +sys.path.insert(0, os.path.abspath("../..")) + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "kyber-py" +copyright = "2024, Giacomo Pope" +author = "Giacomo Pope" +release = "0.3.0-alpha1" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", +] + +templates_path = ["_templates"] +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] +intersphinx_mapping = {"Python": ("https://docs.python.org/", None)} diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..5b19dfb --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,26 @@ +.. kyber-py documentation master file, created by + sphinx-quickstart on Fri Jul 19 18:19:51 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to kyber-py's documentation! +==================================== + +Welcome to the documentation of the kyber-py package. +This is a pure-python implementation of th ML-KEM (formely Kyber) algorithm +for cryptographic exchange of keys. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + api + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/kyber.rst b/docs/source/kyber.rst new file mode 100644 index 0000000..4dbb2e5 --- /dev/null +++ b/docs/source/kyber.rst @@ -0,0 +1,7 @@ +kyber module +============ + +.. automodule:: kyber + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/ml_kem.rst b/docs/source/ml_kem.rst new file mode 100644 index 0000000..3ce0178 --- /dev/null +++ b/docs/source/ml_kem.rst @@ -0,0 +1,7 @@ +ml\_kem module +============== + +.. automodule:: ml_kem + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 0000000..a96076c --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,7 @@ +modules module +============== + +.. automodule:: modules + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/modules_generic.rst b/docs/source/modules_generic.rst new file mode 100644 index 0000000..ce18b16 --- /dev/null +++ b/docs/source/modules_generic.rst @@ -0,0 +1,7 @@ +modules\_generic module +======================= + +.. automodule:: modules_generic + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/ntt_helper.rst b/docs/source/ntt_helper.rst new file mode 100644 index 0000000..04b6c08 --- /dev/null +++ b/docs/source/ntt_helper.rst @@ -0,0 +1,7 @@ +ntt\_helper module +================== + +.. automodule:: ntt_helper + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polynomials.rst b/docs/source/polynomials.rst new file mode 100644 index 0000000..309ef7b --- /dev/null +++ b/docs/source/polynomials.rst @@ -0,0 +1,7 @@ +polynomials module +================== + +.. automodule:: polynomials + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polynomials_generic.rst b/docs/source/polynomials_generic.rst new file mode 100644 index 0000000..0be0ea3 --- /dev/null +++ b/docs/source/polynomials_generic.rst @@ -0,0 +1,7 @@ +polynomials\_generic module +=========================== + +.. automodule:: polynomials_generic + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/run_kyber.rst b/docs/source/run_kyber.rst new file mode 100644 index 0000000..c1ab145 --- /dev/null +++ b/docs/source/run_kyber.rst @@ -0,0 +1,7 @@ +run\_kyber module +================= + +.. automodule:: run_kyber + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/utils.rst b/docs/source/utils.rst new file mode 100644 index 0000000..44cef9e --- /dev/null +++ b/docs/source/utils.rst @@ -0,0 +1,7 @@ +utils module +============ + +.. automodule:: utils + :members: + :undoc-members: + :show-inheritance: