Files
shrt/hash.js
2017-08-26 17:48:10 +02:00

13 lines
301 B
JavaScript

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;