public class HashingCodePathFactory extends java.lang.Object implements CodePathFactory
CodePath factory. It allows for predictable packet
sizes, as codepath length is no affected by the evaluation tree depth at
which the field was built. It is arguably more secure than the default option
(if a cryptographic hashing function is used) as receivers cannot deduce the
code that generated some values. The provided factory is configurable by
using an HashFunction from Guava. Being hash based, it has a non-zero
probability of collision. Using decent hash functions (e.g. SHA) should
however make the event very unlikely. In any case, there is a trade-off
between collision probability and packet size.
Implementations of AbstractExecutionContext can use it by passing the
factory instance in the super constructor call, e.g.:
super(execenv, netmgr, new HashingCodePathFactory(Hashing.sha256()));
| Modifier and Type | Class and Description |
|---|---|
static interface |
HashingCodePathFactory.HasherSupplier
Serializable supplier, because Java 8 lambdas are not.
|
static class |
HashingCodePathFactory.HashingCodePath
Hash-based
CodePath. |
| Constructor and Description |
|---|
HashingCodePathFactory(com.google.common.hash.HashFunction hashFunction) |
HashingCodePathFactory(HashingCodePathFactory.HasherSupplier hashFunction) |
| Modifier and Type | Method and Description |
|---|---|
CodePath |
createCodePath(gnu.trove.list.TIntList callStackIdentifiers,
gnu.trove.stack.TIntStack callStackSizes)
Creates a
CodePath for the current stack status. |
public HashingCodePathFactory(HashingCodePathFactory.HasherSupplier hashFunction)
hashFunction - the hashing algorithm to usepublic HashingCodePathFactory(com.google.common.hash.HashFunction hashFunction)
hashFunction - the hashing algorithm to usepublic final CodePath createCodePath(gnu.trove.list.TIntList callStackIdentifiers, gnu.trove.stack.TIntStack callStackSizes)
CodePathFactoryCodePath for the current stack status.createCodePath in interface CodePathFactorycallStackIdentifiers - the stack frames identifierscallStackSizes - the stack frame sizes, by frameCodePath