I want to to generate a secure, randomised string, in JavaScript. There isn't much around about security in JavaScript, because it is usually used on the client-side – in this case, I'm using it on the server-side with Node.js.
I could create a for loop that adds a random character to a string each time around – but are there any libraries, functions, or anything else that I can install with npm
, that uses SSL security-like code, encryption or the like?
Also, please answer with a variety of options – this will be the most useful.
Stackoverflow seems to think that there is another answer that is similar to this one. But I disagree. This question asks:
Is there a more elegant way?
– to an existing piece of code. My question is more broard, and could be helpful to people that have no previous knoledge of random string generation in JavaScript. Also, this question could attract a wider range of answers, giving many different methods, that can be compared.