Skip to content

Commit

Permalink
Update kotlincrypto.core and kotlincrypto.hash dependencies (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Jan 12, 2025
1 parent 093f416 commit cae73f7
Show file tree
Hide file tree
Showing 61 changed files with 604 additions and 306 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ fun main() {
HmacSha384(key)
HmacSHA512(key)

HmacSHA512_224(key)
HmacSHA512_256(key)
HmacSHA512t(key, 504)
HmacSHA512t(key, 224) // HmacSHA512/224
HmacSHA512t(key, 256) // HmacSHA512/256

key.fill(0)
}
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ kmpConfiguration {
sourceSetMain {
dependencies {
implementation(libs.benchmark.runtime)
implementation(libs.kotlincrypto.bitops.bits)
implementation(libs.kotlincrypto.bitops.endian)
implementation(libs.kotlincrypto.hash.md)
implementation(libs.kotlincrypto.hash.sha1)
implementation(libs.kotlincrypto.hash.sha2)
implementation(libs.kotlincrypto.hash.sha3)
implementation(libs.kotlincrypto.endians.endians)
implementation(libs.kotlincrypto.sponges.keccak)
implementation(project(":library:hmac:hmac-md"))
implementation(project(":library:hmac:hmac-sha1"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("unused")

package org.kotlincrypto.macs.benchmarks

import kotlinx.benchmark.Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("SpellCheckingInspection")
@file:Suppress("SpellCheckingInspection", "unused")

package org.kotlincrypto.macs.benchmarks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("ClassName", "SpellCheckingInspection")
@file:Suppress("ClassName", "SpellCheckingInspection", "unused")

package org.kotlincrypto.macs.benchmarks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("SpellCheckingInspection")
@file:Suppress("SpellCheckingInspection", "unused")

package org.kotlincrypto.macs.benchmarks

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ POM_DEVELOPER_ID=KotlinCrypto
POM_DEVELOPER_NAME=Kotlin Crypto
POM_DEVELOPER_URL=https://github.com/KotlinCrypto/

VERSION_NAME=0.5.7-SNAPSHOT
VERSION_NAME=0.6.0-SNAPSHOT
# 0.1.0-alpha01 = 00 01 00 11
# 0.1.0-beta01 = 00 01 00 21
# 0.1.0-rc01 = 00 01 00 31
# 0.1.0 = 00 01 00 99
# 1.1.0 = 01 01 00 99
VERSION_CODE=00050799
VERSION_CODE=00060099
9 changes: 5 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ gradle-kmp-configuration = "0.3.2"
gradle-kotlin = "1.9.24"
gradle-publish-maven = "0.29.0"

kotlincrypto-core = "0.5.5"
kotlincrypto-hash = "0.5.6"
kotlincrypto-endians = "0.3.1"
kotlincrypto-bitops = "0.1.0-SNAPSHOT"
kotlincrypto-core = "0.6.0-SNAPSHOT"
kotlincrypto-hash = "0.6.0-SNAPSHOT"
kotlincrypto-sponges = "0.3.4"

[libraries]
Expand All @@ -36,7 +36,8 @@ benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime"
bouncy-castle = { module = "org.bouncycastle:bcprov-ext-jdk15to18", version.ref = "bouncy-castle" }
encoding-base16 = { module = "io.matthewnelson.encoding:base16", version.ref = "encoding" }
encoding-base64 = { module = "io.matthewnelson.encoding:base64", version.ref = "encoding" }
kotlincrypto-endians-endians = { module = "org.kotlincrypto.endians:endians", version.ref = "kotlincrypto-endians"}
kotlincrypto-bitops-bits = { module = "org.kotlincrypto.bitops:bits", version.ref = "kotlincrypto-bitops" }
kotlincrypto-bitops-endian = { module = "org.kotlincrypto.bitops:endian", version.ref = "kotlincrypto-bitops" }
kotlincrypto-sponges-keccak = { module = "org.kotlincrypto.sponges:keccak", version.ref = "kotlincrypto-sponges" }

[plugins]
Expand Down
3 changes: 3 additions & 0 deletions library/hmac/hmac-md/api/hmac-md.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
public final class org/kotlincrypto/macs/hmac/md/HmacMD5 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/md/HmacMD5;
}

2 changes: 2 additions & 0 deletions library/hmac/hmac-md/api/hmac-md.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// Library unique name: <org.kotlincrypto.macs:hmac-md>
final class org.kotlincrypto.macs.hmac.md/HmacMD5 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.md/HmacMD5|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.md/HmacMD5.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.md/HmacMD5 // org.kotlincrypto.macs.hmac.md/HmacMD5.copy|copy(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("UnnecessaryOptInAnnotation")
@file:Suppress("SpellCheckingInspection")

package org.kotlincrypto.macs.hmac.md

import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.mac.Mac
import org.kotlincrypto.hash.md.MD5
import org.kotlincrypto.macs.hmac.Hmac

Expand All @@ -28,16 +26,17 @@ import org.kotlincrypto.macs.hmac.Hmac
public class HmacMD5: Hmac {

/**
* Instantiates a new instance of [HmacMD5].
* Creates a new instance of [HmacMD5].
*
* @throws [IllegalArgumentException] if [key] is empty.
* */
@OptIn(InternalKotlinCryptoApi::class)
@Throws(IllegalArgumentException::class)
public constructor(key: ByteArray): super(key, "HmacMD5", MD5())
public constructor(key: ByteArray): super(
key = key,
algorithm = "HmacMD5",
digest = MD5(),
)

@OptIn(InternalKotlinCryptoApi::class)
private constructor(engine: Mac.Engine): super(engine)
private constructor(other: HmacMD5): super(other)

protected override fun copy(engineCopy: Mac.Engine): Mac = HmacMD5(engineCopy)
public override fun copy(): HmacMD5 = HmacMD5(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ open class HmacMD5UnitTest: MacUnitTest() {
final override fun givenMac_whenDoFinal_thenLengthMatchesOutput() {
super.givenMac_whenDoFinal_thenLengthMatchesOutput()
}

@Test
final override fun givenMac_whenInstanceResetWithNewKey_thenDoFinalReturnsExpected() {
super.givenMac_whenInstanceResetWithNewKey_thenDoFinalReturnsExpected()
}
}
3 changes: 3 additions & 0 deletions library/hmac/hmac-sha1/api/hmac-sha1.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
public final class org/kotlincrypto/macs/hmac/sha1/HmacSHA1 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha1/HmacSHA1;
}

2 changes: 2 additions & 0 deletions library/hmac/hmac-sha1/api/hmac-sha1.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// Library unique name: <org.kotlincrypto.macs:hmac-sha1>
final class org.kotlincrypto.macs.hmac.sha1/HmacSHA1 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha1/HmacSHA1|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha1/HmacSHA1.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha1/HmacSHA1 // org.kotlincrypto.macs.hmac.sha1/HmacSHA1.copy|copy(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("UnnecessaryOptInAnnotation")
@file:Suppress("SpellCheckingInspection")

package org.kotlincrypto.macs.hmac.sha1

import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.mac.Mac
import org.kotlincrypto.hash.sha1.SHA1
import org.kotlincrypto.macs.hmac.Hmac

Expand All @@ -28,16 +26,17 @@ import org.kotlincrypto.macs.hmac.Hmac
public class HmacSHA1: Hmac {

/**
* Instantiates a new instance of [HmacSHA1].
* Creates a new instance of [HmacSHA1].
*
* @throws [IllegalArgumentException] if [key] is empty.
* */
@OptIn(InternalKotlinCryptoApi::class)
@Throws(IllegalArgumentException::class)
public constructor(key: ByteArray): super(key, "HmacSHA1", SHA1())
public constructor(key: ByteArray): super(
key = key,
algorithm = "HmacSHA1",
digest = SHA1(),
)

@OptIn(InternalKotlinCryptoApi::class)
private constructor(engine: Mac.Engine): super(engine)
private constructor(other: HmacSHA1): super(other)

protected override fun copy(engineCopy: Mac.Engine): Mac = HmacSHA1(engineCopy)
public override fun copy(): HmacSHA1 = HmacSHA1(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ open class HmacSHA1UnitTest: MacUnitTest() {
final override fun givenMac_whenDoFinal_thenLengthMatchesOutput() {
super.givenMac_whenDoFinal_thenLengthMatchesOutput()
}

@Test
final override fun givenMac_whenInstanceResetWithNewKey_thenDoFinalReturnsExpected() {
super.givenMac_whenInstanceResetWithNewKey_thenDoFinalReturnsExpected()
}
}
15 changes: 15 additions & 0 deletions library/hmac/hmac-sha2/api/hmac-sha2.api
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA224 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha2/HmacSHA224;
}

public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA256 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha2/HmacSHA256;
}

public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA384 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha2/HmacSHA384;
}

public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA512 : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([B)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha2/HmacSHA512;
}

public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA512t : org/kotlincrypto/macs/hmac/Hmac {
public fun <init> ([BI)V
public synthetic fun copy ()Ljava/lang/Object;
public synthetic fun copy ()Lorg/kotlincrypto/macs/hmac/Hmac;
public fun copy ()Lorg/kotlincrypto/macs/hmac/sha2/HmacSHA512t;
}

public final class org/kotlincrypto/macs/hmac/sha2/HmacSHA512tKt {
Expand Down
10 changes: 10 additions & 0 deletions library/hmac/hmac-sha2/api/hmac-sha2.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,32 @@
// Library unique name: <org.kotlincrypto.macs:hmac-sha2>
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA224 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA224|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA224.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha2/HmacSHA224 // org.kotlincrypto.macs.hmac.sha2/HmacSHA224.copy|copy(){}[0]
}

final class org.kotlincrypto.macs.hmac.sha2/HmacSHA256 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA256|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA256.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha2/HmacSHA256 // org.kotlincrypto.macs.hmac.sha2/HmacSHA256.copy|copy(){}[0]
}

final class org.kotlincrypto.macs.hmac.sha2/HmacSHA384 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA384|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA384.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha2/HmacSHA384 // org.kotlincrypto.macs.hmac.sha2/HmacSHA384.copy|copy(){}[0]
}

final class org.kotlincrypto.macs.hmac.sha2/HmacSHA512 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA512|null[0]
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA512.<init>|<init>(kotlin.ByteArray){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha2/HmacSHA512 // org.kotlincrypto.macs.hmac.sha2/HmacSHA512.copy|copy(){}[0]
}

final class org.kotlincrypto.macs.hmac.sha2/HmacSHA512t : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA512t|null[0]
constructor <init>(kotlin/ByteArray, kotlin/Int) // org.kotlincrypto.macs.hmac.sha2/HmacSHA512t.<init>|<init>(kotlin.ByteArray;kotlin.Int){}[0]

final fun copy(): org.kotlincrypto.macs.hmac.sha2/HmacSHA512t // org.kotlincrypto.macs.hmac.sha2/HmacSHA512t.copy|copy(){}[0]
}

final fun org.kotlincrypto.macs.hmac.sha2/HmacSHA512_224(kotlin/ByteArray): org.kotlincrypto.macs.hmac.sha2/HmacSHA512t // org.kotlincrypto.macs.hmac.sha2/HmacSHA512_224|HmacSHA512_224(kotlin.ByteArray){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("UnnecessaryOptInAnnotation")
@file:Suppress("SpellCheckingInspection")

package org.kotlincrypto.macs.hmac.sha2

import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.mac.Mac
import org.kotlincrypto.hash.sha2.SHA224
import org.kotlincrypto.macs.hmac.Hmac

Expand All @@ -28,16 +26,17 @@ import org.kotlincrypto.macs.hmac.Hmac
public class HmacSHA224: Hmac {

/**
* Instantiates a new instance of [HmacSHA224].
* Creates a new instance of [HmacSHA224].
*
* @throws [IllegalArgumentException] if [key] is empty.
* */
@OptIn(InternalKotlinCryptoApi::class)
@Throws(IllegalArgumentException::class)
public constructor(key: ByteArray): super(key, "HmacSHA224", SHA224())
public constructor(key: ByteArray): super(
key = key,
algorithm = "HmacSHA224",
digest = SHA224(),
)

@OptIn(InternalKotlinCryptoApi::class)
private constructor(engine: Mac.Engine): super(engine)
private constructor(other: HmacSHA224): super(other)

protected override fun copy(engineCopy: Mac.Engine): Mac = HmacSHA224(engineCopy)
public override fun copy(): HmacSHA224 = HmacSHA224(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("UnnecessaryOptInAnnotation")
@file:Suppress("SpellCheckingInspection")

package org.kotlincrypto.macs.hmac.sha2

import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.mac.Mac
import org.kotlincrypto.hash.sha2.SHA256
import org.kotlincrypto.macs.hmac.Hmac

Expand All @@ -28,16 +26,17 @@ import org.kotlincrypto.macs.hmac.Hmac
public class HmacSHA256: Hmac {

/**
* Instantiates a new instance of [HmacSHA256].
* Creates a new instance of [HmacSHA256].
*
* @throws [IllegalArgumentException] if [key] is empty.
* */
@OptIn(InternalKotlinCryptoApi::class)
@Throws(IllegalArgumentException::class)
public constructor(key: ByteArray): super(key, "HmacSHA256", SHA256())
public constructor(key: ByteArray): super(
key = key,
algorithm = "HmacSHA256",
digest = SHA256(),
)

@OptIn(InternalKotlinCryptoApi::class)
private constructor(engine: Mac.Engine): super(engine)
private constructor(other: HmacSHA256): super(other)

protected override fun copy(engineCopy: Mac.Engine): Mac = HmacSHA256(engineCopy)
public override fun copy(): HmacSHA256 = HmacSHA256(this)
}
Loading

0 comments on commit cae73f7

Please sign in to comment.