Class AbstractCompositeHashFunction

    • Constructor Detail

      • AbstractCompositeHashFunction

        AbstractCompositeHashFunction​(HashFunction... functions)
    • Method Detail

      • makeHash

        abstract HashCode makeHash​(Hasher[] hashers)
        Constructs a HashCode from the Hasher objects of the functions. Each of them has consumed the entire input and they are ready to output a HashCode. The order of the hashers are the same order as the functions given to the constructor.
      • newHasher

        public Hasher newHasher()
        Description copied from interface: HashFunction
        Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data. Example:
        
         HashFunction hf = Hashing.md5();
         HashCode hc = hf.newHasher()
             .putLong(id)
             .putBoolean(isActive)
             .hash();
         
      • newHasher

        public Hasher newHasher​(int expectedInputSize)
        Description copied from interface: HashFunction
        Begins a new hash code computation as HashFunction.newHasher(), but provides a hint of the expected size of the input (in bytes). This is only important for non-streaming hash functions (hash functions that need to buffer their whole input before processing any of it).
        Specified by:
        newHasher in interface HashFunction
        Overrides:
        newHasher in class AbstractHashFunction
      • fromHashers

        private Hasher fromHashers​(Hasher[] hashers)