From fc84c40e8b295e08685f256291a915c931eb6e19 Mon Sep 17 00:00:00 2001 From: Cihat Imamoglu Date: Sun, 10 Dec 2017 14:44:04 +0000 Subject: [PATCH] Update ec-math.py * Add a missing word "number" * Convert `& 1` into `% 2 == 0` for clarity --- code/ec-math.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ec-math.py b/code/ec-math.py index 0ba9ed70..4afc7c1c 100644 --- a/code/ec-math.py +++ b/code/ec-math.py @@ -21,13 +21,13 @@ generator = generator_secp256k1 def random_secret(): convert_to_int = lambda array: int("".join(array).encode("hex"), 16) - # Collect 256 bits of random data from the OS's cryptographically secure random generator + # Collect 256 bits of random data from the OS's cryptographically secure random number generator byte_array = os.urandom(32) return convert_to_int(byte_array) def get_point_pubkey(point): - if point.y() & 1: + if (point.y() % 2) == 1: key = '03' + '%064x' % point.x() else: key = '02' + '%064x' % point.x()