function EncodingAESKeyGen() { var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; var token = ''; for(var i = 0; i < 43; i++) { var j = parseInt(Math.random() * 61 + 1); token += letters[j]; } return token; }