siphashc 2.3__tar.gz → 2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {siphashc-2.3 → siphashc-2.5}/CHANGES.rst +10 -0
- {siphashc-2.3/siphashc.egg-info → siphashc-2.5}/PKG-INFO +1 -1
- {siphashc-2.3 → siphashc-2.5}/pyproject.toml +14 -9
- {siphashc-2.3 → siphashc-2.5}/setup.py +0 -1
- siphashc-2.5/siphashc/__init__.pyi +1 -0
- siphashc-2.5/siphashc/py.typed +0 -0
- {siphashc-2.3 → siphashc-2.5/siphashc.egg-info}/PKG-INFO +1 -1
- {siphashc-2.3 → siphashc-2.5}/siphashc.egg-info/SOURCES.txt +2 -0
- {siphashc-2.3 → siphashc-2.5}/test_siphashc.py +21 -8
- {siphashc-2.3 → siphashc-2.5}/LICENSE.md +0 -0
- {siphashc-2.3 → siphashc-2.5}/MANIFEST.in +0 -0
- {siphashc-2.3 → siphashc-2.5}/README.rst +0 -0
- {siphashc-2.3 → siphashc-2.5}/setup.cfg +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphash/siphash.c +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphash/siphash.h +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphash/siphash_impl.h +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphashc.c +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphashc.egg-info/dependency_links.txt +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphashc.egg-info/requires.txt +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphashc.egg-info/top_level.txt +0 -0
- {siphashc-2.3 → siphashc-2.5}/siphashc.egg-info/zip-safe +0 -0
|
@@ -16,7 +16,7 @@ description = "Python module (in c) for siphash-2-4"
|
|
|
16
16
|
keywords = ["siphash", "siphash-2-4"]
|
|
17
17
|
name = "siphashc"
|
|
18
18
|
requires-python = ">=3.8"
|
|
19
|
-
version = "2.
|
|
19
|
+
version = "2.5"
|
|
20
20
|
|
|
21
21
|
[[project.authors]]
|
|
22
22
|
email = "michal@cihar.com"
|
|
@@ -48,21 +48,26 @@ profile = "black"
|
|
|
48
48
|
|
|
49
49
|
[tool.ruff]
|
|
50
50
|
ignore = [
|
|
51
|
-
"ANN", # TODO: missing type annotations
|
|
52
|
-
"PLR2004", # TODO: Magic value used in comparison
|
|
53
|
-
"PT011", # TODO: `pytest.raises(ValueError)` is too broad
|
|
54
51
|
"S101", # CONFIG: using pytest
|
|
55
52
|
"D203", # CONFIG: incompatible with D211
|
|
56
|
-
"D212"
|
|
57
|
-
"T201" # WONTFIX: using print() (maybe add noqa)
|
|
53
|
+
"D212" # CONFIG: incompatible with D213
|
|
58
54
|
]
|
|
59
|
-
output-format = "github"
|
|
60
55
|
select = ["ALL"]
|
|
61
56
|
|
|
57
|
+
[tool.ruff.lint.isort]
|
|
58
|
+
known-first-party = ["siphashc"]
|
|
59
|
+
known-third-party = ["pytest"]
|
|
60
|
+
|
|
62
61
|
[tool.ruff.mccabe]
|
|
63
62
|
max-complexity = 16
|
|
64
63
|
|
|
64
|
+
[tool.ruff.per-file-ignores]
|
|
65
|
+
"benchmark.py" = ["T201"]
|
|
66
|
+
|
|
65
67
|
[tool.setuptools]
|
|
66
|
-
include-package-data =
|
|
67
|
-
py-modules = []
|
|
68
|
+
include-package-data = true
|
|
68
69
|
zip-safe = true
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.packages.find]
|
|
72
|
+
include = ["siphashc*"]
|
|
73
|
+
namespaces = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
def siphash(key: str | bytes, plaintext: str | bytes) -> int: ...
|
|
File without changes
|
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
"""Test for siphashc module."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
2
5
|
import unittest
|
|
3
6
|
|
|
4
7
|
import pytest
|
|
8
|
+
|
|
5
9
|
from siphashc import siphash
|
|
6
10
|
|
|
7
11
|
|
|
8
12
|
class TestSiphashC(unittest.TestCase):
|
|
9
13
|
"""Test for siphashc module."""
|
|
10
14
|
|
|
11
|
-
def test_hash(self):
|
|
15
|
+
def test_hash(self: TestSiphashC) -> None:
|
|
12
16
|
"""Test simple hashing."""
|
|
13
17
|
result = siphash("sixteencharstrng", "i need a hash of this")
|
|
14
|
-
assert result == 10796923698683394048
|
|
18
|
+
assert result == 10796923698683394048 # noqa: PLR2004
|
|
15
19
|
|
|
16
20
|
result = siphash("0123456789ABCDEF", "a")
|
|
17
|
-
assert result == 12398370950267227270
|
|
21
|
+
assert result == 12398370950267227270 # noqa: PLR2004
|
|
18
22
|
|
|
19
|
-
def test_errors(self):
|
|
23
|
+
def test_errors(self: TestSiphashC) -> None:
|
|
20
24
|
"""Test error handling."""
|
|
21
|
-
with pytest.raises(
|
|
25
|
+
with pytest.raises(
|
|
26
|
+
ValueError,
|
|
27
|
+
match=r"key must be exactly 128 bits long \(16 chars\)",
|
|
28
|
+
):
|
|
22
29
|
siphash("not long enough", "a")
|
|
23
|
-
with pytest.raises(
|
|
30
|
+
with pytest.raises(
|
|
31
|
+
ValueError,
|
|
32
|
+
match=r"key must be exactly 128 bits long \(16 chars\)",
|
|
33
|
+
):
|
|
24
34
|
siphash("toooooooooooooooooooooooo long", "a")
|
|
25
|
-
with pytest.raises(
|
|
35
|
+
with pytest.raises(
|
|
36
|
+
ValueError,
|
|
37
|
+
match=r"key must be exactly 128 bits long \(16 chars\)",
|
|
38
|
+
):
|
|
26
39
|
siphash("", "a")
|
|
27
40
|
|
|
28
|
-
def test_reference_vectors(self):
|
|
41
|
+
def test_reference_vectors(self: TestSiphashC) -> None:
|
|
29
42
|
"""Test reference vectors."""
|
|
30
43
|
vectors = [
|
|
31
44
|
0x726FDB47DD0E0E31,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|