0.8.1 • Published 22 days ago

kyberkotlin v0.8.1

Weekly downloads
-
License
APACHE-2.0
Repository
-
Last release
22 days ago

KyberKotlin (NPM build)

Parent Source: KyberKotlin

Generated from parent KMM library using ./gradlew bundleNPM

Installation

npm install kyberkotlin

Documentation

Visit kyber.hombre.asia. All common methods and classes are available in JS.

Usage sample

const { KyberParameter, KyberKeyGenerator, KyberAgreement } = require("kyberkotlin").asia.hombre.kyber;

let aliceKeypair = KyberKeyGenerator.Companion.generate(KyberParameter.ML_KEM_512);

let aliceAgreement = new KyberAgreement(aliceKeypair.decapsulationKey);

//Send the Encapsulation Key and they encapsulate a Shared Secret Key with it.
let results = KyberAgreement.Companion.encapsulate(aliceKeypair.encapsulationKey);

let ciphertext = results.cipherText;
let bobSecretKey = results.secretKey;

//Receive the Cipher Text and decapsulate the Shared Secret Key in it.
let aliceSecretKey = aliceAgreement.decapsulate(ciphertext);

console.assert(contentEquals(aliceSecretKey, bobSecretKey), "Secret Keys does not match!");

//Simple check
function contentEquals(a, b) {
    for(let i = 0; i < a.length; i++)
        if(a[i] !== b[i])
            return false;
    return true;
}

License

Copyright 2024 Ron Lauren Hombre

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

       https://www.apache.org/licenses/LICENSE-2.0
       
       and included as LICENSE.txt in this Project.

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.
0.8.1

22 days ago

0.8.0

26 days ago

0.7.0

28 days ago

0.6.1

1 month ago

0.6.0

1 month ago

0.5.1

2 months ago

0.5.0

2 months ago

0.4.10

2 months ago

0.4.8

3 months ago