def cycle_xor(hex_string):
    byte_string = ct.hex_to_bytes(hex_string)
    found_match = False
    dictionary = ct.load_dictionary()
    for _ in range(256):
        xored = bytes(b ^ _ for b in list(byte_string))
        if ct.is_language(''.join([chr(b) for b in xored]), dictionary):
            print('Key: {}, ASCII: {}'.format(_, repr(xored)))
            found_match = True
    if not found_match:
        print('Unable to find match.')
Example #2
0
def cycle_xor(hex_string):
    byte_string = ct.hex_to_bytes(hex_string)
    found_match = False
    dictionary = ct.load_dictionary()
    for _ in range(256):
        xored = bytes(b ^ _ for b in list(byte_string))
        if ct.is_language(''.join([chr(b) for b in xored]), dictionary):
            print('Key: {}, ASCII: {}'.format(_, repr(xored)))
            found_match = True
    if not found_match:
        print('Unable to find match.')
def cycle_xor(hex_string):
    byte_string = ct.hex_to_bytes(hex_string)
    found_match = False
    dictionary = ct.load_dictionary()
    for _ in range(256):
        xored = bytes(b ^ _ for b in list(byte_string))
        if ct.is_language(''.join([chr(b) for b in xored]), dictionary):
            print('Hex String: {} \nKey: "{}" \nASCII: {}'.format(hex_string, chr(_), xored.decode()))
            found_match = True
    if not found_match:
        # I had this print out each line in the loaded .txt, but that made output messy. Now passing.
        pass
Example #4
0
def cycle_xor(hex_string):
    byte_string = ct.hex_to_bytes(hex_string)
    found_match = False
    dictionary = ct.load_dictionary()
    for _ in range(256):
        xored = bytes(b ^ _ for b in list(byte_string))
        if ct.is_language(''.join([chr(b) for b in xored]), dictionary):
            print('Hex String: {} \nKey: "{}" \nASCII: {}'.format(
                hex_string, chr(_), xored.decode()))
            found_match = True
    if not found_match:
        # I had this print out each line in the loaded .txt, but that made output messy. Now passing.
        pass
def hex_to_base64(hex_str):
    b = ct.hex_to_bytes(hex_str)
    return ct.bytes_to_base64(b)
def xor_hexes(hex_one, hex_two):
    bytes_one = ct.hex_to_bytes(hex_one)
    bytes_two = ct.hex_to_bytes(hex_two)
    xored_bytes = ct.bytes_xor(bytes_one, bytes_two)
    return ct.bytes_to_hex(xored_bytes)
Example #7
0
def hex_to_base64(hex_str):
    b = ct.hex_to_bytes(hex_str)
    return ct.bytes_to_base64(b)