Nitrogen Pumpkin Mulch

    kyber-crystals
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    kyber-crystals

    Overview

    The Kyber post-quantum asymmetric cypher compiled to WebAssembly using Emscripten. A simple JavaScript wrapper is provided to make Kyber easy to use in web applications.

    The default parameter set is Kyber-1024 (roughly 256-bit strength).

    Example Usage

    import {kyber} from 'kyber-crystals';
    
    const keyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
    	await kyber.keyPair()
    ;
    
    const {cyphertext, secret} /*: {cyphertext: Uint8Array; secret: Uint8Array} */ =
    	await kyber.encrypt(keyPair.publicKey)
    ;
    
    const decrypted /*: Uint8Array */ =
    	await kyber.decrypt(cyphertext, keyPair.privateKey) // same as secret
    ;
    
    console.log(keyPair);
    console.log(secret);
    console.log(cyphertext);
    console.log(decrypted);
    

    Install

    npm i kyber-crystals

    DownloadsWeekly Downloads

    6

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    94.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • cyphinc