3 var encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5 var decTable = new Array(
6 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
7 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
8 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
9 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
10 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
11 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
12 -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
13 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
15 Rakka.encodeBase64 = function (src) {
21 var c1 = src.charCodeAt(i++);
24 ret += encTable.charAt(c1 >> 2);
25 ret += encTable.charAt((c1 & 0x03) << 4);
29 var c2 = src.charCodeAt(i++);
32 ret += encTable.charAt(c1 >> 2);
33 ret += encTable.charAt(((c1 & 0x03) << 4) | ((c2 & 0xF0) >> 4));
34 ret += encTable.charAt((c2 & 0x0F) << 2);
38 var c3 = src.charCodeAt(i++);
40 ret += encTable.charAt(c1 >> 2);
41 ret += encTable.charAt(((c1 & 0x03) << 4) | ((c2 & 0xF0) >> 4));
42 ret += encTable.charAt(((c2 & 0x0F) << 2) | ((c3 & 0xC0) >> 6));
43 ret += encTable.charAt(c3 & 0x3F);
51 Rakka.decodeBase64 = function (src) {
59 c1 = decTable[src.charCodeAt(i++)];
60 } while (i < len && c1 == -1);
65 c2 = decTable[src.charCodeAt(i++)];
66 } while (i < len && c2 == -1);
70 ret += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
74 c3 = src.charCodeAt(i++);
79 } while (i < len && c3 == -1);
82 ret += String.fromCharCode(((c2 & 0x0F) << 4) | ((c3 & 0x3C) >> 2));
86 c4 = src.charCodeAt(i++);
91 } while (i < len && c4 == -1);
94 ret += String.fromCharCode(((c3 & 0x03) << 6) | c4);