pygost/gost3410.py | 2 +- pygost/mgm.py | 8 ++++---- pygost/wrap.py | 2 +- diff --git a/pygost/gost3410.py b/pygost/gost3410.py index 74c18de549c45b7ca0e641ef74af6966a423996fab17b5719118229ae60f1991..64018323ccc4ba5f25a48b9c01fc47223a7527c0d826c9122fba3a070539388b 100644 --- a/pygost/gost3410.py +++ b/pygost/gost3410.py @@ -120,7 +120,7 @@ def st(self): """Compute s/t parameters for twisted Edwards curve points conversion """ if self.e is None or self.d is None: - raise ValueError("non twisted Edwards curve") + raise ValueError("Non twisted Edwards curve") if self._st is not None: return self._st self._st = ( diff --git a/pygost/mgm.py b/pygost/mgm.py index 452eda4473732cd20c6d1c4ed235b0a89f0285d8b151089007a2d6912dad628a..ed2ca8746aa5e2ee1c45c9d5643b61daca7b79eeb06470acc9817c7cef8ac4e4 100644 --- a/pygost/mgm.py +++ b/pygost/mgm.py @@ -57,10 +57,10 @@ :param int tag_size: authentication tag size (defaults to blocksize if not specified) """ if bs not in (8, 16): - raise ValueError("only 64/128-bit blocksizes allowed") + raise ValueError("Only 64/128-bit blocksizes allowed") self.tag_size = bs if tag_size is None else bs if self.tag_size < 4 or self.tag_size > bs: - raise ValueError("invalid tag_size") + raise ValueError("Invalid tag_size") self.encrypter = encrypter self.bs = bs self.max_size = (1 << (bs * 8 // 2)) - 1 @@ -74,7 +74,7 @@ raise ValueError("nonce must not have higher bit set") def _validate_sizes(self, plaintext, additional_data): if len(plaintext) == 0 and len(additional_data) == 0: - raise ValueError("at least one of plaintext or additional_data required") + raise ValueError("At least one of plaintext or additional_data required") if len(plaintext) + len(additional_data) > self.max_size: raise ValueError("plaintext+additional_data are too big") @@ -164,5 +164,5 @@ ciphertext[-self.tag_size:], ) tag = self._auth(icn, ciphertext, additional_data) if not compare_digest(tag_expected, tag): - raise ValueError("invalid authentication tag") + raise ValueError("Invalid authentication tag") return self._crypt(icn, ciphertext) diff --git a/pygost/wrap.py b/pygost/wrap.py index aa307e72c3e91f140ae803a85219e24478d8a1393f00d6094c710a9816b396bf..b10bbee3928a225db95bc91afdcca68b80100ee1e017616232bc99714fd75652 100644 --- a/pygost/wrap.py +++ b/pygost/wrap.py @@ -143,5 +143,5 @@ """ key_and_key_mac = ctr(encrypter_key, bs, kexp, iv) key, key_mac = key_and_key_mac[:-bs], key_and_key_mac[-bs:] if not compare_digest(mac(encrypter_mac, bs, iv + key), key_mac): - raise ValueError("invalid authentication tag") + raise ValueError("Invalid authentication tag") return key