Skip to content

Commit

Permalink
Fix typos (#266)
Browse files Browse the repository at this point in the history
* Fix typos

* Fix pylint e501
  • Loading branch information
kianmeng authored Nov 6, 2021
1 parent 357fb84 commit b3b27cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`).
Expand Down Expand Up @@ -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**.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -572,7 +572,7 @@ except BadSignatureError:
print "BAD SIGNATURE"
```

Create a NIST521p keypair:
Create a NIST521p key pair:

```python
from ecdsa import SigningKey, NIST521p
Expand Down
2 changes: 1 addition & 1 deletion src/ecdsa/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
27 changes: 13 additions & 14 deletions src/ecdsa/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/ecdsa/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit b3b27cd

Please sign in to comment.