Skip to content

sweatpotato13/newhope-ts

Repository files navigation

Welcome to newhope 👋

Version Documentation Maintenance

Post-Quantum Cryptography Key Agreement Algorithm

Install

npm i newhope-ts
yarn add newhope-ts

Run tests

yarn test

Usage

const newHopeAlice = new NewHope();
newHopeAlice.generateKeyPair();
const sharedRandomness = newHopeAlice.sharedRandomness;

const newHopeBob = new NewHope();
newHopeBob.sharedRandomness = sharedRandomness;
newHopeBob.generateKeyPair();
// newHopeBob.vector = errorDistribution;
const aliceShared = newHopeAlice.generateSharedSecret(
    newHopeBob.publicKey,
    Encoding.MATRIX
);
newHopeBob.vector = newHopeAlice.vector;

const bobShared = newHopeBob.generateSharedSecret(
    newHopeAlice.publicKey,
    Encoding.MATRIX
);

console.log("Alice");
console.log(aliceShared.toString());
console.log("Bob");
console.log(bobShared.toString());
if (aliceShared.toString() === bobShared.toString()) {
    console.log("Success!");
} else {
    console.log("Failed");
}

Author

👤 CuteWisp [email protected]

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator