File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed
library/hmac/hmac/src/commonMain/kotlin/org/kotlincrypto/macs
tools/testing/src/commonMain/kotlin/org/kotlincrypto/macs Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 2
2
binaryCompat = " 0.13.0"
3
3
bouncyCastle = " 1.72"
4
4
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 "
7
7
encoding = " 1.2.1"
8
8
gradleVersions = " 0.46.0"
9
9
kotlin = " 1.8.10"
Original file line number Diff line number Diff line change @@ -99,13 +99,7 @@ public abstract class Hmac: Mac {
99
99
override fun doFinal (): ByteArray {
100
100
val iFinal = digest.digest()
101
101
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)
109
103
}
110
104
111
105
override fun reset () {
Original file line number Diff line number Diff line change @@ -62,12 +62,14 @@ abstract class MacUnitTest {
62
62
63
63
open fun givenMac_whenUpdatedSmall_thenDoFinalReturnsExpected () {
64
64
val mac = mac(KEY_SMALL )
65
+ mac.doFinal()
65
66
val actual = mac.doFinal(TestData .BYTES_SMALL ).encodeToString(TestData .base16)
66
67
assertEquals(expectedUpdateSmallHash, actual)
67
68
}
68
69
69
70
open fun givenMac_whenUpdatedMedium_thenDoFinalReturnsExpected () {
70
71
val mac = mac(KEY_MEDIUM )
72
+ mac.doFinal()
71
73
mac.update(TestData .BYTES_MEDIUM [3 ])
72
74
mac.update(TestData .BYTES_MEDIUM )
73
75
mac.update(TestData .BYTES_MEDIUM , 5 , 500 )
You can’t perform that action at this time.
0 commit comments