public class KeySelector
extends java.lang.Object
修飾子とタイプ | クラス | 説明 |
---|---|---|
static interface |
KeySelector.BitSelector |
|
class |
KeySelector.GenericBitSelector |
Extracts the k bit offsets from a key, suitable for general values
of m and k.
|
class |
KeySelector.GenericWordSelector |
Extracts the k word offsets from a key.
|
static interface |
KeySelector.WordSelector |
コンストラクタ | 説明 |
---|---|
KeySelector(int m,
int k) |
Creates a key selector for a Bloom filter.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
getOffsets(byte[] key,
int[] bitOffset,
int[] wordOffset) |
Given a key, populate the word and bit offset arrays, each
of which has k elements.
|
void |
getOffsets(byte[] key,
int off,
int len,
int[] bitOffset,
int[] wordOffset) |
Given a key, populate the word and bit offset arrays, each
of which has k elements.
|
public KeySelector(int m, int k)
m
- size of the filter as a power of 2k
- number of 'hash functions'
Note that if k and m are too big, the GenericWordSelector blows up -
The max for 32-byte keys is m=23 and k=11.
The precise restriction appears to be:
((5k + (k-1)(m-5)) / 8) + 2 < keySizeInBytes
It isn't clear how to fix this.public void getOffsets(byte[] key, int[] bitOffset, int[] wordOffset)
key
- cryptographic key used in populating the arraysbitOffset
- Out parameter of length kwordOffset
- Out parameter of length kpublic void getOffsets(byte[] key, int off, int len, int[] bitOffset, int[] wordOffset)
key
- cryptographic key used in populating the arraysbitOffset
- Out parameter of length kwordOffset
- Out parameter of length k