Skip to content

Commit b4526da

Browse files
committed
scala-js: ScalaDoc for BouncyCastleHash
1 parent a44a480 commit b4526da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
package scorex.crypto.hash
22

3+
/** Default implementation of hash generation using bouncycastle-style pair of methods
4+
* update/doFinal.
5+
* The only thing you need to do is to provide digestFn, which creates the correct digest
6+
* for your hash function.
7+
*/
38
trait BouncyCastleHash[D <: Digest] extends CryptographicHash[D] {
49

10+
/** Compute the hash by creating a digest, updating it with the messages and then
11+
* finalizing. */
512
protected def internalHash(inputs: Message*): Array[Byte] = synchronized {
613
val digest = digestFn
714
inputs.foreach(i => updateDigest(digest, i, 0, i.length))
815
doFinalDigest(digest)
916
}
1017

18+
/** Compute the hash by creating a digest, updating it with the prefix and the messages
19+
* and then finalizing. */
1120
protected def internalPrefixedHash(prefix: Byte, inputs: Message*): Array[Byte] = synchronized {
1221
val digest = digestFn
1322
updateDigest(digest, prefix)
1423
inputs.foreach(i => updateDigest(digest, i, 0, i.length))
1524
doFinalDigest(digest)
1625
}
1726

27+
/** Should be overriden to provide appropriate Digest instance. */
1828
protected def digestFn: ExtendedDigest
1929
}

0 commit comments

Comments
 (0)