Last active
August 29, 2015 14:07
-
-
Save greenlikeorange/88b299b40f7ed57923dc to your computer and use it in GitHub Desktop.
Number To Base64 Consonants
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
var b64c = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + /".split(" "); | |
function cc(number, consonants){ | |
var len = consonants.length, | |
_res = "", | |
_que; | |
while(number>=0){ | |
_que = number%len; | |
_res = consonants[_que] + _res; | |
number = (number-_que)/len-1; | |
} | |
return _res; | |
} | |
console.log( cc(20002013200, b64c) ); // output: RnMm/Q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment