Skip to content
AlessandroBudroniPublic

About

Python3 implementation of PERK

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PERK-PY

License: MIT pytest

Caution

This code is for academic and educational use only. It is not constant-time and omits production hardening. It should not be used for real cryptographic applications.

PERK is a digital signature schemes whose security relies on the hardness of the Permuted Kernel Problem.

This repository contains a pure Python3 KAT-compliant implementation of PERK v.2.2.0 in the variant using SHA3 for commitments and seed expansion. The purpose of this repository is educational and testing. The code is not optimized and quite slow, especially for level 5 parameters sets.

Dependencies

Install the Python test/runtime dependencies with:

pip install -r requirements.txt

How to use

Minimal example for keygen, sign, and verify:

from perk import Perk

perk = Perk("perk-1-fast")
pk, sk = perk.keygen()
message = b"hello perk"

sig = perk.sign(message, pk, sk)
res = perk.verify(message, sig, pk)
print("verified:", res)

Running tests

From repo root, ensure Python can import src:

PYTHONPATH=src pytest -vv

Run only lightweight sanity tests

PYTHONPATH=src pytest tests/test_sign.py -vv

Run KAT (keygen + sign + verify)

Run KAT tests with the following command. Limit KATs to test per variant for speed reasons via PERK_KAT_LIMIT (default 3, max 100):

PYTHONPATH=src PERK_KAT_LIMIT=1 pytest tests/test_kat.py -vv

Run KAT (keygen + verify)

Skip signature generation in KAT tests:

PYTHONPATH=src PERK_KAT_LIMIT=1 PERK_VERIFY_ONLY=1 pytest tests/test_kat.py -vv

Benchmarks

Run benchmarks:

PYTHONPATH=src PERK_BENCH=1 PERK_BENCH_LOOPS=5 pytest tests/test_sign.py -k benchmark -vv -s

Author

Alessandro Budroni

About

Python3 implementation of PERK

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages