Created
January 29, 2014 15:05
-
-
Save lamchau/8689873 to your computer and use it in GitHub Desktop.
random sha1 string generator for testing
This file contains 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 sha1() { | |
function random() { | |
var characters = "abcdef0123456789"; | |
return (function () { | |
var index = Math.floor(Math.random() * characters.length); | |
return characters.charAt(index); | |
})(); | |
} | |
var MAX_LENGTH = 40; | |
return (function () { | |
var str = ""; | |
for (var i = 0; i < MAX_LENGTH; i++) { | |
str += random(); | |
} | |
return str; | |
})(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment