Skip to content

Commit

Permalink
use ruff linter
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoPope committed Aug 21, 2024
1 parent 3e1d1fa commit c716d61
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![License MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/GiacomoPope/dilithium-py/blob/main/LICENSE)
[![GitHub CI](https://github.com/GiacomoPope/dilithium-py/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/GiacomoPope/dilithium-py/actions/workflows/ci.yml)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

# CRYSTALS-Dilithium Python Implementation

Expand Down
14 changes: 6 additions & 8 deletions benchmarks/benchmark_dilithium.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def profile_dilithium(Dilithium):

def benchmark_dilithium(Dilithium, name, count):
# Banner
print(f"-" * 27)
print("-" * 27)
print(f" {name} | ({count} calls)")
print(f"-" * 27)
print("-" * 27)

fails = 0
keygen_times = []
Expand Down Expand Up @@ -68,10 +68,8 @@ def benchmark_dilithium(Dilithium, name, count):

if __name__ == "__main__":
# I used 1000 calls for the README, but you might want to
# shrink this down if you're playing
# shrink this down if you're experimenting
count = 1000
# benchmark_dilithium(Dilithium2, "Dilithium2", count)
# benchmark_dilithium(Dilithium3, "Dilithium3", count)
# benchmark_dilithium(Dilithium5, "Dilithium5", count)

profile_dilithium(Dilithium2)
benchmark_dilithium(Dilithium2, "Dilithium2", count)
benchmark_dilithium(Dilithium3, "Dilithium3", count)
benchmark_dilithium(Dilithium5, "Dilithium5", count)
6 changes: 3 additions & 3 deletions benchmarks/benchmark_ml_dsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def profile_ml_dsa(ML_DSA):

def benchmark_ml_dsa(ML_DSA, name, count):
# Banner
print(f"-" * 27)
print("-" * 27)
print(f" {name} | ({count} calls)")
print(f"-" * 27)
print("-" * 27)

fails = 0
keygen_times = []
Expand Down Expand Up @@ -68,7 +68,7 @@ def benchmark_ml_dsa(ML_DSA, name, count):

if __name__ == "__main__":
# I used 1000 calls for the README, but you might want to
# shrink this down if you're playing
# shrink this down if you're experimenting
count = 1000
benchmark_ml_dsa(ML_DSA_44, "ML_DSA_44", count)
benchmark_ml_dsa(ML_DSA_65, "ML_DSA_65", count)
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.ruff.lint]
# Avoid enforcing Ambiguous variable name (`E741`)
ignore = ["E741"]
2 changes: 2 additions & 0 deletions src/dilithium_py/dilithium/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .default_parameters import Dilithium2, Dilithium3, Dilithium5

__all__ = ["Dilithium2", "Dilithium3", "Dilithium5"]
2 changes: 2 additions & 0 deletions src/dilithium_py/ml_dsa/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .default_parameters import ML_DSA_44, ML_DSA_65, ML_DSA_87

__all__ = ["ML_DSA_44", "ML_DSA_65", "ML_DSA_87"]
1 change: 0 additions & 1 deletion tests/test_dilithium.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_dilithium5(self):

class TestKnownTestValuesDilithium(unittest.TestCase):
def generic_test_dilithium(self, Dilithium, file_name):

entropy_input = bytes([i for i in range(48)])
drbg = AES256_CTR_DRBG(entropy_input)

Expand Down

0 comments on commit c716d61

Please sign in to comment.