Skip to content

Instantly share code, notes, and snippets.

@lamchau
Created January 29, 2014 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamchau/8689873 to your computer and use it in GitHub Desktop.
Save lamchau/8689873 to your computer and use it in GitHub Desktop.
random sha1 string generator for testing
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