{"_id":"o-kyber","name":"o-kyber","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"o-kyber","version":"1.0.0","description":"<p align=\"center\">   <img src=\"./kyber.png\"/> </p>","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"o-kyber@1.0.0","_nodeVersion":"16.17.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-zpNhh1dtTA0mWeR7fIncZI6u/xOtGZ9fttiAfplu9oUm6daFKced2Nu6j/KdA2gsRhEJxW18EVjWXh4tI17C8g==","shasum":"3679733b2460331bd10714d202768aebfc7c88d8","tarball":"https://registry.npmjs.org/o-kyber/-/o-kyber-1.0.0.tgz","fileCount":13,"unpackedSize":3968010,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCji0B72dnfb4L7Ieczla0N8du2/w2uXjL5ZEekwN77LQIgJ2kQjoBEmsUuwsaEMKvy49cJhUXhvPKdWznGaKTvsok="}]},"_npmUser":{"name":"octoputer","email":"codephoenix00@gmail.com"},"directories":{},"maintainers":[{"name":"octoputer","email":"codephoenix00@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-kyber_1.0.0_1696698229924_0.1846881358205128"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-07T17:03:49.923Z","1.0.0":"2023-10-07T17:03:50.206Z","modified":"2023-10-07T17:03:50.557Z"},"maintainers":[{"name":"octoputer","email":"codephoenix00@gmail.com"}],"description":"<p align=\"center\">   <img src=\"./kyber.png\"/> </p>","license":"ISC","readme":"# CRYSTALS-KYBER JavaScript\n\n<p align=\"center\">\n  <img src=\"./kyber.png\"/>\n</p>\n\n**CRYSTALS-KYBER** is a post-quantum key exchange protocol.\n\nThis protocol is used to securely establish symmetric keys between two parties. \n\nThis JavaScript implementation is intended for client-side web browser applications and server-side backends in Node.js frameworks.\n\nMost of this code was translated from a Go implementation of Kyber which can be found [here](https://github.com/symbolicsoft/kyber-k2so).\n\nOriginal code (written in C) can be found [here](https://github.com/pq-crystals/kyber).\n\nKyber comes in 512, 768, 1024 security strengths.\n\nThis code is the most up to date version based off the [NIST PQC Round 3 Submissions](https://csrc.nist.gov/projects/post-quantum-cryptography/round-3-submissions).\n\n## Functionality\n\n**KYBER** will securely distribute a 256 bit symmetric key between two parties. To safely transmit data over a channel using the key, an AEAD is advised (such as AES-256-GCM).\n\nThe exchange can be visualised below:\n\n![](./diagram.svg)\n\n## Usage\nUsing Node.js (v16.17.0) or React:\n```bash\nnpm install crystals-kyber\n```\nImport the module at the top of your js file.\n```js\nconst kyber = require('crystals-kyber');\n```\nTo use in your code (768 can be replaced with 512 or 1024).\n```js\n// To generate a public and private key pair (pk, sk)\nlet pk_sk = kyber.KeyGen768();\nlet pk = pk_sk[0];\nlet sk = pk_sk[1];\n\n// To generate a random 256 bit symmetric key (ss) and its encapsulation (c)\nlet c_ss = kyber.Encrypt768(pk);\nlet c = c_ss[0];\nlet ss1 = c_ss[1];\n\n// To decapsulate and obtain the same symmetric key\nlet ss2 = kyber.Decrypt768(c,sk);\n\n// Test function with KATs\nkyber.Test768();\n```\n## Running Tests\nOutput from function `kyber.Test768()` that tests compatibility with the C implementation based on run cases in `PQCkemKAT_2400.rsp`.\n```\nTest run [ 0 ] success\nTest run [ 1 ] success\nTest run [ 2 ] success\nTest run [ 3 ] success\nTest run [ 4 ] success\nTest run [ 5 ] success\n          .\n          .\n          .\nTest run [ 95 ] success\nTest run [ 96 ] success\nTest run [ 97 ] success\nTest run [ 98 ] success\nTest run [ 99 ] success\n \nAll test runs successful.\n\nss1 <Buffer cd c4 7d 83 2b 49 5d 82 3c 08 34 ea 12 f0 4a 8f 5c 4c d6 19 b1 79 85 71 d6 b2 a7 c9 3f ac cc d1>\nss2 <Buffer cd c4 7d 83 2b 49 5d 82 3c 08 34 ea 12 f0 4a 8f 5c 4c d6 19 b1 79 85 71 d6 b2 a7 c9 3f ac cc d1>\n1\n```\n\n## Further Information\nMore details about CRYSTALS-KYBER, lattice-based cryptography and a real-life use of this algorithm can be\nread here [Active Implementation of Post-Quantum End-to-End Encryption](https://eprint.iacr.org/2021/356.pdf) [20 Apr 2021].\n","readmeFilename":"README.md"}