Class HashingCodePathFactory

  • All Implemented Interfaces:
    java.io.Serializable, CodePathFactory

    public class HashingCodePathFactory
    extends java.lang.Object
    implements CodePathFactory
    A hash-based 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()));
     
    See Also:
    Serialized Form
    • Constructor Detail

      • HashingCodePathFactory

        public HashingCodePathFactory​(com.google.common.hash.HashFunction hashFunction)
        Parameters:
        hashFunction - the hashing algorithm to use
    • Method Detail

      • createCodePath

        public final CodePath createCodePath​(gnu.trove.list.TIntList callStackIdentifiers,
                                             gnu.trove.stack.TIntStack callStackSizes)
        Description copied from interface: CodePathFactory
        Creates a CodePath for the current stack status.
        Specified by:
        createCodePath in interface CodePathFactory
        Parameters:
        callStackIdentifiers - the stack frames identifiers
        callStackSizes - the stack frame sizes, by frame
        Returns:
        a new CodePath