# coding: utf-8
# PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2017 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2021 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-""" GOST 28147-89 MAC
+"""GOST 28147-89 MAC
"""
from copy import copy
from pygost.gost3413 import pad1
from pygost.iface import PEP247
from pygost.utils import strxor
-from pygost.utils import xrange # pylint: disable=redefined-builtin
+from pygost.utils import xrange
digest_size = 8
SEQ_MAC = (
class MAC(PEP247):
- """ GOST 28147-89 MAC mode of operation
+ """GOST 28147-89 MAC mode of operation
>>> m = MAC(key=key)
>>> m.update("some data")
return MAC(self.key, copy(self.data), self.iv, self.sbox)
def update(self, data):
- """ Append data that has to be authenticated
+ """Append data that has to be authenticated
"""
self.data += data
def digest(self):
- """ Get MAC tag of supplied data
+ """Get MAC tag of supplied data
You have to provide at least single byte of data.
If you want to produce tag length of 3 bytes, then