* Copyright (C) 2011 The Guava Authors
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
that can compute a hash code after reading the input. Each hasher should translate all multibyte values (
, etc) to bytes in little-endian order.
The result of calling any methods after calling
Warning: Chunks of data that are put into the
are not delimited.
is dependent only on the bytes inserted, and the order in which
they were inserted, not how those bytes were chunked into discrete put() operations. For example,
the following three expressions all generate colliding hash codes:
If you wish to avoid this, you should either prepend or append the size of each chunk. For example:
newHasher().putString("ab").putString("c").hash() newHasher().putString("a").putString("bc").hash() newHasher().putChar('a').putChar('b').putChar('c').hash()