MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / b64Encode

Function b64Encode

media_platform/xhs/help.py:215–232  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

213
214
215def b64Encode(e):
216 P = len(e)
217 W = P % 3
218 U = []
219 z = 16383
220 H = 0
221 Z = P - W
222 while H < Z:
223 U.append(encodeChunk(e, H, Z if H + z > Z else H + z))
224 H += z
225 if 1 == W:
226 F = e[P - 1]
227 U.append(lookup[F >> 2] + lookup[(F << 4) & 63] + "==")
228 elif 2 == W:
229 F = (e[P - 2] << 8) + e[P - 1]
230 U.append(lookup[F >> 10] + lookup[63 & (F >> 4)] +
231 lookup[(F << 2) & 63] + "=")
232 return "".join(U)
233
234
235def encodeUtf8(e):

Callers 1

signFunction · 0.85

Calls 1

encodeChunkFunction · 0.85

Tested by

no test coverage detected