File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
shared/src/main/scala/ky/korins/blake3 Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 33All notable changes to this project will be documented in this file.
44
55## [ unreleased]
6+ - Introduced ` newDeriveKeyHasher(Hasher => Unit) ` .
67- Introduced ` update(Short) ` , ` update(Int) ` and ` update(Long) ` .
78
89## [ 2.2.0] - 2021-01-05
Original file line number Diff line number Diff line change @@ -33,15 +33,21 @@ object Blake3 {
3333 }
3434
3535 /**
36- * A new hasher with derive key that might be any array of bytes
36+ * A new hasher with derive key that should be initalized via callback
3737 */
38- def newDeriveKeyHasher (context : Array [ Byte ] ): Hasher = {
39- val contextKey = new HasherImpl (IV , DERIVE_KEY_CONTEXT )
40- .update(context )
41- .done(KEY_LEN )
38+ def newDeriveKeyHasher (cb : Hasher => Unit ): Hasher = {
39+ val contextKeyHasher = new HasherImpl (IV , DERIVE_KEY_CONTEXT )
40+ cb(contextKeyHasher )
41+ val contextKey = contextKeyHasher .done(KEY_LEN )
4242 new HasherImpl (wordsFromLittleEndianBytes(contextKey), DERIVE_KEY_MATERIAL )
4343 }
4444
45+ /**
46+ * A new hasher with derive key that might be any array of bytes
47+ */
48+ def newDeriveKeyHasher (context : Array [Byte ]): Hasher =
49+ newDeriveKeyHasher(_.update(context))
50+
4551 /**
4652 * A new hasher with derive key that might be any string
4753 */
You can’t perform that action at this time.
0 commit comments