MCPcopy Create free account
hub / github.com/0xJs/RedTeaming_CheatSheet / xor

Function xor

coding/projects/Encoding_Encryption/Xor/xorencrypt.py:7–18  ·  view source on GitHub ↗
(data, key)

Source from the content-addressed store, hash-verified

5KEY = "<KEY>"
6
7def xor(data, key):
8
9 key = str(key)
10 l = len(key)
11 output_str = ""
12
13 for i in range(len(data)):
14 current = data[i]
15 current_key = key[i % len(key)]
16 output_str += chr(ord(current) ^ ord(current_key))
17
18 return output_str
19
20def printCiphertext(ciphertext):
21 print('{ 0x' + ', 0x'.join(hex(ord(x))[2:] for x in ciphertext) + ' };')

Callers 1

xorencrypt.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected