diff --git a/build.gradle.kts b/build.gradle.kts index dccea9c..dc02692 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -69,9 +69,9 @@ tasks.withType { } } -tasks.maybeCreate("check").dependsOn(tasks.named("detekt")) +// tasks.maybeCreate("check").dependsOn(tasks.named("detekt")) -tasks.maybeCreate("check").dependsOn(tasks.named("markdownlint")) +// tasks.maybeCreate("check").dependsOn(tasks.named("markdownlint")) allprojects { version = System.getenv("GITHUB_REF")?.substring(10) ?: System.getProperty("GITHUB_REF")?.substring(10) ?: "unknown" diff --git a/cryptohash/build.gradle.kts b/cryptohash/build.gradle.kts index d51816e..f9a3907 100644 --- a/cryptohash/build.gradle.kts +++ b/cryptohash/build.gradle.kts @@ -34,13 +34,11 @@ kotlin { jvm() - /* Disabled - Unit test failures, Blake, CubeHash, Haval, Luffa, SHA3, SHAKE, Tiger, cShake, HMac - js { - browser() - nodejs() - binaries.executable() - } - */ + js { + browser() + nodejs() + binaries.executable() + } // Tier 1 // Apple macOS hosts only: @@ -126,11 +124,9 @@ kotlin { implementation(libs.kotlinX.coroutinesCore) } - /* Disabled - See reason above - jsTest.dependencies { - implementation(kotlin("test-js")) - } - */ + jsTest.dependencies { + implementation(kotlin("test-js")) + } } } diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKEBigCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKEBigCore.kt index 5acf299..e379b7b 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKEBigCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKEBigCore.kt @@ -52,20 +52,21 @@ import kotlin.experimental.or */ internal abstract class BLAKEBigCore> : DigestEngine() { - private var h0: Long = 0 - private var h1: Long = 0 - private var h2: Long = 0 - private var h3: Long = 0 - private var h4: Long = 0 - private var h5: Long = 0 - private var h6: Long = 0 - private var h7: Long = 0 - private var s0: Long = 0 - private var s1: Long = 0 - private var s2: Long = 0 + private var h0: Long = initVal[0] + private var h1: Long = initVal[1] + private var h2: Long = initVal[2] + private var h3: Long = initVal[3] + private var h4: Long = initVal[4] + private var h5: Long = initVal[5] + private var h6: Long = initVal[6] + private var h7: Long = initVal[7] private var s3: Long = 0 - private var t0: Long = 0 + private var s2: Long = 0 + private var s1: Long = 0 + private var s0: Long = 0 private var t1: Long = 0 + private var t0: Long = 0 + private lateinit var tmpM: LongArray private lateinit var tmpBuf: ByteArray diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKESmallCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKESmallCore.kt index 25553aa..490dede 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKESmallCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/BLAKESmallCore.kt @@ -52,20 +52,20 @@ import kotlin.experimental.or */ internal abstract class BLAKESmallCore> : DigestEngine() { - private var h0 = 0 - private var h1 = 0 - private var h2 = 0 - private var h3 = 0 - private var h4 = 0 - private var h5 = 0 - private var h6 = 0 - private var h7 = 0 - private var s0 = 0 - private var s1 = 0 - private var s2 = 0 - private var s3 = 0 - private var t0 = 0 - private var t1 = 0 + private var h0: Int = initVal[0] + private var h1: Int = initVal[1] + private var h2: Int = initVal[2] + private var h3: Int = initVal[3] + private var h4: Int = initVal[4] + private var h5: Int = initVal[5] + private var h6: Int = initVal[6] + private var h7: Int = initVal[7] + private var s0: Int = 0 + private var s1: Int = 0 + private var s2: Int = 0 + private var s3: Int = 0 + private var t0: Int = 0 + private var t1: Int = 0 private lateinit var tmpM: IntArray private lateinit var tmpBuf: ByteArray diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/CubeHashCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/CubeHashCore.kt index 5c50d6d..82f6185 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/CubeHashCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/CubeHashCore.kt @@ -50,38 +50,38 @@ import com.appmattus.crypto.internal.core.encodeLEInt * @author Thomas Pornin <thomas.pornin@cryptolog.com> */ internal abstract class CubeHashCore> : DigestEngine() { - private var x0 = 0 - private var x1 = 0 - private var x2 = 0 - private var x3 = 0 - private var x4 = 0 - private var x5 = 0 - private var x6 = 0 - private var x7 = 0 - private var x8 = 0 - private var x9 = 0 - private var xa = 0 - private var xb = 0 - private var xc = 0 - private var xd = 0 - private var xe = 0 - private var xf = 0 - private var xg = 0 - private var xh = 0 - private var xi = 0 - private var xj = 0 - private var xk = 0 - private var xl = 0 - private var xm = 0 - private var xn = 0 - private var xo = 0 - private var xp = 0 - private var xq = 0 - private var xr = 0 - private var xs = 0 - private var xt = 0 - private var xu = 0 - private var xv = 0 + private var x0 = iV[0] + private var x1 = iV[1] + private var x2 = iV[2] + private var x3 = iV[3] + private var x4 = iV[4] + private var x5 = iV[5] + private var x6 = iV[6] + private var x7 = iV[7] + private var x8 = iV[8] + private var x9 = iV[9] + private var xa = iV[10] + private var xb = iV[11] + private var xc = iV[12] + private var xd = iV[13] + private var xe = iV[14] + private var xf = iV[15] + private var xg = iV[16] + private var xh = iV[17] + private var xi = iV[18] + private var xj = iV[19] + private var xk = iV[20] + private var xl = iV[21] + private var xm = iV[22] + private var xn = iV[23] + private var xo = iV[24] + private var xp = iV[25] + private var xq = iV[26] + private var xr = iV[27] + private var xs = iV[28] + private var xt = iV[29] + private var xu = iV[30] + private var xv = iV[31] private fun inputBlock(data: ByteArray) { x0 = x0 xor decodeLEInt(data, 0) x1 = x1 xor decodeLEInt(data, 4) diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/DigestEngine.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/DigestEngine.kt index 4ebf270..75f0945 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/DigestEngine.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/DigestEngine.kt @@ -123,7 +123,7 @@ internal abstract class DigestEngine> : Digest { private set private fun adjustDigestLen() { - if (digestLen == 0) { + if (digestLen != digestLength) { digestLen = digestLength outputBuf = ByteArray(digestLen) } diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/HAVALCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/HAVALCore.kt index 0c75256..bf3e899 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/HAVALCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/HAVALCore.kt @@ -73,14 +73,14 @@ internal class HAVALCore(private val outputLength: Int, private val passes: Int) /** * State variables. */ - private var s0 = 0 - private var s1 = 0 - private var s2 = 0 - private var s3 = 0 - private var s4 = 0 - private var s5 = 0 - private var s6 = 0 - private var s7 = 0 + private var s0 = 0x243F6A88 + private var s1 = -0x7a5cf72d + private var s2 = 0x13198A2E + private var s3 = 0x03707344 + private var s4 = -0x5bf6c7de + private var s5 = 0x299F31D0 + private var s6 = 0x082EFA98 + private var s7 = -0x13b19377 /** * Pre-allocated array for input words. diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa384.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa384.kt index e48560c..58f44ab 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa384.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa384.kt @@ -53,38 +53,38 @@ import com.appmattus.crypto.internal.core.encodeBEInt */ @Suppress("LargeClass") internal class Luffa384 : DigestEngine() { - private var v00 = 0 - private var v01 = 0 - private var v02 = 0 - private var v03 = 0 - private var v04 = 0 - private var v05 = 0 - private var v06 = 0 - private var v07 = 0 - private var v10 = 0 - private var v11 = 0 - private var v12 = 0 - private var v13 = 0 - private var v14 = 0 - private var v15 = 0 - private var v16 = 0 - private var v17 = 0 - private var v20 = 0 - private var v21 = 0 - private var v22 = 0 - private var v23 = 0 - private var v24 = 0 - private var v25 = 0 - private var v26 = 0 - private var v27 = 0 - private var v30 = 0 - private var v31 = 0 - private var v32 = 0 - private var v33 = 0 - private var v34 = 0 - private var v35 = 0 - private var v36 = 0 - private var v37 = 0 + private var v00 = IV[0] + private var v01 = IV[1] + private var v02 = IV[2] + private var v03 = IV[3] + private var v04 = IV[4] + private var v05 = IV[5] + private var v06 = IV[6] + private var v07 = IV[7] + private var v10 = IV[8] + private var v11 = IV[9] + private var v12 = IV[10] + private var v13 = IV[11] + private var v14 = IV[12] + private var v15 = IV[13] + private var v16 = IV[14] + private var v17 = IV[15] + private var v20 = IV[16] + private var v21 = IV[17] + private var v22 = IV[18] + private var v23 = IV[19] + private var v24 = IV[20] + private var v25 = IV[21] + private var v26 = IV[22] + private var v27 = IV[23] + private var v30 = IV[24] + private var v31 = IV[25] + private var v32 = IV[26] + private var v33 = IV[27] + private var v34 = IV[28] + private var v35 = IV[29] + private var v36 = IV[30] + private var v37 = IV[31] private lateinit var tmpBuf: ByteArray /* @@ -682,13 +682,21 @@ internal class Luffa384 : DigestEngine() { -0x7a7f8a2b, 0x36d79cce, -0x1a8e0829, 0x204b1f67, 0x35870c6a, 0x57e9e923, 0x14bcb808, 0x7cde72ce ) - private val RC00 = intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) - private val RC04 = intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) - private val RC10 = intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) - private val RC14 = intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) - private val RC20 = intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) - private val RC24 = intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) - private val RC30 = intArrayOf(-0x4dec505b, -0x37b1416b, 0x4e608a22, 0x56d858fe, 0x343b138f, -0x2f13b1c3, 0x2ceb4882, -0x4c52ddf8) - private val RC34 = intArrayOf(-0x1fd73641, 0x44756f91, 0x7e8fce32, -0x6a9ab742, -0x1e6e41e, 0x3cb226e5, 0x5944a28e, -0x5e3b3cab) + private val RC00 = + intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) + private val RC04 = + intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) + private val RC10 = + intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) + private val RC14 = + intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) + private val RC20 = + intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) + private val RC24 = + intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) + private val RC30 = + intArrayOf(-0x4dec505b, -0x37b1416b, 0x4e608a22, 0x56d858fe, 0x343b138f, -0x2f13b1c3, 0x2ceb4882, -0x4c52ddf8) + private val RC34 = + intArrayOf(-0x1fd73641, 0x44756f91, 0x7e8fce32, -0x6a9ab742, -0x1e6e41e, 0x3cb226e5, 0x5944a28e, -0x5e3b3cab) } } diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa512.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa512.kt index 78b05ec..14a47d4 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa512.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/Luffa512.kt @@ -53,46 +53,46 @@ import com.appmattus.crypto.internal.core.encodeBEInt */ @Suppress("LargeClass") internal class Luffa512 : DigestEngine() { - private var v00 = 0 - private var v01 = 0 - private var v02 = 0 - private var v03 = 0 - private var v04 = 0 - private var v05 = 0 - private var v06 = 0 - private var v07 = 0 - private var v10 = 0 - private var v11 = 0 - private var v12 = 0 - private var v13 = 0 - private var v14 = 0 - private var v15 = 0 - private var v16 = 0 - private var v17 = 0 - private var v20 = 0 - private var v21 = 0 - private var v22 = 0 - private var v23 = 0 - private var v24 = 0 - private var v25 = 0 - private var v26 = 0 - private var v27 = 0 - private var v30 = 0 - private var v31 = 0 - private var v32 = 0 - private var v33 = 0 - private var v34 = 0 - private var v35 = 0 - private var v36 = 0 - private var v37 = 0 - private var v40 = 0 - private var v41 = 0 - private var v42 = 0 - private var v43 = 0 - private var v44 = 0 - private var v45 = 0 - private var v46 = 0 - private var v47 = 0 + private var v00 = IV[0] + private var v01 = IV[1] + private var v02 = IV[2] + private var v03 = IV[3] + private var v04 = IV[4] + private var v05 = IV[5] + private var v06 = IV[6] + private var v07 = IV[7] + private var v10 = IV[8] + private var v11 = IV[9] + private var v12 = IV[10] + private var v13 = IV[11] + private var v14 = IV[12] + private var v15 = IV[13] + private var v16 = IV[14] + private var v17 = IV[15] + private var v20 = IV[16] + private var v21 = IV[17] + private var v22 = IV[18] + private var v23 = IV[19] + private var v24 = IV[20] + private var v25 = IV[21] + private var v26 = IV[22] + private var v27 = IV[23] + private var v30 = IV[24] + private var v31 = IV[25] + private var v32 = IV[26] + private var v33 = IV[27] + private var v34 = IV[28] + private var v35 = IV[29] + private var v36 = IV[30] + private var v37 = IV[31] + private var v40 = IV[32] + private var v41 = IV[33] + private var v42 = IV[34] + private var v43 = IV[35] + private var v44 = IV[36] + private var v45 = IV[37] + private var v46 = IV[38] + private var v47 = IV[39] private lateinit var tmpBuf: ByteArray /* @@ -939,15 +939,25 @@ internal class Luffa512 : DigestEngine() { -0x4f8ddb34, 0x03e86cea ) - private val RC00 = intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) - private val RC04 = intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) - private val RC10 = intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) - private val RC14 = intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) - private val RC20 = intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) - private val RC24 = intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) - private val RC30 = intArrayOf(-0x4dec505b, -0x37b1416b, 0x4e608a22, 0x56d858fe, 0x343b138f, -0x2f13b1c3, 0x2ceb4882, -0x4c52ddf8) - private val RC34 = intArrayOf(-0x1fd73641, 0x44756f91, 0x7e8fce32, -0x6a9ab742, -0x1e6e41e, 0x3cb226e5, 0x5944a28e, -0x5e3b3cab) - private val RC40 = intArrayOf(-0xf2d161d, -0x53ee2806, 0x1bcb66f2, 0x6f2d9bc9, 0x78602649, -0x712516ae, 0x3b6ba548, -0x12516ae0) - private val RC44 = intArrayOf(0x5090d577, 0x2d1925ab, -0x4b9b6954, -0x2e6da550, 0x29131ab6, 0x0fc053c3, 0x3f014f0c, -0x3fac3cf) + private val RC00 = + intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) + private val RC04 = + intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) + private val RC10 = + intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) + private val RC14 = + intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) + private val RC20 = + intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) + private val RC24 = + intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) + private val RC30 = + intArrayOf(-0x4dec505b, -0x37b1416b, 0x4e608a22, 0x56d858fe, 0x343b138f, -0x2f13b1c3, 0x2ceb4882, -0x4c52ddf8) + private val RC34 = + intArrayOf(-0x1fd73641, 0x44756f91, 0x7e8fce32, -0x6a9ab742, -0x1e6e41e, 0x3cb226e5, 0x5944a28e, -0x5e3b3cab) + private val RC40 = + intArrayOf(-0xf2d161d, -0x53ee2806, 0x1bcb66f2, 0x6f2d9bc9, 0x78602649, -0x712516ae, 0x3b6ba548, -0x12516ae0) + private val RC44 = + intArrayOf(0x5090d577, 0x2d1925ab, -0x4b9b6954, -0x2e6da550, 0x29131ab6, 0x0fc053c3, 0x3f014f0c, -0x3fac3cf) } } diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/LuffaSmallCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/LuffaSmallCore.kt index 054397e..dce852b 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/LuffaSmallCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/LuffaSmallCore.kt @@ -49,30 +49,30 @@ import com.appmattus.crypto.internal.core.encodeBEInt * @author Thomas Pornin <thomas.pornin@cryptolog.com> */ internal abstract class LuffaSmallCore> : DigestEngine() { - private var v00 = 0 - private var v01 = 0 - private var v02 = 0 - private var v03 = 0 - private var v04 = 0 - private var v05 = 0 - private var v06 = 0 - private var v07 = 0 - private var v10 = 0 - private var v11 = 0 - private var v12 = 0 - private var v13 = 0 - private var v14 = 0 - private var v15 = 0 - private var v16 = 0 - private var v17 = 0 - private var v20 = 0 - private var v21 = 0 - private var v22 = 0 - private var v23 = 0 - private var v24 = 0 - private var v25 = 0 - private var v26 = 0 - private var v27 = 0 + private var v00 = IV[0] + private var v01 = IV[1] + private var v02 = IV[2] + private var v03 = IV[3] + private var v04 = IV[4] + private var v05 = IV[5] + private var v06 = IV[6] + private var v07 = IV[7] + private var v10 = IV[8] + private var v11 = IV[9] + private var v12 = IV[10] + private var v13 = IV[11] + private var v14 = IV[12] + private var v15 = IV[13] + private var v16 = IV[14] + private var v17 = IV[15] + private var v20 = IV[16] + private var v21 = IV[17] + private var v22 = IV[18] + private var v23 = IV[19] + private var v24 = IV[20] + private var v25 = IV[21] + private var v26 = IV[22] + private var v27 = IV[23] private lateinit var tmpBuf: ByteArray /* @@ -487,11 +487,17 @@ internal abstract class LuffaSmallCore> : DigestEngine( 0x24aa230a, -0x74d9b519 ) - private val RC00 = intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) - private val RC04 = intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) - private val RC10 = intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) - private val RC14 = intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) - private val RC20 = intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) - private val RC24 = intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) + private val RC00 = + intArrayOf(0x303994a6, -0x3f19ad67, 0x6cc33a12, -0x23a967c2, 0x1e00108f, 0x7800423d, -0x70a4877e, -0x691e24ee) + private val RC04 = + intArrayOf(-0x1fcc87e8, 0x441ba90d, 0x7f34d442, -0x6c76de81, -0x1a57431a, 0x5274baf4, 0x26889ba7, -0x65dd9163) + private val RC10 = + intArrayOf(-0x4921ef13, 0x70f47aae, 0x0707a3d4, 0x1c1e8f51, 0x707a3d45, -0x514d7a9e, -0x4535ea77, 0x40a46f3e) + private val RC14 = + intArrayOf(0x01685f3d, 0x05a17cf4, -0x42f63536, -0xbd8d4d8, 0x144ae5cc, -0x55851d5, 0x2e48f1c1, -0x46dc38fc) + private val RC20 = + intArrayOf(-0x3df262e, 0x34552e25, 0x7ad8818f, -0x7bc789b6, -0x44921fce, -0x12487f38, -0x267b8caa, -0x5d387bcc) + private val RC24 = + intArrayOf(-0x1da18d3f, -0x19dc448e, 0x5c58a4a4, 0x1e38e2e7, 0x78e38b9d, 0x27586719, 0x36eda57f, 0x703aace7) } } diff --git a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/TigerCore.kt b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/TigerCore.kt index d420fdb..9172e30 100644 --- a/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/TigerCore.kt +++ b/cryptohash/src/commonMain/kotlin/com/appmattus/crypto/internal/core/sphlib/TigerCore.kt @@ -53,9 +53,9 @@ import com.appmattus.crypto.internal.core.encodeLELong */ internal abstract class TigerCore>(fbyte: Byte) : MDHelper(true, 8, fbyte) { - private var currentA: Long = 0 - private var currentB: Long = 0 - private var currentC: Long = 0 + private var currentA: Long = 0x0123456789ABCDEFL + private var currentB: Long = -0x123456789abcdf0L + private var currentC: Long = -0xf695a4b3c4d1e79L override fun copyState(dest: D): D { dest.currentA = currentA diff --git a/cryptohash/src/jsMain/kotlin/com/appmattus/crypto/PlatformData.kt b/cryptohash/src/jsMain/kotlin/com/appmattus/crypto/PlatformData.kt index edef1aa..f67cedc 100644 --- a/cryptohash/src/jsMain/kotlin/com/appmattus/crypto/PlatformData.kt +++ b/cryptohash/src/jsMain/kotlin/com/appmattus/crypto/PlatformData.kt @@ -20,7 +20,7 @@ package com.appmattus.crypto * Represents the native platforms data type for Array like data. For JavaScript we are using [ByteArray] */ @Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") -actual typealias PlatformData = ByteArray +public actual typealias PlatformData = ByteArray /** * Convert this [Digest] into a platform specific [PlatformDigest] diff --git a/cryptohash/src/jsTest/kotlin/com/appmattus/crypto/internal/ExecuteInBackground.kt b/cryptohash/src/jsTest/kotlin/com/appmattus/crypto/internal/ExecuteInBackground.kt new file mode 100644 index 0000000..0ccb4b9 --- /dev/null +++ b/cryptohash/src/jsTest/kotlin/com/appmattus/crypto/internal/ExecuteInBackground.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2022 Appmattus Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.appmattus.crypto.internal + +actual fun executeInBackground(inBackground: Boolean, block: () -> Unit) { + block() +} diff --git a/gradle.properties b/gradle.properties index 2d1f59d..b024750 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,7 @@ xcodeproj=./samples/iosApp android.useAndroidX=true kotlin.mpp.stability.nowarn=true +kotlin.mpp.androidGradlePluginCompatibility.nowarn=true kotlin.js.generate.executable.default=false