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.
This commit is contained in:
Andreas Fackler 2018-07-02 12:09:06 +02:00 committed by Vladimir Komendantskiy
parent b7d12585f8
commit 1f3768f2b6
1 changed files with 1 additions and 1 deletions

2
mod.rs
View File

@ -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
}