PageSourceSearch

https://ebank.drcbank.com/platform/js/lib/enCodeAndDecode.js

js drcbank.com collected 2026-10-04 07:37:11 UTC 4,456 bytes, 145 lines download raw bytes

1var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2var base64DecodeChars = new Array(
3  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
4  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
5  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
6  52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
7  -1, 0, 1, 2, 3,  4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
8  15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
9  -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
10  41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
11function base64encode(str) {
12  var out, i, len;
13  var c1, c2, c3;
14  len = str.length;
15  i = 0;
16  out = "";
17  while(i < len) {
18 c1 = str.charCodeAt(i++) & 0xff;
19 if(i == len)
20 {
21   out += base64EncodeChars.charAt(c1 >> 2);
22   out += base64EncodeChars.charAt((c1 & 0x3) << 4);
23   out += "==";
24   break;
25 }
26 c2 = str.charCodeAt(i++);
27 if(i == len)
28 {
29   out += base64EncodeChars.charAt(c1 >> 2);
30   out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
31   out += base64EncodeChars.charAt((c2 & 0xF) << 2);
32   out += "=";
33   break;
34 }
35 c3 = str.charCodeAt(i++);
36 out += base64EncodeChars.charAt(c1 >> 2);
37 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
38 out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
39 out += base64EncodeChars.charAt(c3 & 0x3F);
40  }
41  return out;
42}
43function base64decode(str) {
44  var c1, c2, c3, c4;
45  var i, len, out;
46  len = str.length;
47  i = 0;
48  out = "";
49  while(i < len) {
50 
51 do {
52   c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
53 } while(i < len && c1 == -1);
54 if(c1 == -1)
55   break;
56 
57 do {
58   c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
59 } while(i < len && c2 == -1);
60 if(c2 == -1)
61   break;
62 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
63 
64 do {
65   c3 = str.charCodeAt(i++) & 0xff;
66   if(c3 == 61)
67 return out;
68   c3 = base64DecodeChars[c3];
69 } while(i < len && c3 == -1);
70 if(c3 == -1)
71   break;
72 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
73 
74 do {
75   c4 = str.charCodeAt(i++) & 0xff;
76   if(c4 == 61)
77 return out;
78   c4 = base64DecodeChars[c4];
79 } while(i < len && c4 == -1);
80 if(c4 == -1)
81   break;
82 out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
83  }
84  return out;
85}
86function utf16to8(str) {
87  var out, i, len, c;
88  out = "";
89  len = str.length;
90  for(i = 0; i < len; i++) {
91 c = str.charCodeAt(i);
92 if ((c >= 0x0001) && (c <= 0x007F)) {
93   out += str.charAt(i);
94 } else if (c > 0x07FF) {
95   out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
96   out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
97   out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
98 } else {
99   out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
100   out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
101 }
102  }
103  return out;
104}
105function utf8to16(str) {
106  var out, i, len, c;
107  var char2, char3;
108  out = "";
109  len = str.length;
110  i = 0;
111  while(i < len) {
112 c = str.charCodeAt(i++);
113 switch(c >> 4)
114 {
115  case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
116   // 0xxxxxxx
117   out += str.charAt(i-1);
118   break;
119  case 12: case 13:
120   // 110x xxxx  10xx xxxx
121   char2 = str.charCodeAt(i++);
122   out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
123   break;
124  case 14:
125   // 1110 xxxx 10xx xxxx 10xx xxxx
126   char2 = str.charCodeAt(i++);
127   char3 = str.charCodeAt(i++);
128   out += String.fromCharCode(((c & 0x0F) << 12) |
129    ((char2 & 0x3F) << 6) |
130    ((char3 & 0x3F) << 0));
131   break;
132 }
133  }
134  return out;
135}
136function doit() {
137  var f = document.f
138  f.output.value = base64encode(utf16to8(f.source.value))
139  //f.decode.value = utf8to16(base64decode(f.output.value))
140}
141function toDoit() {
142  var f = document.f
143  //f.output.value = base64encode(utf16to8(f.source.value))
144  f.decode.value = utf8to16(base64decode(f.output.value))
145}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.