From b3b27cd4811ce935e42bbcd251206ff2cb3b51b9 Mon Sep 17 00:00:00 2001 From: Kian Meng Ang Date: Sat, 6 Nov 2021 23:12:14 +0800 Subject: [PATCH] Fix typos (#266) * Fix typos * Fix pylint e501 --- NEWS | 2 +- README.md | 18 +++++++++--------- src/ecdsa/_version.py | 2 +- src/ecdsa/keys.py | 27 +++++++++++++-------------- src/ecdsa/test_keys.py | 2 +- versioneer.py | 4 ++-- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index a8e861d6..b18624e1 100644 --- a/NEWS +++ b/NEWS @@ -63,7 +63,7 @@ Performance: single-shot verify (i.e. without precomputation) by about 4 to 5%. * Use native Python 3.8 support for calculating multiplicative inverses. -Maintenace: +Maintenance: * Include Python 3.9 in PyPI keywords. * More realistic branch coverage counting (ignore Python version-specific branches). diff --git a/README.md b/README.md index 340cb493..27a9822d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This is an easy-to-use implementation of ECC (Elliptic Curve Cryptography) with support for ECDSA (Elliptic Curve Digital Signature Algorithm) and ECDH (Elliptic Curve Diffie-Hellman), implemented purely in Python, released under -the MIT license. With this library, you can quickly create keypairs (signing +the MIT license. With this library, you can quickly create key pairs (signing key and verifying key), sign messages, and verify the signatures. You can also agree on a shared secret key based on exchanged public keys. The keys and signatures are very short, making them easy to handle and @@ -75,7 +75,7 @@ pip install ecdsa[gmpy] ## Speed -The following table shows how long this library takes to generate keypairs +The following table shows how long this library takes to generate key pairs (`keygen`), to sign data (`sign`), to verify those signatures (`verify`), to derive a shared secret (`ecdh`), and to verify the signatures with no key-specific precomputation (`no PC verify`). @@ -257,14 +257,14 @@ interoperability testing and as a teaching tool. **This library does not protect against side-channel attacks.** -Do not allow attackers to measure how long it takes you to generate a keypair +Do not allow attackers to measure how long it takes you to generate a key pair or sign a message. Do not allow attackers to run code on the same physical -machine when keypair generation or signing is taking place (this includes +machine when key pair generation or signing is taking place (this includes virtual machines). Do not allow attackers to measure how much power your -computer uses while generating the keypair or signing a message. Do not allow +computer uses while generating the key pair or signing a message. Do not allow attackers to measure RF interference coming from your computer while generating -a keypair or signing a message. Note: just loading the private key will cause -keypair generation. Other operations or attack vectors may also be +a key pair or signing a message. Note: just loading the private key will cause +key pair generation. Other operations or attack vectors may also be vulnerable to attacks. **For a sophisticated attacker observing just one operation with a private key will be sufficient to completely reconstruct the private key**. @@ -529,7 +529,7 @@ failures of the entropy source. ## Examples -Create a NIST192p keypair and immediately save both to disk: +Create a NIST192p key pair and immediately save both to disk: ```python from ecdsa import SigningKey @@ -572,7 +572,7 @@ except BadSignatureError: print "BAD SIGNATURE" ``` -Create a NIST521p keypair: +Create a NIST521p key pair: ```python from ecdsa import SigningKey, NIST521p diff --git a/src/ecdsa/_version.py b/src/ecdsa/_version.py index a72288a9..2a12077f 100644 --- a/src/ecdsa/_version.py +++ b/src/ecdsa/_version.py @@ -296,7 +296,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # TAG-NUM-gHEX mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe) if not mo: - # unparseable. Maybe git-describe is misbehaving? + # unparsable. Maybe git-describe is misbehaving? pieces["error"] = ( "unable to parse git-describe output: '%s'" % describe_out ) diff --git a/src/ecdsa/keys.py b/src/ecdsa/keys.py index 7b2a43b1..4a673f6e 100644 --- a/src/ecdsa/keys.py +++ b/src/ecdsa/keys.py @@ -57,13 +57,12 @@ portable and cross-platform way. bytes-like object - All the types that implement the buffer protocol. That includes - ``str`` (only on python2), ``bytes``, ``bytesarray``, ``array.array` - and ``memoryview`` of those objects. - Please note that ``array.array` serialisation (converting it to byte - string) is endianess dependant! Signature computed over ``array.array`` - of integers on a big-endian system will not be verified on a - little-endian system and vice-versa. + All the types that implement the buffer protocol. That includes ``str`` + (only on python2), ``bytes``, ``bytesarray``, ``array.array` and + ``memoryview`` of those objects. Please note that ``array.array` + serialisation (converting it to byte string) is endianness dependent! + Signature computed over ``array.array`` of integers on a big-endian + system will not be verified on a little-endian system and vice-versa. set-like object All the types that support the ``in`` operator, like ``list``, @@ -455,7 +454,7 @@ def from_der( curve = Ed448 point_str, empty = der.remove_bitstring(point_str_bitstring, 0) if empty: - raise der.UnexpectedDER("trailing junk afer public key") + raise der.UnexpectedDER("trailing junk after public key") return cls.from_string(point_str, curve, None) if not oid_pk == oid_ecPublicKey: raise der.UnexpectedDER( @@ -701,7 +700,7 @@ def verify( as the `sigdecode` parameter. :param signature: encoding of the signature - :type signature: sigdecode method dependant + :type signature: sigdecode method dependent :param data: data signed by the `signature`, will be hashed using `hashfunc`, if specified, or default hash function :type data: bytes like object @@ -756,7 +755,7 @@ def verify_digest( as the `sigdecode` parameter. :param signature: encoding of the signature - :type signature: sigdecode method dependant + :type signature: sigdecode method dependent :param digest: raw hash value that the signature authenticates. :type digest: bytes like object :param sigdecode: Callable to define the way the signature needs to @@ -1397,7 +1396,7 @@ def sign_deterministic( :type extra_entropy: bytes like object :return: encoded signature over `data` - :rtype: bytes or sigencode function dependant type + :rtype: bytes or sigencode function dependent type """ hashfunc = hashfunc or self.default_hashfunc data = normalise_bytes(data) @@ -1458,7 +1457,7 @@ def sign_digest_deterministic( SHA-384 output using NIST256p or in similar situations. :return: encoded signature for the `digest` hash - :rtype: bytes or sigencode function dependant type + :rtype: bytes or sigencode function dependent type """ if isinstance(self.curve.curve, CurveEdTw): raise ValueError("Method unsupported for Edwards curves") @@ -1559,7 +1558,7 @@ def sign( :func:`~SigningKey.sign_deterministic` in such case. :return: encoded signature of the hash of `data` - :rtype: bytes or sigencode function dependant type + :rtype: bytes or sigencode function dependent type """ hashfunc = hashfunc or self.default_hashfunc data = normalise_bytes(data) @@ -1613,7 +1612,7 @@ def sign_digest( :func:`~SigningKey.sign_digest_deterministic` in such case. :return: encoded signature for the `digest` hash - :rtype: bytes or sigencode function dependant type + :rtype: bytes or sigencode function dependent type """ if isinstance(self.curve.curve, CurveEdTw): raise ValueError("Method unsupported for Edwards curves") diff --git a/src/ecdsa/test_keys.py b/src/ecdsa/test_keys.py index 7293b972..564f3129 100644 --- a/src/ecdsa/test_keys.py +++ b/src/ecdsa/test_keys.py @@ -311,7 +311,7 @@ def test_parse_malfomed_eddsa_der_pubkey(self): with self.assertRaises(UnexpectedDER) as e: VerifyingKey.from_der(der_str) - self.assertIn("trailing junk afer public key", str(e.exception)) + self.assertIn("trailing junk after public key", str(e.exception)) def test_edwards_from_public_key_recovery(self): with self.assertRaises(ValueError) as e: diff --git a/versioneer.py b/versioneer.py index f405b60e..fcdd1a36 100644 --- a/versioneer.py +++ b/versioneer.py @@ -701,7 +701,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # TAG-NUM-gHEX mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: - # unparseable. Maybe git-describe is misbehaving? + # unparsable. Maybe git-describe is misbehaving? pieces["error"] = ("unable to parse git-describe output: '%%s'" %% describe_out) return pieces @@ -1110,7 +1110,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # TAG-NUM-gHEX mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe) if not mo: - # unparseable. Maybe git-describe is misbehaving? + # unparsable. Maybe git-describe is misbehaving? pieces["error"] = ( "unable to parse git-describe output: '%s'" % describe_out )