def findKey(split): bestMg = 0.0 bestKey = 0 for i in range(256): mg, plain = tryKey(rawToHex(split), rawToHexLUT[i]) if (mg > bestMg): bestMg = mg bestKey = i return chr(bestKey)
def findKey(split): bestMg = 0.0; bestKey = 0; for i in range(256): mg, plain = tryKey(rawToHex(split), rawToHexLUT[i]); if (mg > bestMg): bestMg = mg; bestKey = i; return chr(bestKey);
def findSingleCharXOR(ciphers): for cip in ciphers: for i in range(256): mg, plain = tryKey(cip, rawToHexLUT[i]); if (mg > .050): print("potential key: 0x" + rawToHexLUT[i]); print("potential hex(cipher): " + str(cip).lstrip("b'").rstrip("'")); print("potential hex(plain): " + str(plain).lstrip("b'").rstrip("'")); print("potential plaintext: " + str(hexToRaw(str(plain).lstrip("b'").rstrip("'"))).lstrip("b'").rstrip("'"));
def findSingleCharXOR(ciphers): for cip in ciphers: for i in range(256): mg, plain = tryKey(cip, rawToHexLUT[i]) if (mg > .050): print("potential key: 0x" + rawToHexLUT[i]) print("potential hex(cipher): " + str(cip).lstrip("b'").rstrip("'")) print("potential hex(plain): " + str(plain).lstrip("b'").rstrip("'")) print("potential plaintext: " + str(hexToRaw(str(plain).lstrip("b'").rstrip( "'"))).lstrip("b'").rstrip("'"))