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.
master
Andreas Fackler 7 years ago committed by Vladimir Komendantskiy
parent b7d12585f8
commit 1f3768f2b6
  1. 2
      mod.rs

@ -105,7 +105,7 @@ impl Signature {
let uncomp = self.0.into_affine().into_uncompressed(); let uncomp = self.0.into_affine().into_uncompressed();
let bytes = uncomp.as_ref(); let bytes = uncomp.as_ref();
let xor_bytes: u8 = bytes.iter().fold(0, |result, byte| result ^ byte); 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); debug!("Signature: {:?}, output: {}", HexBytes(bytes), parity);
parity parity
} }

Loading…
Cancel
Save