Generate password for AES encryption - Node.js Security

Node.js examples for Security:AES

Description

Generate password for AES encryption

Demo Code

function AESGeneratePSW(){
  var chars = "0123456789AabBCcDdeEFfgGHhIiJjKkLlmMNnoOpPQqRrsStTUuvVWwxXyYZz_-+/*,";
  var size = 50;/*from   w  w  w .ja  v  a2  s . c o m*/
  var passWord = '';
  for (var i=0; i<size; i++) {
    var rnum = Math.floor(Math.random() * chars.length);
    passWord += chars.substring(rnum,rnum+1);
  }
  return passWord;
}

Related Tutorials