From ace4761de19bc31281857860311814bece8e0d38 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 10 Jun 2017 22:59:15 +0300 Subject: [PATCH] Rename Kuz to Kuznechik for clarity --- NEWS | 3 +++ VERSION | 2 +- pygost/gost3412.py | 2 +- pygost/stubs/pygost/gost3412.pyi | 2 +- pygost/test_gost3412.py | 8 ++++---- pygost/test_gost3413.py | 18 +++++++++--------- www.texi | 5 +++++ 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 7298105..fd1faa5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +3.3: + * GOST3412Kuz renamed to GOST3412Kuznezhik + 3.2: 34.13-2015 block cipher modes of operation implementations. diff --git a/VERSION b/VERSION index a3ec5a4..eb39e53 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2 +3.3 diff --git a/pygost/gost3412.py b/pygost/gost3412.py index 48919c2..6633186 100644 --- a/pygost/gost3412.py +++ b/pygost/gost3412.py @@ -121,7 +121,7 @@ def lp(blk): return L([PI[v] for v in blk]) -class GOST3412Kuz(object): +class GOST3412Kuznechik(object): """GOST 34.12-2015 128-bit block cipher Кузнечик (Kuznechik) """ def __init__(self, key): diff --git a/pygost/stubs/pygost/gost3412.pyi b/pygost/stubs/pygost/gost3412.pyi index 5b17743..c67a7da 100644 --- a/pygost/stubs/pygost/gost3412.pyi +++ b/pygost/stubs/pygost/gost3412.pyi @@ -1,4 +1,4 @@ -class GOST3412Kuz(object): +class GOST3412Kuznechik(object): def __init__(self, key: bytes) -> None: ... def encrypt(self, blk: bytes) -> bytes: ... diff --git a/pygost/test_gost3412.py b/pygost/test_gost3412.py index e7138b3..6ab4c90 100644 --- a/pygost/test_gost3412.py +++ b/pygost/test_gost3412.py @@ -18,7 +18,7 @@ from unittest import TestCase from pygost.gost3412 import C -from pygost.gost3412 import GOST3412Kuz +from pygost.gost3412 import GOST3412Kuznechik from pygost.gost3412 import L from pygost.gost3412 import PI from pygost.utils import hexdec @@ -102,7 +102,7 @@ class KuznechikTest(TestCase): self.assertEqual(C[7], hexdec("f6593616e6055689adfba18027aa2a08")) def test_roundkeys(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.ks[0], hexdec("8899aabbccddeeff0011223344556677")) self.assertEqual(ciph.ks[1], hexdec("fedcba98765432100123456789abcdef")) self.assertEqual(ciph.ks[2], hexdec("db31485315694343228d6aef8cc78c44")) @@ -115,9 +115,9 @@ class KuznechikTest(TestCase): self.assertEqual(ciph.ks[9], hexdec("72e9dd7416bcf45b755dbaa88e4a4043")) def test_encrypt(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.encrypt(self.plaintext), self.ciphertext) def test_decrypt(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.decrypt(self.ciphertext), self.plaintext) diff --git a/pygost/test_gost3413.py b/pygost/test_gost3413.py index 5e3a39b..31a56f3 100644 --- a/pygost/test_gost3413.py +++ b/pygost/test_gost3413.py @@ -2,7 +2,7 @@ from os import urandom from random import randint from unittest import TestCase -from pygost.gost3412 import GOST3412Kuz +from pygost.gost3412 import GOST3412Kuznechik from pygost.gost3413 import _mac_ks from pygost.gost3413 import cbc_decrypt from pygost.gost3413 import cbc_encrypt @@ -30,9 +30,9 @@ class Pad2Test(TestCase): ) -class GOST3412KuzModesTest(TestCase): +class GOST3412KuznechikModesTest(TestCase): key = hexdec("8899aabbccddeeff0011223344556677fedcba98765432100123456789abcdef") - ciph = GOST3412Kuz(key) + ciph = GOST3412Kuznechik(key) plaintext = "" plaintext += "1122334455667700ffeeddccbbaa9988" plaintext += "00112233445566778899aabbcceeff0a" @@ -58,7 +58,7 @@ class GOST3412KuzModesTest(TestCase): def test_ecb_symmetric(self): for _ in range(100): pt = pad2(urandom(randint(0, 16 * 2)), 16) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ecb_encrypt(ciph.encrypt, 16, pt) self.assertSequenceEqual(ecb_decrypt(ciph.decrypt, 16, ct), pt) @@ -82,7 +82,7 @@ class GOST3412KuzModesTest(TestCase): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(8) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ctr(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(ctr(ciph.encrypt, 16, ct, iv), pt) @@ -105,7 +105,7 @@ class GOST3412KuzModesTest(TestCase): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ofb(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(ofb(ciph.encrypt, 16, ct, iv), pt) @@ -128,7 +128,7 @@ class GOST3412KuzModesTest(TestCase): for _ in range(100): pt = pad2(urandom(randint(0, 16 * 2)), 16) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = cbc_encrypt(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(cbc_decrypt(ciph.decrypt, 16, ct, iv), pt) @@ -151,7 +151,7 @@ class GOST3412KuzModesTest(TestCase): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = cfb_encrypt(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(cfb_decrypt(ciph.encrypt, 16, ct, iv), pt) @@ -167,5 +167,5 @@ class GOST3412KuzModesTest(TestCase): def test_mac_applies(self): for _ in range(100): data = urandom(randint(0, 16 * 2)) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) mac(ciph.encrypt, 16, data) diff --git a/www.texi b/www.texi index 834b682..6cb880b 100644 --- a/www.texi +++ b/www.texi @@ -89,6 +89,11 @@ mailing list. Announcements also go to this mailing list. @unnumbered News @table @strong +@item 3.3 + @itemize + @item @code{GOST3412Kuz} renamed to @code{GOST3412Kuznezhik} + @end itemize + @item 3.2 34.13-2015 block cipher modes of operation implementations. -- 2.44.0