MCPcopy
hub / github.com/CreditTone/hooker / bytesToBase64

Function bytesToBase64

js/hook_encryption_algo.js:156–179  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

154 return str;
155}
156function bytesToBase64(e) {
157 var r, a, c, h, o, t;
158 for (c = e.length, a = 0, r = ''; a < c;) {
159 if (h = 255 & e[a++], a == c) {
160 r += base64EncodeChars.charAt(h >> 2),
161 r += base64EncodeChars.charAt((3 & h) << 4),
162 r += '==';
163 break
164 }
165 if (o = e[a++], a == c) {
166 r += base64EncodeChars.charAt(h >> 2),
167 r += base64EncodeChars.charAt((3 & h) << 4 | (240 & o) >> 4),
168 r += base64EncodeChars.charAt((15 & o) << 2),
169 r += '=';
170 break
171 }
172 t = e[a++],
173 r += base64EncodeChars.charAt(h >> 2),
174 r += base64EncodeChars.charAt((3 & h) << 4 | (240 & o) >> 4),
175 r += base64EncodeChars.charAt((15 & o) << 2 | (192 & t) >> 6),
176 r += base64EncodeChars.charAt(63 & t)
177 }
178 return r
179}
180function base64ToBytes(e) {
181 var r, a, c, h, o, t, d;
182 for (t = e.length, o = 0, d = []; o < t;) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected