def o(): global t, x, a, m, g, l, w for y in range(8): if m: g[y] = c32(g[y] ^ w[y]).value else: g[y] = c32(g[y] ^ l[t + y]).value z = j(g) for y in range(8): l[x + y] = c32(z[y] ^ w[y]).value w[y] = g[y] t = x x += 8 a = 0 m = False
def encode(C): z = d.PADCHAR E = d.ALPHA D = d.getbyte y = [] C = '' + C A = len(C) - len(C) % 3 if len(C) == 0: return C for B in range(0, A, 3): F = c32((c32(D(C, B) << 16).value) | (c32(D(C, B + 1) << 8).value) | D(C, B + 2)).value y.append(E[F >> 18]) y.append(E[(F >> 12) & 63]) y.append(E[(F >> 6) & 63]) y.append(E[F & 63]) B += 3 if len(C) - A == 1: F = c32(D(C, B) << 16).value y.append(E[F >> 18] + E[(F >> 12) & 63] + z + z) elif len(C) - A == 2: F = c32((c32(D(C, B) << 16).value) | (c32(D(C, B + 1) << 8).value)).value y.append(E[F >> 18] + E[(F >> 12) & 63] + E[(F >> 6) & 63] + z) return ''.join(y)
def i(B, C, y): if not y or y > 4: y = 4 z = 0 for A in range(C, C + y): z = c32(z << 8).value z = z | B[A] return (z & 4294967295) >> 0
def j(A): B = 16 G = i(A, 0, 4) F = i(A, 4, 4) I = i(r, 0, 4) H = i(r, 4, 4) E = i(r, 8, 4) D = i(r, 12, 4) C = 0 J = 2654435769 >> 0 while B > 0: C += J C = (C & 4294967295) >> 0 G += c32((c32(F << 4).value + I) ^ (F + C) ^ ((F >> 5) + H)).value G = (G & 4294967295) >> 0 F += c32((c32(G << 4).value + E) ^ (G + C) ^ ((G >> 5) + D)).value F = (F & 4294967295) >> 0 B -= 1 K = bytearray(8) b(K, 0, G) b(K, 4, F) return K