Skip to content

Instantly share code, notes, and snippets.

@poorcoder
Created October 20, 2014 02:42
Show Gist options
  • Save poorcoder/b174bcbe18e94307b4d4 to your computer and use it in GitHub Desktop.
Save poorcoder/b174bcbe18e94307b4d4 to your computer and use it in GitHub Desktop.
Base64 dönüşüm fonksiyonları / base64toInt - intToBase64
/*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