Git Product home page Git Product logo

fisherstevenk / crystals-kyber-ts Goto Github PK

View Code? Open in Web Editor NEW
27.0 1.0 2.0 1.36 MB

Typescript Implementation of CRYSTALS Kyber IND-CCA2-secure key encapsulation mechanism (KEM), whose security is based on the hardness of solving the learning-with-errors (LWE) problem over module lattices. https://www.npmjs.com/package/crystals-kyber-ts

License: MIT License

JavaScript 0.01% TypeScript 100.00%
kem kyber pki post-quantum post-quantum-cryptography

crystals-kyber-ts's People

Contributors

fisherstevenk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

crystals-kyber-ts's Issues

Secret key doesn't match

I tried the example script:

import { Kyber1024Handshake } from 'crystals-kyber-ts';

const bobHandshake = new Kyber1024Handshake();
const aliceHandshake = new Kyber1024Handshake();
const aliceCipherText = aliceHandshake.generateCipherTextAndSharedSecret(bobPublicKey);
const bobSharedSecret = bobHandshake.generateRemoteSharedSecret(aliceCipherText);
console.log(aliceHandshake.sharedSecret, bobSharedSecret);

I would expect aliceHandshake.sharedSecret to be identical to bobSharedSecret, but the values are different. Am I missing something?

Cannot find module 'crystals-kyber-ts\dist\services\kyber512.service' imported from crystals-kyber-ts\dist\index.js

Running the following file with Node.js, I get the following error:

import {Kyber1024Handshake} from 'crystals-kyber-ts'
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'D:\Users\Jordan\Desktop\kyber-test\node_modules\crystals-kyber-ts\dist\services\kyber512.service' imported from D:\Users\Jordan\Desktop\kyber-test\node_modules\crystals-kyber-ts\dist\index.js
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:326:11)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.15.0

Since package.json has type: "module", all import specifiers need to have file extensions.

Recommended reading: https://www.typescriptlang.org/docs/handbook/esm-node.html

Vulnerability. This project uses empty key pairs.

You do not generate a pair of local keys, the _publicKey and _privateKey fields remain equal to [], which is why Bob and Alice have the same private and public keys. Therefore, the shared key is the same. If you add your code to generate keys, then the shared key no longer matches.

Expose IND-CPA PKE, and seed-based kyber keygen

Hey im working on exposing the pke so that we can use crystals kyber to encrypt 32-byte messages as well as also allowing to perform indcpa keygen using custom seed to encrypt data via password etc.

Just might need some help with the tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.