2 # PyGOST -- Pure Python GOST cryptographic functions library
3 # Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, version 3 of the License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 from unittest import TestCase
19 from pygost.kdf import kdf_gostr3411_2012_256
20 from pygost.kdf import kdf_tree_gostr3411_2012_256
21 from pygost.utils import hexdec
24 class TestKDFGOSTR34112012256(TestCase):
27 kdf_gostr3411_2012_256(
28 hexdec("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"),
30 hexdec("af21434145656378"),
32 hexdec("a1aa5f7de402d7b3d323f2991c8d4534013137010a83754fd0af6d7cd4922ed9"),
36 class TestKDFTREEGOSTR34112012256(TestCase):
38 self.assertSequenceEqual(
39 kdf_tree_gostr3411_2012_256(
40 hexdec("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"),
42 hexdec("af21434145656378"),
45 (hexdec("a1aa5f7de402d7b3d323f2991c8d4534013137010a83754fd0af6d7cd4922ed9"),),
47 self.assertSequenceEqual(
48 kdf_tree_gostr3411_2012_256(
49 hexdec("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"),
51 hexdec("af21434145656378"),
55 hexdec("22b6837845c6bef65ea71672b265831086d3c76aebe6dae91cad51d83f79d16b"),
56 hexdec("074c9330599d7f8d712fca54392f4ddde93751206b3584c8f43f9e6dc51531f9"),