]> Cypherpunks.ru repositories - pygost.git/commitdiff
Shorter module names for convenience and simplicity
authorSergey Matveev <stargrave@stargrave.org>
Sat, 19 Nov 2016 13:22:08 +0000 (16:22 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 19 Nov 2016 13:36:44 +0000 (16:36 +0300)
12 files changed:
pygost/Makefile
pygost/gost3410_vko.py
pygost/gost34112012.py [moved from pygost/gost3411_2012.py with 100% similarity]
pygost/gost34112012256.py [moved from pygost/gost3411_2012_256.py with 90% similarity]
pygost/gost34112012512.py [moved from pygost/gost3411_2012_512.py with 90% similarity]
pygost/gost341194.py [moved from pygost/gost3411_94.py with 100% similarity]
pygost/stubs/pygost/gost34112012.pyi [moved from pygost/stubs/pygost/gost3411_2012.pyi with 100% similarity]
pygost/stubs/pygost/gost34112012256.pyi [new file with mode: 0644]
pygost/stubs/pygost/gost34112012512.pyi [new file with mode: 0644]
pygost/stubs/pygost/gost341194.pyi [moved from pygost/stubs/pygost/gost3411_94.pyi with 100% similarity]
pygost/test_gost34112012.py [moved from pygost/test_gost3411_2012.py with 91% similarity]
pygost/test_gost341194.py [moved from pygost/test_gost3411_94.py with 98% similarity]

index a6df86121cb9dcb691dd212c3ce1c1686412cdfe..53eebf3276ccf98ca96f558080029aa9d99108af 100644 (file)
@@ -3,8 +3,8 @@ PYTHON ?= python
 test:
        PYTHONPATH=.. $(PYTHON) -m unittest test_gost28147
        PYTHONPATH=.. $(PYTHON) -m unittest test_gost28147_mac
-       PYTHONPATH=.. $(PYTHON) -m unittest test_gost3411_94
-       PYTHONPATH=.. $(PYTHON) -m unittest test_gost3411_2012
+       PYTHONPATH=.. $(PYTHON) -m unittest test_gost341194
+       PYTHONPATH=.. $(PYTHON) -m unittest test_gost34112012
        PYTHONPATH=.. $(PYTHON) -m unittest test_gost3410
        PYTHONPATH=.. $(PYTHON) -m unittest test_gost3410_vko
        PYTHONPATH=.. $(PYTHON) -m unittest test_wrap
index 93393f35fd00f0b9ac3f30c23064bd86393b6f34..e8bc13f9dbdb7e1cac74e97573b199f1e87313ec 100644 (file)
@@ -1,7 +1,7 @@
 from pygost.gost3410 import pub_marshal
-from pygost.gost3411_2012_256 import GOST34112012256
-from pygost.gost3411_2012_512 import GOST34112012512
-from pygost.gost3411_94 import GOST341194
+from pygost.gost34112012256 import GOST34112012256
+from pygost.gost34112012512 import GOST34112012512
+from pygost.gost341194 import GOST341194
 from pygost.utils import bytes2long
 
 
similarity index 90%
rename from pygost/gost3411_2012_256.py
rename to pygost/gost34112012256.py
index 8586be59f2673e585aee4f62564f1ddf8e92ef70..bfb84485a491d872746ee396a1a354439201ce5e 100644 (file)
@@ -4,7 +4,7 @@ This is implementation of :rfc:`6986`. Most function and variable names are
 taken according to specification's terminology.
 """
 
-from gost3411_2012 import GOST34112012
+from gost34112012 import GOST34112012
 
 
 class GOST34112012256(GOST34112012):
similarity index 90%
rename from pygost/gost3411_2012_512.py
rename to pygost/gost34112012512.py
index 802bbd9bf66915e82b53e250a6c25dd3640935a6..4cbdbd4586f6d3ab0c0167351e1a3c789b9e999b 100644 (file)
@@ -4,7 +4,7 @@ This is implementation of :rfc:`6986`. Most function and variable names are
 taken according to specification's terminology.
 """
 
-from gost3411_2012 import GOST34112012
+from gost34112012 import GOST34112012
 
 
 class GOST34112012512(GOST34112012):
similarity index 100%
rename from pygost/gost3411_94.py
rename to pygost/gost341194.py
diff --git a/pygost/stubs/pygost/gost34112012256.pyi b/pygost/stubs/pygost/gost34112012256.pyi
new file mode 100644 (file)
index 0000000..e1ce2f1
--- /dev/null
@@ -0,0 +1,13 @@
+class GOST34112012256:
+    def __init__(self, data: bytes=...) -> None: ...
+
+    @property
+    def digest_size(self) -> int: ...
+
+    def copy(self) -> "GOST34112012256": ...
+
+    def update(self, data: bytes) -> None: ...
+
+    def digest(self) -> bytes: ...
+
+    def hexdigest(self) -> str: ...
diff --git a/pygost/stubs/pygost/gost34112012512.pyi b/pygost/stubs/pygost/gost34112012512.pyi
new file mode 100644 (file)
index 0000000..163fe7a
--- /dev/null
@@ -0,0 +1,13 @@
+class GOST34112012512:
+    def __init__(self, data: bytes=...) -> None: ...
+
+    @property
+    def digest_size(self) -> int: ...
+
+    def copy(self) -> "GOST34112012512": ...
+
+    def update(self, data: bytes) -> None: ...
+
+    def digest(self) -> bytes: ...
+
+    def hexdigest(self) -> str: ...
similarity index 91%
rename from pygost/test_gost3411_2012.py
rename to pygost/test_gost34112012.py
index bcb4f20b20f5cf9010d860cf33b50824de7683ac..3665df2c8127ba7c7de1e20918a204af3d6ad59f 100644 (file)
 from unittest import TestCase
 import hmac
 
-from pygost import gost3411_2012_256
-from pygost import gost3411_2012_512
-from pygost.gost3411_2012_256 import GOST34112012256
-from pygost.gost3411_2012_512 import GOST34112012512
+from pygost import gost34112012256
+from pygost import gost34112012512
+from pygost.gost34112012256 import GOST34112012256
+from pygost.gost34112012512 import GOST34112012512
 from pygost.utils import hexdec
 
 
@@ -39,7 +39,7 @@ class TestHMAC(TestCase):
     """http://tc26.ru/methods/recommendation/%D0%A2%D0%9A26%D0%90%D0%9B%D0%93.pdf test vectors
     """
     def test_256(self):
-        for digestmod in (GOST34112012256, gost3411_2012_256):
+        for digestmod in (GOST34112012256, gost34112012256):
             self.assertEqual(
                 hmac.new(
                     key=hexdec("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"),
@@ -50,7 +50,7 @@ class TestHMAC(TestCase):
             )
 
     def test_512(self):
-        for digestmod in (GOST34112012512, gost3411_2012_512):
+        for digestmod in (GOST34112012512, gost34112012512):
             self.assertEqual(
                 hmac.new(
                     key=hexdec("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"),
similarity index 98%
rename from pygost/test_gost3411_94.py
rename to pygost/test_gost341194.py
index f15d2126806f79d39e156b43cf78f08d72b982ea..4af684bb5379c48e60f9feae6a1c1a95f4367b18 100644 (file)
@@ -19,8 +19,8 @@ from unittest import skip
 from unittest import TestCase
 import hmac
 
-from pygost import gost3411_94
-from pygost.gost3411_94 import GOST341194
+from pygost import gost341194
+from pygost.gost341194 import GOST341194
 from pygost.utils import bytes2long
 from pygost.utils import hexenc
 from pygost.utils import long2bytes
@@ -40,7 +40,7 @@ class TestCopy(TestCase):
 
 class TestHMACPEP247(TestCase):
     def runTest(self):
-        h = hmac.new(b"foo", digestmod=gost3411_94)
+        h = hmac.new(b"foo", digestmod=gost341194)
         h.update(b"foobar")
         h.digest()