Skip to content

Commit

Permalink
Remove f-strings for py3.5 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKueltz committed Apr 14, 2020
1 parent e592f10 commit 1e7b5f8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [2.1.2]
### Fixed
- Point at infinity handling in C extensions
- DER signature decoding that assumed length was always encoded in one byte

## [2.1.1]
### Fixed
- RFC6979 nonce generation for signatures on pre-hashed messages (issue #46)
Expand Down
6 changes: 3 additions & 3 deletions fastecdsa/encoding/asn1.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def parse_asn1_length(data: bytes) -> (int, bytes, bytes):
data = data[count:]

if length > len(data):
raise ASN1EncodingError(f"Parsed length of ASN.1 structure to be {length} bytes but only {len(data)} bytes"
f"remain in the provided data")
raise ASN1EncodingError("Parsed length of ASN.1 structure to be {} bytes but only {} bytes"
"remain in the provided data".format(length, len(data)))

return length, data[:length], data[length:]

Expand Down Expand Up @@ -128,6 +128,6 @@ def parse_asn1_int(data: bytes) -> (int, bytes, bytes):

# integer length should match length indicated
if length != len(data):
raise ASN1EncodingError(f"Expected ASN.1 INTEGER to be {length} bytes, got {len(data)} bytes")
raise ASN1EncodingError("Expected ASN.1 INTEGER to be {} bytes, got {} bytes".format(length, len(data)))

return length, data, remaining
3 changes: 2 additions & 1 deletion fastecdsa/encoding/der.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def _validate_int_bytes(data: bytes):

# sequence should be entirety remaining data
if leftover:
raise InvalidDerSignature(f"Expected a sequence of {seqlen} bytes, got {len(sequence + leftover)}")
raise InvalidDerSignature("Expected a sequence of {} bytes, got {}".format(
seqlen, len(sequence + leftover)))

try:
rlen, r, sdata = parse_asn1_int(sequence)
Expand Down
2 changes: 1 addition & 1 deletion fastecdsa/tests/test_whycheproof_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _get_tests(url):
test_json = loads(test_raw)
return test_json["testGroups"]
except (JSONDecodeError, URLError) as error:
SkipTest(f"Skipping tests, could not download / parse data from {url}\nError: {error}")
SkipTest("Skipping tests, could not download / parse data from {}\nError: {}".format(url, error))

def _test_runner(self, tests, curve, hashfunc):
for test_group in tests:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ def run(self):
name='fastecdsa',
packages=find_packages(),
url='https://github.com/AntonKueltz/fastecdsa',
version='2.1.1',
version='2.1.2',
)

0 comments on commit 1e7b5f8

Please sign in to comment.