i created a function in javascript that creates my a
for the DH exchange like this:
function createSecretKeyArray(){
let BigNumber = require('bignumber.js');
let numberArray = [];
const multiplier = 1;
for(let i=0; i<32; i++){
let randomNumber = BigNumber.random(multiplier);
let MulConstant = new BigNumber(10 ** multiplier);
let secret = new BigNumber(randomNumber.mul(MulConstant).add(1).floor().toPrecision(multiplier));
numberArray.push(secret);
}
return numberArray;
}
TLDR: It creates 32 randomized numbers between 1 and 11 and computes my a
: a
= number0 * number1 * .... * number31. I want to use this in G^a mod P
, G=2, P is from https://datatracker.ietf.org/doc/html/rfc3526#section-5, chapter 5.
My question is now: Is this algorithm secure ? Are there any problems that occur once someone tries to guess my secret ?