-
-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy path2-key.js
More file actions
27 lines (23 loc) · 587 Bytes
/
2-key.js
File metadata and controls
27 lines (23 loc) · 587 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
const characters = () => {
// some text about function
const temp = [];
for (let i = 48; i < 91; i++) {
if (i > 57 && i < 65) continue;
temp.push(String.fromCharCode(i).toLowerCase());
}
return temp;
};
const generateKey = (length, possible) => {
// some text about function
let key = '';
for (let i = 0; i < length; i++) {
const random = Math.floor(Math.random() * 25) + 1;
key += possible[random];
}
return key;
};
const chars = characters();
const key = generateKey(16, chars);
console.log(key);
module.exports = { generateKey };