Skip to content

Commit

Permalink
formatting fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 16, 2024
1 parent 7426df8 commit de9141c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
13 changes: 4 additions & 9 deletions src/ecdsa/test_jacobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,15 +666,9 @@ def test_mul_add_with_doubled_negation_of_itself(self):
self.assertEqual(j_g.mul_add(4, dbl_neg, 2), INFINITY)

@given(
st.integers(
min_value=0, max_value=int(generator_112r2.order() - 1)
),
st.integers(
min_value=0, max_value=int(generator_112r2.order() - 1)
),
st.integers(
min_value=0, max_value=int(generator_112r2.order() - 1)
)
st.integers(min_value=0, max_value=int(generator_112r2.order() - 1)),
st.integers(min_value=0, max_value=int(generator_112r2.order() - 1)),
st.integers(min_value=0, max_value=int(generator_112r2.order() - 1)),
)
@example(693, 2, 3293) # values that will hit all the conditions for NAF
def test_mul_add_random(self, mul1, mul2, mul3):
Expand Down Expand Up @@ -893,6 +887,7 @@ def interrupter(barrier_start, barrier_end, lock_exit):

class TestZeroCurve(unittest.TestCase):
"""Tests with curve that has (0, 0) on the curve."""

def setUp(self):
self.curve = CurveFp(23, 1, 0)

Expand Down
16 changes: 8 additions & 8 deletions src/ecdsa/test_pyecdsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,18 +856,18 @@ def test_hybrid_decoding_with_blocked_format(self):

self.assertIn("Invalid X9.62 encoding", str(exp.exception))

def test_hybrid_decoding_with_inconsistent_encoding_and_no_validation(self):
def test_hybrid_decoding_with_inconsistent_encoding_and_no_validation(
self,
):
sk = SigningKey.from_secret_exponent(123456789)
vk = sk.verifying_key

enc = vk.to_string("hybrid")
self.assertEqual(enc[:1], b'\x06')
enc = b'\x07' + enc[1:]
self.assertEqual(enc[:1], b"\x06")
enc = b"\x07" + enc[1:]

b = VerifyingKey.from_string(
enc,
valid_encodings=("hybrid",),
validate_point=False
enc, valid_encodings=("hybrid",), validate_point=False
)

self.assertEqual(vk, b)
Expand Down Expand Up @@ -919,8 +919,8 @@ def test_decoding_with_inconsistent_hybrid_odd_point(self):
vk = sk.verifying_key

enc = vk.to_string("hybrid")
self.assertEqual(enc[:1], b'\x07')
enc = b'\x06' + enc[1:]
self.assertEqual(enc[:1], b"\x07")
enc = b"\x06" + enc[1:]

with self.assertRaises(MalformedPointError):
b = VerifyingKey.from_string(enc, valid_encodings=("hybrid",))

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable b is not used.
Expand Down

0 comments on commit de9141c

Please sign in to comment.