initial
This commit is contained in:
12
hash.js
Normal file
12
hash.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
function randomChar() {
|
||||
return ALPHABET.charAt(Math.floor(Math.random()*62))
|
||||
}
|
||||
|
||||
function createHash(len) {
|
||||
var str = '';
|
||||
while(str.length < len) str += randomChar();
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = createHash;
|
Reference in New Issue
Block a user