cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.Types.Address.Gen

Synopsis

Generators and shrinkers

Indicator functions on addresses

addressParity :: Address -> Parity Source #

Computes the parity of an address.

Parity is defined in the following way:

  • even-parity address: an address with a pop count (Hamming weight) that is even.
  • odd-parity address: an address with a pop count (Hamming weight) that is odd.

Examples of even-parity and odd-parity addresses:

  • 0b00000000 : even (Hamming weight = 0)
  • 0b00000001 : odd (Hamming weight = 1)
  • 0b00000010 : odd (Hamming weight = 1)
  • 0b00000011 : even (Hamming weight = 2)
  • 0b00000100 : odd (Hamming weight = 1)
  • ...
  • 0b11111110 : odd (Hamming weight = 7)
  • 0b11111111 : even (Hamming weight = 8)