From 3476b02ffa2c432762d379f8085d4bc74108ded9 Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 10 Jan 2019 11:52:21 +0000 Subject: [PATCH] Fix #320 * Avoids unnecessary hashing of `message` * Makes the ordering of arguments (`message` followed by `domain`) consistent with usage order --- specs/bls_signature.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/bls_signature.md b/specs/bls_signature.md index d04c7f39a..8e0b76c6b 100644 --- a/specs/bls_signature.md +++ b/specs/bls_signature.md @@ -71,8 +71,8 @@ q = 4002409555221667393417789825735904156556882819939007885332058136124031650490 def hash_to_G2(message: bytes32, domain: uint64) -> [uint384]: # Initial candidate x coordinate - x_re = int.from_bytes(hash(bytes8(domain) + b'\x01' + message), 'big') - x_im = int.from_bytes(hash(bytes8(domain) + b'\x02' + message), 'big') + x_re = int.from_bytes(hash(message + bytes8(domain) + b'\x01'), 'big') + x_im = int.from_bytes(hash(message + bytes8(domain) + b'\x02'), 'big') x_coordinate = Fq2([x_re, x_im]) # x = x_re + i * x_im # Test candidate y coordinates until a one is found