def create_xoring_pattern(block_size, byte_value_and_count, guess, a_string): padding_numerical = [0] * (block_size - byte_value_and_count) padding_numerical = padding_numerical + [byte_value_and_count^guess] padding_numerical = padding_numerical + [byte_value_and_count] * (byte_value_and_count - 1) padding = "".join(chr(x) for x in padding_numerical) return strxor(padding, a_string)
def create_xoring_pattern(block_size, byte_value_and_count, guess, a_string): logger.debug("Create_xoring_pattern called with a_string: %s" % a_string.encode("hex")) padding_numerical = [0] * (block_size - byte_value_and_count) padding_numerical = padding_numerical + [byte_value_and_count^guess] padding_numerical = padding_numerical + [byte_value_and_count] * (byte_value_and_count - 1) padding = "".join(chr(x) for x in padding_numerical) return strxor(padding, a_string)
def create_request(prepending, block_to_try, raw_xoring_pattern): return "".join([strxor(prepending, raw_xoring_pattern), block_to_try]).encode("hex")
def create_request(blocks, which, raw_xoring_pattern): prepending = blocks[which - 1] block_to_try = blocks[which] return "".join(blocks[0:which-1] + [strxor(prepending, raw_xoring_pattern), block_to_try]).encode("hex")