From: Sergey Matveev Date: Mon, 19 Oct 2020 10:51:19 +0000 (+0300) Subject: Unify ValueErrors string capitalizing X-Git-Tag: 5.2~2 X-Git-Url: http://www.git.cypherpunks.ru/?p=pygost.git;a=commitdiff_plain;h=03de94212cd7c039e6a7f4f947fbd2d7d6c9b70e Unify ValueErrors string capitalizing --- diff --git a/pygost/gost3410.py b/pygost/gost3410.py index a2cc7ce..3a47187 100644 --- a/pygost/gost3410.py +++ b/pygost/gost3410.py @@ -120,7 +120,7 @@ class GOST3410Curve(object): """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 33e297c..340fae6 100644 --- a/pygost/mgm.py +++ b/pygost/mgm.py @@ -57,10 +57,10 @@ class MGM(object): (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 @@ class MGM(object): 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 @@ class MGM(object): ) 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 301023e..2ef6f89 100644 --- a/pygost/wrap.py +++ b/pygost/wrap.py @@ -143,5 +143,5 @@ def kimp15(encrypter_key, encrypter_mac, bs, kexp, iv): 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