]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/test_gost3412.py
Raise copyright years
[pygost.git] / pygost / test_gost3412.py
index 6ab4c90d7076de2e3cc2e1d7a31cd7737afc681d..b8fbd202631fa21e7c12743354dfcfe06928ba8f 100644 (file)
@@ -1,6 +1,6 @@
 # coding: utf-8
 # PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2017 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2018 Sergey Matveev <stargrave@stargrave.org>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@ from unittest import TestCase
 
 from pygost.gost3412 import C
 from pygost.gost3412 import GOST3412Kuznechik
+from pygost.gost3412 import GOST3412Magma
 from pygost.gost3412 import L
 from pygost.gost3412 import PI
 from pygost.utils import hexdec
@@ -121,3 +122,17 @@ class KuznechikTest(TestCase):
     def test_decrypt(self):
         ciph = GOST3412Kuznechik(self.key)
         self.assertEqual(ciph.decrypt(self.ciphertext), self.plaintext)
+
+
+class MagmaTest(TestCase):
+    key = hexdec("ffeeddccbbaa99887766554433221100f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
+    plaintext = hexdec("fedcba9876543210")
+    ciphertext = hexdec("4ee901e5c2d8ca3d")
+
+    def test_encrypt(self):
+        ciph = GOST3412Magma(self.key)
+        self.assertEqual(ciph.encrypt(self.plaintext), self.ciphertext)
+
+    def test_decrypt(self):
+        ciph = GOST3412Magma(self.key)
+        self.assertEqual(ciph.decrypt(self.ciphertext), self.plaintext)