I am currently working on a JavaScript team project which involves cryptography.
I want my program to be as safe as possible, if possible industry-level safe, and as such I have been searching for community-approved implementations of random big prime number generation algorithms.
I explored Node.js Crypto, but I did not find a straightforward function that returns a random big probable prime number.
How can I use Node.js Crypto to solve this problem?
createDiffieHellman from Node's crypto module can do this:
const crypto = require('crypto');
let DH = crypto.createDiffieHellman(16); // bit length
let prime = DH.getPrime('hex');
let dec = parseInt(prime, 16);
console.log('prime:', prime); // prime: c803
console.log('dec:', dec); // dec: 51203