Last active
July 12, 2019 14:41
-
-
Save BlaM/f5728b2c1af1b37ebf90c8b87bc579d0 to your computer and use it in GitHub Desktop.
Generate 32 character random hex key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomKey() { | |
var r='', l=0; | |
do { | |
r += Math.random().toString(16).replace(/[01]\./g, ''); | |
} while (r.length < 32 && l++ < 32); | |
return r.substr(-32, 32); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomKey() { | |
var r='', l=0; | |
do { | |
r += Math.random().toString(36).replace(/[01]\./g, ''); | |
} while (r.length < 32 && l++ < 32); | |
return r.substr(-32, 32); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment