Skip to content

Commit

Permalink
KyberKotlin v0.4.9
Browse files Browse the repository at this point in the history
* Sealed KyberKeyGenerator and KyberAgreement classes.
* Updated keyBytes to 'internal' to prevent unwanted modifications.
* Added explicit JvmName for parameters of KyberEncapsulationResult.
  • Loading branch information
ronhombre committed Mar 9, 2024
1 parent 9e5cd4c commit f1e1680
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This benchmark is for performance tracking through the development.

```Kotlin
dependencies {
implementation("asia.hombre:kyber:0.4.8")
implementation("asia.hombre:kyber:0.4.9")
}
```

Expand All @@ -101,7 +101,7 @@ dependencies {

## JS NPM Installation
```
npm i kyberkotlin@0.4.8
npm i kyberkotlin@0.4.9
```

## Native C# Installation
Expand Down
16 changes: 15 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = "asia.hombre.kyber" //The value after the last '.' is considered the maven name i.e. asia.hombre:kyber:+
version = "0.4.8"
version = "0.4.9"

val projectName = project.group.toString().split(".").last() //Grab maven name
val baseProjectName = projectName.plus("-").plus(project.version)
Expand Down Expand Up @@ -173,6 +173,20 @@ kotlin {
}
}

tasks.dokkaHtml.configure {
dokkaSourceSets {
named("commonMain") {
// Adjust visibility to include internal and private members
perPackageOption {
matchingRegex.set(".*") // Match all packages
includeNonPublic.set(false)
}
// Optionally, report undocumented members
reportUndocumented.set(true)
}
}
}

fun saveHash(file: File, hash: String, suffix: String) {
val filePath = file.toPath()
Files.write(filePath.resolveSibling(filePath.fileName.toString() + suffix), hash.toByteArray())
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@

<groupId>asia.hombre</groupId>
<artifactId>kyber</artifactId>
<version>0.4.8</version>
<version>0.4.9</version>
<packaging>jar</packaging>

<scm>
<tag>v0.4.8</tag>
<tag>v0.4.9</tag>
<connection>scm:git:https://github.com/ronhombre/KyberKotlin.git</connection>
<url>https://github.com/ronhombre/KyberKotlin.git</url>
</scm>
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/asia/hombre/kyber/KyberAgreement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import kotlin.jvm.JvmSynthetic
*/
@OptIn(ExperimentalJsExport::class)
@JsExport
class KyberAgreement(kemKeyPair: KyberKEMKeyPair) {
sealed class KyberAgreement(kemKeyPair: KyberKEMKeyPair) {
/**
* The [KyberParameter] of this agreement.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import kotlin.jvm.JvmStatic
*/
@OptIn(ExperimentalJsExport::class)
@JsExport
class KyberDecryptionKey internal constructor(override val parameter: KyberParameter, override val keyBytes: ByteArray) : KyberPKEKey {
class KyberDecryptionKey internal constructor(override val parameter: KyberParameter, internal val keyBytes: ByteArray) : KyberPKEKey {
/**
* All the bytes of the Decryption Key.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package asia.hombre.kyber

import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.jvm.JvmName

/**
* A class for ML-KEM Encapsulation Results.
Expand All @@ -33,4 +34,9 @@ import kotlin.js.JsExport
*/
@OptIn(ExperimentalJsExport::class)
@JsExport
class KyberEncapsulationResult internal constructor(val secretKey: ByteArray, val cipherText: KyberCipherText)
class KyberEncapsulationResult internal constructor(
@get:JvmName("getSecretKey")
val secretKey: ByteArray,
@get:JvmName("getCipherText")
val cipherText: KyberCipherText
)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import kotlin.jvm.JvmStatic
@JsExport
class KyberEncryptionKey internal constructor(
override val parameter: KyberParameter,
override val keyBytes: ByteArray,
internal val keyBytes: ByteArray,
internal val nttSeed: ByteArray) : KyberPKEKey {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlin.jvm.JvmSynthetic
*/
@OptIn(ExperimentalJsExport::class)
@JsExport
class KyberKeyGenerator private constructor() {
sealed class KyberKeyGenerator private constructor() {

companion object {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ import kotlin.js.JsExport
@JsExport
internal interface KyberPKEKey: Convertible {
val parameter: KyberParameter
val keyBytes: ByteArray
}

0 comments on commit f1e1680

Please sign in to comment.