Skip to content

Commit 2c1a3e7

Browse files
authored
Update core and hash to 0.2.3 (#23)
1 parent 19dc965 commit 2c1a3e7

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
binaryCompat = "0.13.0"
33
bouncyCastle = "1.72"
44
configuration = "0.1.0-beta02"
5-
cryptoCore = "0.2.2"
6-
cryptoHash = "0.2.2"
5+
cryptoCore = "0.2.3"
6+
cryptoHash = "0.2.3"
77
encoding = "1.2.1"
88
gradleVersions = "0.46.0"
99
kotlin = "1.8.10"

library/hmac/hmac/src/commonMain/kotlin/org/kotlincrypto/macs/Hmac.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,7 @@ public abstract class Hmac: Mac {
9999
override fun doFinal(): ByteArray {
100100
val iFinal = digest.digest()
101101
digest.update(oKey)
102-
103-
val oFinal = digest.digest(iFinal)
104-
105-
// Prepare digest for reuse
106-
digest.update(iKey)
107-
108-
return oFinal
102+
return digest.digest(iFinal)
109103
}
110104

111105
override fun reset() {

tools/testing/src/commonMain/kotlin/org/kotlincrypto/macs/MacUnitTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ abstract class MacUnitTest {
6262

6363
open fun givenMac_whenUpdatedSmall_thenDoFinalReturnsExpected() {
6464
val mac = mac(KEY_SMALL)
65+
mac.doFinal()
6566
val actual = mac.doFinal(TestData.BYTES_SMALL).encodeToString(TestData.base16)
6667
assertEquals(expectedUpdateSmallHash, actual)
6768
}
6869

6970
open fun givenMac_whenUpdatedMedium_thenDoFinalReturnsExpected() {
7071
val mac = mac(KEY_MEDIUM)
72+
mac.doFinal()
7173
mac.update(TestData.BYTES_MEDIUM[3])
7274
mac.update(TestData.BYTES_MEDIUM)
7375
mac.update(TestData.BYTES_MEDIUM, 5, 500)

0 commit comments

Comments
 (0)