Created
January 11, 2015 10:47
-
-
Save rcombs/62f9972853ee01b088c3 to your computer and use it in GitHub Desktop.
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 unhash(target){ | |
var letters = "acdegilmnoprstuw"; | |
var str = ""; | |
var max = letters.length; | |
while(target > 7) { | |
var mod = target % 37; | |
if (mod > max) | |
throw new Exception("This isn't a valid hash!"); | |
str = letters[mod] + str; | |
target = (target - mod) / 37; | |
} | |
return str; | |
} | |
console.log(unhash(956446786872726)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment