Git Product home page Git Product logo

Comments (7)

antontutoveanu avatar antontutoveanu commented on July 28, 2024

Please provide details of your platform and running environment.

from crystals-kyber-javascript.

gsingh-ds avatar gsingh-ds commented on July 28, 2024

I have tried the upper code in multiple envs like docker containers.
Steps to reproduce:

  1. install node
  2. npm install crystals-kyber
  3. create index.js with upper code
  4. add "type": "module" in package.json
  5. node index.js

from crystals-kyber-javascript.

gsingh-ds avatar gsingh-ds commented on July 28, 2024

@antontutoveanu help?

from crystals-kyber-javascript.

antontutoveanu avatar antontutoveanu commented on July 28, 2024

I have been able to run the code using node kyber768.js for example.

I believe there is some npm issues which I plan on getting around. Apologies for delays.

from crystals-kyber-javascript.

abmera avatar abmera commented on July 28, 2024

I had the same issue, getting stuck at KeyGen, after some digging found that the culprit was this line:
for (let j = start; j < start + l; j++).

For some reason in the source code from the npm package the j was declared twice: at the beginning of the ntt function and in the for loop again. After removing the let in the for loop it worked. Github source code didn't have this issue though.

from crystals-kyber-javascript.

abmera avatar abmera commented on July 28, 2024

... same bug in nttInverse function where the j was declared twice (again only in npm's source code).

Also, ArrayCompare was missing in npm code which I just copied over from Github.

from crystals-kyber-javascript.

antontutoveanu avatar antontutoveanu commented on July 28, 2024

I have updated the code on both GitHub and NPM.

Please check again with the following usage:

// Import package
const kyber = require('crystals-kyber');

// To generate a public and private key pair (pk, sk)
let pk_sk = kyber.KeyGen768();
let pk = pk_sk[0];
let sk = pk_sk[1];

// To generate a random 256 bit symmetric key (ss) and its encapsulation (c)
let c_ss = kyber.Encrypt768(pk);
let c = c_ss[0];
let ss1 = c_ss[1];

// To decapsulate and obtain the same symmetric key
let ss2 = kyber.Decrypt768(c,sk);

// Test function with KATs
kyber.Test768();

from crystals-kyber-javascript.

Related Issues (7)

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.