From: Sergey Matveev Date: Sat, 19 Nov 2016 13:22:08 +0000 (+0300) Subject: Shorter module names for convenience and simplicity X-Git-Tag: 3.0~20 X-Git-Url: http://www.git.cypherpunks.ru/?p=pygost.git;a=commitdiff_plain;h=c8f1dd2e8e0c1fe29d13b7f34dcb480079190ec0 Shorter module names for convenience and simplicity --- diff --git a/pygost/Makefile b/pygost/Makefile index a6df861..53eebf3 100644 --- a/pygost/Makefile +++ b/pygost/Makefile @@ -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 diff --git a/pygost/gost3410_vko.py b/pygost/gost3410_vko.py index 93393f3..e8bc13f 100644 --- a/pygost/gost3410_vko.py +++ b/pygost/gost3410_vko.py @@ -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 diff --git a/pygost/gost3411_2012.py b/pygost/gost34112012.py similarity index 100% rename from pygost/gost3411_2012.py rename to pygost/gost34112012.py diff --git a/pygost/gost3411_2012_256.py b/pygost/gost34112012256.py similarity index 90% rename from pygost/gost3411_2012_256.py rename to pygost/gost34112012256.py index 8586be5..bfb8448 100644 --- a/pygost/gost3411_2012_256.py +++ b/pygost/gost34112012256.py @@ -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): diff --git a/pygost/gost3411_2012_512.py b/pygost/gost34112012512.py similarity index 90% rename from pygost/gost3411_2012_512.py rename to pygost/gost34112012512.py index 802bbd9..4cbdbd4 100644 --- a/pygost/gost3411_2012_512.py +++ b/pygost/gost34112012512.py @@ -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): diff --git a/pygost/gost3411_94.py b/pygost/gost341194.py similarity index 100% rename from pygost/gost3411_94.py rename to pygost/gost341194.py diff --git a/pygost/stubs/pygost/gost3411_2012.pyi b/pygost/stubs/pygost/gost34112012.pyi similarity index 100% rename from pygost/stubs/pygost/gost3411_2012.pyi rename to pygost/stubs/pygost/gost34112012.pyi diff --git a/pygost/stubs/pygost/gost34112012256.pyi b/pygost/stubs/pygost/gost34112012256.pyi new file mode 100644 index 0000000..e1ce2f1 --- /dev/null +++ b/pygost/stubs/pygost/gost34112012256.pyi @@ -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 index 0000000..163fe7a --- /dev/null +++ b/pygost/stubs/pygost/gost34112012512.pyi @@ -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: ... diff --git a/pygost/stubs/pygost/gost3411_94.pyi b/pygost/stubs/pygost/gost341194.pyi similarity index 100% rename from pygost/stubs/pygost/gost3411_94.pyi rename to pygost/stubs/pygost/gost341194.pyi diff --git a/pygost/test_gost3411_2012.py b/pygost/test_gost34112012.py similarity index 91% rename from pygost/test_gost3411_2012.py rename to pygost/test_gost34112012.py index bcb4f20..3665df2 100644 --- a/pygost/test_gost3411_2012.py +++ b/pygost/test_gost34112012.py @@ -18,10 +18,10 @@ 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"), diff --git a/pygost/test_gost3411_94.py b/pygost/test_gost341194.py similarity index 98% rename from pygost/test_gost3411_94.py rename to pygost/test_gost341194.py index f15d212..4af684b 100644 --- a/pygost/test_gost3411_94.py +++ b/pygost/test_gost341194.py @@ -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()