From 1f3768f2b6881a377223c59806c9f23f24797532 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Mon, 2 Jul 2018 12:09:06 +0200 Subject: [PATCH] Add coin docs, change parity computation. This makes the signature parity computation take into account all bits, not just the last one of each byte. --- mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod.rs b/mod.rs index c3e56f3..d25a40d 100644 --- a/mod.rs +++ b/mod.rs @@ -105,7 +105,7 @@ impl Signature { let uncomp = self.0.into_affine().into_uncompressed(); let bytes = uncomp.as_ref(); let xor_bytes: u8 = bytes.iter().fold(0, |result, byte| result ^ byte); - let parity = 0 != xor_bytes % 2; + let parity = 0 != xor_bytes.count_ones() % 2; debug!("Signature: {:?}, output: {}", HexBytes(bytes), parity); parity }