Python implementation of the Ethereum Trie structure
Project description
# Python Implementation of the Ethereum Bloom Filter
`shell $ pip install ethereum-bloom `
## Usage
`python >>> from eth_bloom import BloomFilter >>> b = BloomFilter() >>> b = BloomFilter() >>> b'a value' in b False >>> b.add(b'a value') >>> b'a value' in b True >>> int(b) 3458628712844765018311492773359360516229024449585949240367644166080576879632652362184119765613545163153674691520749911733485693171622325900647078772681584616740134230153806267998022370194756399579977294154062696916779055028045657302214591620589415314367270329881298073237757853875497241510733954508399863880080986777555986663988492288946856978031023631618215522505971170427986911575695114157059398791122395379400594948096 >>> bin(b) '0b100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' `
You can also merge bloom filters
`python >>> from eth_bloom import BloomFilter >>> b1 = BloomFilter() >>> b2 = BloomFilter() >>> b1.add(b'a') >>> b1.add(b'common') >>> b2.add(b'b') >>> b2.add(b'common') >>> b'a' in b1 True >>> b'b' in b1 False >>> b'common' in b1 True >>> b'a' in b2 False >>> b'b' in b2 True >>> b'common' in b2 True >>> b3 = b1 + b2 # using addition >>> b'a' in b3 True >>> b'b' in b3 True >>> b'common' in b3 True >>> b4 = b1 | b2 # or using bitwise or >>> b'a' in b4 True >>> b'b' in b4 True >>> b'common' in b4 True >>> b1 |= b2 # or using in-place operations (works with += too) >>> b'a' in b1 True >>> b'b' in b1 True >>> b'common' in b1 True `
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ethereum-bloom-0.2.0.tar.gz
.
File metadata
- Download URL: ethereum-bloom-0.2.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea26a215553c5b09a82bf0f2c33df6edfaa8d47e3e3ed6bca29bd0c6b4782023 |
|
MD5 | bb1272799f19fc2ccb14c484f510b880 |
|
BLAKE2b-256 | d98681e2ba36007ff68ac8da837edf81d12ae9949bff7eb221dfb023afdde073 |
File details
Details for the file ethereum_bloom-0.2.0-py2-none-any.whl
.
File metadata
- Download URL: ethereum_bloom-0.2.0-py2-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8b385d50b0c0d7eddf0b280c619d4aa2aec2d86c49bf8fb9f19387c2db95258 |
|
MD5 | df400ad8d8331af8bfde764f01c5eeac |
|
BLAKE2b-256 | 3fedcf46c185d635811aa1c3e3edd5965a3422ad35c279fdc0cf9d4569881bbe |