MCPcopy Create free account
hub / github.com/NobyDa/Script / letterEncode

Function letterEncode

TestFlight/TestFlightAccount.js:280–293  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

278
279// private encode method, based on variant in RFC4648
280function letterEncode(e) {
281 e = e.split("").map(e => e.charCodeAt());
282 const t = new Uint8Array(4 * Math.ceil(8 * e.length / 4));
283 let n = 0;
284 for (const o of e) {
285 let e = 128;
286 for (let r = 0; r < 8; r++) t[n++] = o & e ? 1 : 0, e >>= 1
287 }
288 let o = "",
289 r = 0;
290 return t.forEach((e, t) => {
291 r = r << 1 | e, (t + 1) % 4 == 0 && (o += "XKNWSPRMCTGZVDHF"[r], r = 0)
292 }), o
293}
294
295function letterDecode(e) {
296 const t = new Uint8Array(4 * e.length);

Callers 2

QueryRequestFunction · 0.85
ShareAccountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected