trait HashBuilder extends AnyRef
The methods of HashBuilder change its internal state and return this for convenience.
Requirements for all implementations:
For any HashBuilder hb,
it is computationally infeasible to find two sequences as1 and as2 of calls to add
such that the concatenation of as1 differs from the concatenation as2,
yet their computed hashes are the same, i.e.,
as1.foldLeft(hb)((hb, a) => hb.add(a)).finish is the same as as2.foldLeft(hb)((hb, a) => hb.add(a)).finish.
- Alphabetic
- By Inheritance
- HashBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def addWithoutLengthPrefix(a: ByteString): HashBuilder.this.type
Appends a com.google.protobuf.ByteString
ato the sequence of bytes to be hashed.Appends a com.google.protobuf.ByteString
ato the sequence of bytes to be hashed. Useaddfor com.google.protobuf.ByteStrings of variable length to prevent hash collisions due to concatenation of variable-length strings.Document at the call site in production code why it is not necessary to include a length prefix.
- returns
the updated hash builder
- Exceptions thrown
java.lang.IllegalStateExceptionif the finish method has already been called on this HashBuilder
- abstract def finish(): Hash
Terminates the building of the hash.
Terminates the building of the hash. No more additions can be made using
HashBuilder.addWithoutLengthPrefixafter this method has been called.- returns
The hash of the array accumulated so far.
- Exceptions thrown
java.lang.IllegalStateExceptionif finish had been called before on this HashBuilder
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def add(a: Long): HashBuilder.this.type
Shorthand for
addWithoutLengthPrefix(DeterministicEncoding.encodeLong(a)) - def add(a: Int): HashBuilder.this.type
Shorthand for
addWithoutLengthPrefix(DeterministicEncoding.encodeInt(a)) - def add(a: String): HashBuilder.this.type
Shorthand for
add(ByteString.copyFromUtf8(a)) - def add(a: ByteString): HashBuilder.this.type
Appends the length of
a(encoded as fixed length com.google.protobuf.ByteString) as well asato this builder.Appends the length of
a(encoded as fixed length com.google.protobuf.ByteString) as well asato this builder.- returns
the updated hash builder
- Exceptions thrown
java.lang.IllegalStateExceptionif the finish method has already been called on this HashBuilder
- def addWithoutLengthPrefix(a: String): HashBuilder.this.type
Shorthand for
addWithoutLengthPrefix(ByteString.copyFromUtf8(a))Useaddfor strings of variable length to prevent hash collisions due to concatenation of variable-length strings.Shorthand for
addWithoutLengthPrefix(ByteString.copyFromUtf8(a))Useaddfor strings of variable length to prevent hash collisions due to concatenation of variable-length strings.Document at the call site in production code why it is not necessary to include a length prefix.
- def addWithoutLengthPrefix(a: Array[Byte]): HashBuilder.this.type
Shorthand for
addWithoutLengthPrefix(ByteString.copyFrom(a)) - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])