diff --git a/README.md b/README.md index 6d3216c..3994922 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ False ``` ### Serialize Bloomfilter +You can easily serialize `BloomFilter` instance to a byte array ```Python >>> dumps = bloom_filter.dumps() >>> with open("dumps.out", "wb") as f: @@ -48,7 +49,18 @@ False >>> ``` +or to a hex string +```Python +>>> hex_str = bloom_filter.dumps_to_hex() +``` + +or to a base64 encoded bytes +```Python +base64_bytes = bloom_filter.dumps_to_base64() +``` + ### Deserialize Bloomfilter +And you can easily initialize a `BloomFilter` instance from a byte array ```Python >>> with open("dumps.out", "rb") as f: ... bf = BloomFilter.loads(f.read()) @@ -59,3 +71,25 @@ True False >>> ``` + +or from a hex string +```Python +>>> bf = BloomFilter.loads_from_hex(hex_str) +>>> 1 in bf +True +>>> 100 in bf +False +``` + +or from a base64 encoded bytes +```Python +>>> bf = BloomFilter.loads_from_base64(base64_bytes) +>>> 100 in bf +False +>>> 200 in bf +False +>>> 1 in bf +True +>>> 99 in bf +True +``` diff --git a/setup.py b/setup.py index e772c50..aa7e51e 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,8 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", ],