|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xlattice.crypto.filters.KeySelector
public class KeySelector
Given a key, populates arrays determining word and bit offsets into a Bloom filter.
| Nested Class Summary | |
|---|---|
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
|
| Field Summary | |
|---|---|
static int[] |
MASK
AND with byte to zero out index-many bits |
static int |
TWO_UP_15
|
static int[] |
UNMASK
AND with byte to expose index-many bits |
| Constructor Summary | |
|---|---|
KeySelector(int m,
int k,
int[] bitOffset,
int[] wordOffset)
Creates a key selector for a Bloom filter. |
|
| Method Summary | |
|---|---|
(package private) String |
btoh(byte b)
|
void |
getOffsets(byte[] key)
Given a key, populate the word and bit offset arrays, each of which has k elements. |
void |
getOffsets(byte[] key,
int off,
int len)
|
(package private) String |
itoh(int i)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int[] UNMASK
public static final int[] MASK
public static final int TWO_UP_15
| Constructor Detail |
|---|
public KeySelector(int m,
int k,
int[] bitOffset,
int[] wordOffset)
m - size of the filter as a power of 2k - number of 'hash functions'bitOffset - array of k bit offsets (offset of flag bit in word)wordOffset - array of k word offsets (offset of word flag is in)
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.| Method Detail |
|---|
public void getOffsets(byte[] key)
key - cryptographic key used in populating the arrays
public void getOffsets(byte[] key,
int off,
int len)
String itoh(int i)
String btoh(byte b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||