Created
October 20, 2014 02:42
-
-
Save poorcoder/b174bcbe18e94307b4d4 to your computer and use it in GitHub Desktop.
Base64 dönüşüm fonksiyonları / base64toInt - intToBase64
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
/*Base64 dönüşüm fonksiyonları*/ | |
function intToBase64(i) { | |
var b64 = ''; | |
b64 += String.fromCharCode((i % 64) + 63); | |
for (var j = 0; j < 4; j++) { | |
i = Math.floor(i / 64); | |
b64 += String.fromCharCode((i % 64) + 63); | |
} | |
return b64; | |
} | |
function base64toInt(b64) { | |
var i = 0; | |
i += (b64.charCodeAt(4) - 63); | |
for (var j = 3; j >= 0; j--) { | |
i = i * 64; | |
i += (b64.charCodeAt(j) - 63); | |
} | |
return i; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment