jsrsasign
jsrsasign copied to clipboard
Seeding the PRNG
I needed to seed the PRNG with a specific value. After some poking around I found that it can be done like so:
function hex2Array(hex) { var arr = new Array(); for (var i = 0; i < hex.length; i += 2) arr[i/2] = parseInt(hex.substr(i, 2), 16); return arr; }
var seedByteArray = hex2Array(seedHexStr);
//////////////// rng_state = prng_newstate(); rng_state.init(seedByteArray); ///////////////
It might be nice to add these last two lines into a "seed" function of the SecureRandom class in the future
@kjur Any chance that this will be implemented?