https://github.com/codechain-io/rust-iblt
Invertible bloom lookup table implementation in Rust
https://github.com/codechain-io/rust-iblt
iblt rust
Last synced: 7 months ago
JSON representation
Invertible bloom lookup table implementation in Rust
- Host: GitHub
- URL: https://github.com/codechain-io/rust-iblt
- Owner: CodeChain-io
- License: mit
- Created: 2018-05-05T20:37:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T02:09:50.000Z (over 5 years ago)
- Last Synced: 2024-10-31T11:52:17.999Z (8 months ago)
- Topics: iblt, rust
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 16
- Watchers: 9
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# IBLT
Invertible bloom lookup table implementation in rust.
`IBLT` uses bincode for serialization/deserialization of key and values, so both key and value type must implement `Serialize` and `Deserialize`. If two serialized values have different length, zero padding is added at the end of shorter value for xor operation.
Hash function can be specified by creating `IBLT` with `with_hasher` function. Hash value for `hash_sum` is calculated as `hash(val)`, and index is calculated as `hash(hash(val)), hash(hash(hash(val))), ...`. If hasher is not specified, `DefaultHasher` from `std::collections::hash_map` is used.
## Example
```rust
/// encoding
let mut iblt = IBLT::new(10, 3);
target.insert("378b8bc3".to_string(), "4725a63a".to_string());
target.insert("3f84ef5a".to_string(), "fbfc32d3".to_string());
target.insert("8afb596f".to_string(), "40abfd05".to_string());
target.insert("ec276396".to_string(), "a866db2e".to_string());
target.insert("e785c851".to_string(), "0603063c".to_string());/// decoding
match iblt.decode() {
Ok((left, right)) => { ... },
Err(e) => { ... },
}
```## TODO
* Subtraction and set reconciliation
* Unsafe serialize/deserialize with std