Skip to content

Instantly share code, notes, and snippets.

@back-seat-driver
Last active July 28, 2017 00:04
Show Gist options
  • Save back-seat-driver/46bd5e89bb5e95a4e3e5824892a9e36c to your computer and use it in GitHub Desktop.
Save back-seat-driver/46bd5e89bb5e95a4e3e5824892a9e36c to your computer and use it in GitHub Desktop.
Differential Testing Dump
####TESTING######
'''
CRYPTO PROOFS
'''
'''
def SUB_PROOF(sub_set,theta_input):
#This function is checking if each index location contained in subset is either
#a set of 1's or 0's in theta's input.
to_check=[]
for i in range(len(sub_set)):
to_check.append(theta_input[sub_set[i]])
if len(list(set(to_check)))!=1:
return(False)
return(True)
def SUB_DELTA_PROOF(sub_set,theta_input):
#This function is checking if each index location contained in subset is either
#a set of 1's or 0's in theta's input.
to_check=[]
for i in range(len(sub_set)):
to_check.append(theta_input[sub_set[i]])
if len(list(set(to_check)))!=2:
return(False)
return(True)
def PROOF_FUNCTION(theta_input_concat,reduction_check):
#This function shows that all theta index values contained in the sub sets of
#reduction check contain the same value. So based on an output of theta we can
#prove that there are sets of indexs in theta's input that must be the same. While
#this is not a pure inversion/mapping of theta is does reduce the difficulty of
#attempting a mapping.
for i in range(len(reduction_check)):
if SUB_PROOF(reduction_check[i],theta_input_concat)==False:
return(False)
return(True)
def PROOF_DELTA_FUNCTION(theta_input_concat,reduction_check):
#This function shows that all theta index values contained in the sub sets of
#reduction check contain the same value. So based on an output of theta we can
#prove that there are sets of indexs in theta's input that must be the same. While
#this is not a pure inversion/mapping of theta is does reduce the difficulty of
#attempting a mapping.
for i in range(len(reduction_check)):
if SUB_DELTA_PROOF(reduction_check[i],theta_input_concat)==False:
return(False)
return(True)
def PROOF_TEST(col):
#You will need numpy to run this and will clearly have to break the loop yourself.
while 1==1:
a_input=set_main_build(64,25)
a_input_concat=str_concat(a_input)
theta_out_put=theta(a_input)
theta_out_put_column=COLUMN_PULL(col,theta_out_put)
reduction_check=TRUE_CRYPTO_MULTI_REDUCTION(col,theta_out_put_column)
print(PROOF_FUNCTION(a_input_concat,reduction_check))
def PROOF_DELTA_TEST(col):
#You will need numpy to run this and will clearly have to break the loop yourself.
while 1==1:
a_input=set_main_build(64,25)
a_input_concat=str_concat(a_input)
theta_out_put=theta(a_input)
theta_out_put_column=COLUMN_PULL(col,theta_out_put)
reduction_check=TRUE_CRYPTO_DELTA_REDUCTION(col,theta_out_put_column)
print(PROOF_DELTA_FUNCTION(a_input_concat,reduction_check))
'''
set_main_build(64,25)
##True shift is the actual vertical index shift values of theta and represents what
##is the indistinguishable obfuscation characteristic of theta() in SHA-3/Keccak.
##In that python returns horizontal set representations while vertical set columns
##provide actual execution commands. With a left or right shift bridging the set
##values, depending on the derivation direction.
true_shift =['01010101010','00101010101','00101010101','00101010101','10010101010',
'10010101010','01001010101','01001010101','01001010101','10100101010',
'10100101010','01010010101','01010010101','01010010101','10101001010',
'10101001010','01010100101','01010100101','01010100101','10101010010',
'10101010010','01010101001','01010101001','01010101001','10101010100']
true_col=[
[0, 1, 4, 6, 9, 11, 14, 16, 19, 21, 24],
[0, 1, 2, 5, 7, 10, 12, 15, 17, 20, 22],
[1, 2, 3, 6, 8, 11, 13, 16, 18, 21, 23],
[2, 3, 4, 7, 9, 12, 14, 17, 19, 22, 24],
[0, 3, 4, 5, 8, 10, 13, 15, 18, 20, 23],
[1, 4, 5, 6, 9, 11, 14, 16, 19, 21, 24],
[0, 2, 5, 6, 7, 10, 12, 15, 17, 20, 22],
[1, 3, 6, 7, 8, 11, 13, 16, 18, 21, 23],
[2, 4, 7, 8, 9, 12, 14, 17, 19, 22, 24],
[0, 3, 5, 8, 9, 10, 13, 15, 18, 20, 23],
[1, 4, 6, 9, 10, 11, 14, 16, 19, 21, 24],
[0, 2, 5, 7, 10, 11, 12, 15, 17, 20, 22],
[1, 3, 6, 8, 11, 12, 13, 16, 18, 21, 23],
[2, 4, 7, 9, 12, 13, 14, 17, 19, 22, 24],
[0, 3, 5, 8, 10, 13, 14, 15, 18, 20, 23],
[1, 4, 6, 9, 11, 14, 15, 16, 19, 21, 24],
[0, 2, 5, 7, 10, 12, 15, 16, 17, 20, 22],
[1, 3, 6, 8, 11, 13, 16, 17, 18, 21, 23],
[2, 4, 7, 9, 12, 14, 17, 18, 19, 22, 24],
[0, 3, 5, 8, 10, 13, 15, 18, 19, 20, 23],
[1, 4, 6, 9, 11, 14, 16, 19, 20, 21, 24],
[0, 2, 5, 7, 10, 12, 15, 17, 20, 21, 22],
[1, 3, 6, 8, 11, 13, 16, 18, 21, 22, 23],
[2, 4, 7, 9, 12, 14, 17, 19, 22, 23, 24],
[0, 3, 5, 8, 10, 13, 15, 18, 20, 23, 24]
]
def data_shift(a_list):
#Shifts all values in a list by a single values, should investigated
#using the built in lamda function.
to_return=[]
for i in range(len(a_list)):
to_return.append(a_list[i]-1)
return(to_return)
def xor_seq(bit_str):
#Just XOR's a bit string sequence very simple
init='0'
for i in range(len(bit_str)):
init=xor_bit(init,bit_str[i])
return(init)
def index_to_choose(col):
#Returns the possible indexes of choices for an output col.
#This really takes into account the left circular rotations,
#and returns two columns of index values, given a single column
#input values.
true_data=L_P(range(1600),64)
to_return=[]
for i in range(len(true_data)):
to_return.append([true_data[i][col],true_data[i][col+1]])
return(to_return)
def col_X_pull(col):
#25 col values given particular index inputs,
#ie index 0 contains XOR of the following input string indexes
#[0, 65, 256, 385, 576, 705, 896, 1025, 1216, 1345, 1536]
to_pull=index_to_choose(col)
to_return=[]
for i in range(25):
for x in range(len(true_col)):
if i==x:
insert=[]
for z in range(len(true_col[x])):
if true_shift[x][z]=='0':
insert.append(to_pull[true_col[x][z]][0])
if true_shift[x][z]=='1':
insert.append(to_pull[true_col[x][z]][1])
to_return.append(insert)
return(to_return)
def seq_build_index(whole_bit_str,index_set):
#So provided with a set of bit strings, ie x=['0110','101','1010']
#it will return a single bit representing the XOR of x[i]'s
#sequence and is used in theta_col_return. Need this function.
to_return=''
for i in range(len(index_set)):
to_return+=whole_bit_str[index_set[i]]
return(to_return)
def theta_col_return(col,theta_input):
#Provided with a theta input and col this function will build
#the correct output col of theta. This is an important function
#and should be used for theta building.
index_set=col_X_pull(col)
bit_set=''
for i in range(len(index_set)):
bit_set+=(xor_seq(seq_build_index(theta_input,index_set[i])))
return(bit_set)
def good_test(col):
#Just a proof of concept function and has no return value to be passed to
#functions. Should only be read by a human.
input_main=set_main_build(64,25)
input_main_concat=str_concat(input_main)
theta_output=theta(input_main)
theta_output_col=theta_col_return(col,input_main_concat)
for i in range(len(theta_output)):
if theta_output[i][col]==theta_output_col[i]:
print(theta_output[i][col],theta_output_col[i],True)
if theta_output[i][col]!=theta_output_col[i]:
print(theta_output[i][col],theta_output_col[i],False)
###JUMP TEST#####
def is_in_truth(value,a_set):
#Will search through a_set looking to see if value is contained in that set
#and returns true if the values is in the set and returns false if the value
#is not in the set.
for i in range(len(a_set)):
if value==a_set[i]:
return(True)
return(False)
def diff_one(value_0,value_1):
#Takes two lists and returns true if the lists contain only one
#difference in the values they contain.
d=0
for i in range(len(value_0)):
c=0
for x in range(len(value_1)):
if value_0[i]==value_1[x]:
c+=1
if c!=0:
d+=1
if len(value_0)-1==d:
return(True)
return(False)
def one_return(set_0,set_1):
#Takes two lists and returns the two values that represent the difference
#by one, or the single unique value contained in each set. Edited to fix
for i in range(len(set_0)):
if is_in_truth(set_0[i],set_1)==False:
break
for x in range(len(set_1)):
if is_in_truth(set_1[x],set_0)==False:
break
return(set_0[i],set_1[x])
'''
to_return=[]
for i in range(len(theta_index_data)):
for x in range(len(theta_index_data)):
if diff_one(theta_index_data[i],theta_index_data[x])==True:
to_return.append([(i,x),one_return(theta_index_data[i],theta_index_data[x])])
'''
def init_theta_set(col):
#Provides the unique index values contained in the column sequence sets,
#It's functionally the same as the function index_to_choose(col). TMK
col=0
to_build=[]
to_hold=col_X_pull(col)
for i in range(len(to_hold)):
to_build+=to_hold[i]
to_build=sorted(list(set(to_build)))
return(to_build)
def set_array(col):
#FUNCTION NOT USEFUL YET (IMPORTANT)
to_return=[]
to_build=col_X_pull(col)
for i in range(len(to_build)):
insert=[]
for x in range(len(to_build[i])):
insert.append(['0',to_build[i][x]])
to_return.append(insert)
return(to_return)
def col_push_value(col,value_set):
#FUNCTION NOT USEFUL YET
to_iter=set_array(col)
for i in range(len(value_set)):
for x in range(len(to_iter)):
for z in range(len(to_iter[x])):
if to_iter[x][z][-1]==value_set[i]:
to_iter[x][z][0]='1'
return(to_iter)
def allocated(col,value_set):
#FUNCTION NOT USEFUL YET
to_iter=col_X_pull(col)
for c in range(len(value_set)):
for i in range(len(to_iter)):
for x in range(len(to_iter[i])):
if value_set[c]==to_iter[i][x]:
to_iter[i][x]='*'
return(to_iter)
def hit_return(set_0,set_1):
#This is the fucntion that retuns the index values from the two sets
#searhced in col_X_pull(col) and returns the two different values in the lists
#0 [0, 65, 256, 385, 576, 705, 896, 1025, 1216, 1345, 1536]
to_return=[]
for i in range(len(set_0)):
insert=[]
if is_in_truth(set_0[i],set_1)==False:
insert.append(set_0[i])
if is_in_truth(set_1[i],set_0)==False:
insert.append(set_1[i])
to_return.append(insert)
return(to_return)
def data_extract(a_list):
#Fillters out empty lists from a_list
to_return=[]
for i in range(len(a_list)):
if a_list[i]!=[]:
to_return.append(a_list[i][0])
return(to_return)
def set_total_extract(nested_list):
#This function is used in the data structure building process of COL_HIT, no
#math is executed using this function.
to_return=[]
for i in range(len(nested_list)):
insert=[]
for x in range(len(nested_list[i])):
insert.append([nested_list[i][x][0],
nested_list[i][x][2],
data_extract(nested_list[i][x][-1])])
to_return.append(insert)
return(to_return)
def COL_HIT(col):
#Takes a column value and returns the indexs that are potential targets
#to apply index reduction via diff_one crypt analys
to_check=col_X_pull(col)
to_build=[]
for i in range(len(to_check)):
insert=[]
for x in range(len(to_check)):
if diff_one(to_check[i],to_check[x])==True:
insert.append([i, to_check[i], x, to_check[x], hit_return(to_check[i],to_check[x])])
to_build.append(insert)
return(set_total_extract(to_build))
def DATA_ANALYZE(col):
#Used for data visulization and has no object to pass to other function.
#only for human used. Useful though.
to_check=col_X_pull(col)
to_build=[]
for i in range(len(to_check)):
insert=[]
for x in range(len(to_check)):
if diff_one(to_check[i],to_check[x])==True:
insert.append([i,to_check[i],x,to_check[x],hit_return(to_check[i],to_check[x])])
to_build.append(insert)
for i in range(len(to_build)):
for x in range(len(to_build[i])):
print(to_build[i][x])
print('break')
def DIFF_CRYPTO(set_list,a_string):
#Where a_string is a potential column output of theta, and set_list is
#the structured output of COL_HIT(col), where col is the column of intrest
to_return=[]
for i in range(len(set_list)):
insert=[]
for x in range(len(set_list[i])):
if a_string[set_list[i][x][0]]==a_string[set_list[i][x][1]]:
insert.append(set_list[i][x][-1])
if a_string[set_list[i][x][0]]!=a_string[set_list[i][x][1]]:
insert.append(False)
to_return.append(insert)
return(to_return)
def DIFF_CRYPTO_DELTA(set_list,a_string):
#Where a string is a potentail column output of theta(), and set_list is
#the structed output of COL_HIT(col), where col is the column is intrest
#the idea is that this function returns set locations that must be different.
#It is a much more simple reduction step, and should imply a funtional reduction
#of 1/2.
to_return=[]
for i in range(len(set_list)):
insert=[]
for x in range(len(set_list[i])):
if a_string[set_list[i][x][0]]!=a_string[set_list[i][x][1]]:
insert.append(sorted(set_list[i][x][-1]))
to_return.append(insert)
to_return=U_V(list_concat(to_return))
return(to_return)
def only_if_not(value,a_set):
#Function will only append value into a_set if that values
#is not already present in that set
if is_in_truth(value,a_set)==False:
return(a_set.append(value))
return(None)
def FIRST_MAPPING(col,str_col):
#Function will pull an input from function DIFF_CRYPTO_ANALYZE(col,a_string)
#Where col is the column of intrest and a_string is a column output of theta()
#With the function mapping from mod_64 to != value mapping
to_return=[]
col_index_push=mod_64(col)
nested_list=DIFF_CRYPTO(COL_HIT(col),str_col)
for i in range(len(nested_list)):
insert=[]
for x in range(len(nested_list[i])):
if nested_list[i][x]!=False:
if nested_list[i][x][0]==col_index_push[i]:
insert.append(nested_list[i][x][1])
if nested_list[i][x][0]!=col_index_push[i]:
insert.append(nested_list[i][x][0])
to_return.append(insert)
return(to_return)
def MAPPING_FILTER(col,first_mapping_return):
#This is to filter empty sets from FIRST_MAPPING(col,str_col) and links values
#with the appripriate mod_64 column.
to_return=[]
col_index_push=mod_64(col)
for i in range(len(first_mapping_return)):
if first_mapping_return[i]!=[]:
to_return.append([col_index_push[i]]+first_mapping_return[i])
return(to_return)
def COLUMN_PULL(column,theta_thruput):
#Funtion just pulls a column from some theta input or output
to_return=''
for i in range(len(theta_thruput)):
for x in range(len(theta_thruput[i])):
if x==column:
to_return+=theta_thruput[i][x]
break
return(to_return)
def TRUE_CRYPTO_MULTI_REDUCTION(col,str_col):
#Function will return the sets that must contain the same values based
#on a column of intrest and a particular column ouput of theta.
return(CRYPTO_REDUCTION(MAPPING_FILTER(col,FIRST_MAPPING(col,str_col))))
def TRUE_CRYPTO_DELTA_REDUCTION(col,str_col):
#Function will return the sets that must contain the same values based
#on a column of intrest and a particular column output if theta
return(DIFF_CRYPTO_DELTA(COL_HIT(col),str_col))
'''
REFERENCE INSERT CRYPTO PROOFS AT THIS LOCATION
'''
def NONE_INVERT(crypto_array_output):
#Filters for none and inverts the bit paired with the none value
to_return=[]
for i in range(len(crypto_array_output)):
if crypto_array_output[i][0]==None or crypto_array_output[i][1]==None:
if crypto_array_output[i][0]==None:
to_return.append([not_str(crypto_array_output[i][1]),
crypto_array_output[i][1]])
if crypto_array_output[i][1]==None:
to_return.append([crypto_array_output[i][0],
not_str(crypto_array_output[i][0])])
else:
to_return.append([crypto_array_output[i][0],crypto_array_output[i][1]])
return(to_return)
def CRYPTO_ARRAY(delta_crypto,multi_crypto,crypto_bit_string):
#This function is designed to build the array based on the length of multi
#crypto, so take 2^len(multi_crypto) provides the brute force base to
#iterate over, these bit strings are then expanded to delta crypto.
#There is an optimization take that can take place here but will not be
#complete as this method is still in it's derivation stage. A None invert
#function needs to be completed next, before a theta() confirmation can
#take place.
to_return=[]
for i in range(len(delta_crypto)):
insert=[]
for x in range(len(delta_crypto[i])):
to_check=[]
for y in range(len(multi_crypto)):
for z in range(len(multi_crypto[y])):
if delta_crypto[i][x]==multi_crypto[y][z]:
insert.append(crypto_bit_string[y])
to_check.append(None)
if to_check==[]:
insert.append(None)
to_return.append(insert)
return(NONE_INVERT(to_return))
def THETA_INDEX_EXTRACT_ONE(delta_crypto,multi_crypto,crypto_bit_string):
#Takes a potential bit string
to_return=[]
for i in range(len(crypto_bit_string)):
if crypto_bit_string[i]=='1':
to_return+=multi_crypto[i]
crypto_array=CRYPTO_ARRAY(delta_crypto,multi_crypto,crypto_bit_string)
for i in range(len(crypto_array)):
for x in range(len(crypto_array[i])):
if crypto_array[i][x]=='1':
to_return.append(delta_crypto[i][x])
return(U_V(to_return))
def THETA_INDEX_EXTRACT_ZERO(delta_crypto,multi_crypto,crypto_bit_string):
#Takes a potential bit string
to_return=[]
for i in range(len(crypto_bit_string)):
if crypto_bit_string[i]=='0':
to_return+=multi_crypto[i]
crypto_array=CRYPTO_ARRAY(delta_crypto,multi_crypto,crypto_bit_string)
for i in range(len(crypto_array)):
for x in range(len(crypto_array[i])):
if crypto_array[i][x]=='0':
to_return.append(delta_crypto[i][x])
return(U_V(to_return))
def THETA_COLUMN_INVERT_INDEX(theta_output_column,column):
#This function takes a particular output column from theta and returns
#the index values of where theta's input needs to be '1' to produce that output
#in theta(), note that this does effect two columns in theta's true output, but
#does accurately invert the column of intrest. It's the first accurate abstraction
delta_reduction=TRUE_CRYPTO_DELTA_REDUCTION(column,theta_output_column)
multi_reduction=TRUE_CRYPTO_MULTI_REDUCTION(column,theta_output_column)
to_iter=2**len(multi_reduction)
for i in range(to_iter):
bit_string=bin_n_bit(i,str(len(multi_reduction)))
to_pass_theta=COLUMN_PULL(column,theta(theta_push_value_col(THETA_INDEX_EXTRACT_ONE(delta_reduction,multi_reduction,bit_string))))
if to_pass_theta==theta_output_column:
return(THETA_INDEX_EXTRACT_ONE(delta_reduction,multi_reduction,bit_string),
THETA_INDEX_EXTRACT_ZERO(delta_reduction,multi_reduction,bit_string))
def SECONDARY_LINK(multi_return,delta):
to_return=[]
for i in range(len(multi_return)):
insert=[]
search_set=U_V(list_concat(multi_return[i]))
for x in range(len(delta)):
a_delta=U_V(list_concat(delta[x]))
for z in range(len(a_delta)):
if is_in_truth(a_delta[z],search_set)==True:
insert.append(delta[x])
to_return.append(insert)
return(to_return)
hhh=SECONDARY_LINK(xxx,iii)
def MULTI_CONFRIM(a_set,ip):
#Used to a primary crypto proof for multi set, delta will be slightly
#harder to confim
str_con=str_concat(ip)
for i in range(len(a_set)):
a_str=''
for x in range(len(a_set[i])):
a_str+=str_con[a_set[i][x]]
if len(list(set(a_str)))==1:
print(True)
def DELTA_CONFRIM(a_set,ip):
str_con=str_concat(ip)
for i in range(len(a_set)):
for x in range(len(a_set[i])):
if str_con[a_set[i][x][0]]!=str_con[a_set[i][x][1]]:
print(True)
def CRYPTO_LINK(multi,delta):
#Function is depricated
to_return=[]
for i in range(len(delta)):
insert=[]
search_set=U_V(list_concat(delta[i]))
for x in range(len(multi)):
for z in range(len(multi[x])):
if is_in_truth(multi[x][z],search_set)==True:
insert.append(multi[x])
to_return.append(U_V(insert))
return(to_return)
##'''
##Tinker
##'''
##theta_output_column='1101101010011101000100010'
##column=3
##insert=theta_push_value_col(THETA_COLUMN_INVERT_INDEX(theta_output_column,column)[0])
##to_print(insert)
##print('b')
##to_print(theta(insert))
##'''
##Tinker
##'''
##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##value='1'
##delta_set=[[0, 960], [0, 1280], [320, 960], [640, 960], [320, 1280], [640, 1280]]
##def WORM(value,delta_set):
## delta_set=INIT_REG(delta_set,value)
## to_pass=TYPE_INT(delta_set)
## while TYPE_CON(delta_set)==False:
## delta_set=ALLOCATION(delta_set,to_pass)
## to_pass=TYPE_INT(delta_set)
## return(delta_set)
##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##def a_test():
##to_hold=THETA_BREAKER(op)
####to_hold=THETA_BREAKER(set_main_build(64,25))
##xxx_0=to_hold[0]
##xxx_1=to_hold[1]
##MULTI=CRYPTO_REDUCTION_SECONDARY(CRYPTO_REDUCTION(xxx_0,True,direction),direction)
##DELTA=CRYPTO_DELTA_Ry=THETA_NODES(op,0,0)EDUCTION(CRYPTO_REDUCTION(xxx_1,None,direction),None,direction)
####xxx=CRYPTO_LINK(MULTI,DELTA)
##
##
##coi=0
##search_values=mod_64(coi)+mod_64(coi+1)
##ttt=NODE_GRAB(sorted(MULTI_COUNT(MULTI,coi)))
##vvv=NODE_GRAB(sorted(DELTA_COUNT(DELTA,coi)))
##total=sorted(U_V(list_concat(ttt)+list_concat(list_concat(vvv))))
##print(COUNT_HIT(search_values,total))
##to_print(ttt)
##to_print(vvv)
##
##direction=0
##to_test_0=COL_SUB_SPLIT(col0,0)
##to_test_1=COL_SUB_SPLIT(col1,1)
##link=[]
##for i in range(len(to_test_0)):
## insert=[]
## for x in range(len(to_test_1)):
## if to_test_0[i][1]==to_test_1[x][0]:
## insert.append([i,x])
## link.append(insert)
##def compliment_test(set_0,set_1):
## for i in range(len(set_0)):
## if xo(set_0[i],set_1[i])!='11111':
## return(True)
## if xo(set_0[i],set_1[i])!='00000':
## return(True)
## return(False)
##'''%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
##Have to run a data check
##'''
####for i in range(len(data)):
#### print(len(data[i]))
##
##
##to_return=[]
##for z in range(64):
## insert=[]
## for i in range(len(data[0])):
## for x in range(len(data[1])):
## if z != 63:
## if THETA_COMPARE(t_3(data[z][i]),t_3(data[z+1][x]),z+1)==True:
## insert.append(x)
## if z ==63:
## if THETA_COMPARE(t_3(data[z][i]),t_3(data[0][x]),0)==True:
## insert.append(x)
## to_return.append(sorted(U_V(insert)))
##
##split_back=to_return[-1]
##split_front=to_return[0:len(to_return)-1]
##to_iter=[split_back]+split_front
##
##to_print(to_iter)
##print('b')
##
##SECOND_RED_DATA=[]
##for i in range(len(data)):
## SECOND_RED_DATA.append(index_search(data[i],to_iter[i]))
##
##
##to_return=[]
##for z in range(64):
## insert=[]
## for i in range(len(SECOND_RED_DATA[0])):
## for x in range(len(SECOND_RED_DATA[1])):
## if z != 63:
## if THETA_COMPARE(t_3(SECOND_RED_DATA[z][i]),t_3(SECOND_RED_DATA[z+1][x]),z+1)==True:
## insert.append(x)
## if z ==63:
## if THETA_COMPARE(t_3(SECOND_RED_DATA[z][i]),t_3(SECOND_RED_DATA[0][x]),0)==True:
## insert.append(x)
## to_return.append(sorted(U_V(insert)))
##
##split_back=to_return[-1]
##split_front=to_return[0:len(to_return)-1]
##to_iter=[split_back]+split_front
##
##to_print(to_iter)
##print('b')
##
##THRID_RED_DATA=[]
##for i in range(len(data)):
## THRID_RED_DATA.append(index_search(data[i],to_iter[i]))
##
##to_return=[]
##for z in range(64):
## insert=[]
## for i in range(len(THRID_RED_DATA[0])):
## for x in range(len(THRID_RED_DATA[1])):
## if z != 63:
## if THETA_COMPARE(t_3(THRID_RED_DATA[z][i]),t_3(THRID_RED_DATA[z+1][x]),z+1)==True:
## insert.append(x)
## if z ==63:
## if THETA_COMPARE(t_3(THRID_RED_DATA[z][i]),t_3(THRID_RED_DATA[0][x]),0)==True:
## insert.append(x)
## to_return.append(sorted(U_V(insert)))
##
##split_back=to_return[-1]
##split_front=to_return[0:len(to_return)-1]
##to_iter=[split_back]+split_front
##
##to_print(to_iter)
##print('b')
##
##FOURTH_RED_DATA=[]
##for i in range(len(data)):
## FOURTH_RED_DATA.append(index_search(data[i],to_iter[i]))
##
##to_return=[]
##for z in range(64):
## insert=[]
## for i in range(len(FOURTH_RED_DATA[0])):
## for x in range(len(FOURTH_RED_DATA[1])):
## if z != 63:
## if THETA_COMPARE(t_3(FOURTH_RED_DATA[z][i]),t_3(FOURTH_RED_DATA[z+1][x]),z+1)==True:
## insert.append(x)
## if z ==63:
## if THETA_COMPARE(t_3(FOURTH_RED_DATA[z][i]),t_3(FOURTH_RED_DATA[0][x]),0)==True:
## insert.append(x)
## to_return.append(sorted(U_V(insert)))
##
##split_back=to_return[-1]
##split_front=to_return[0:len(to_return)-1]
##to_iter=[split_back]+split_front
##
##to_print(to_iter)
##print('b')
##
##FIFTH_RED_DATA=[]
##for i in range(len(data)):
## FIFTH_RED_DATA.append(index_search(data[i],to_iter[i]))
##
##to_return=[]
##for z in range(64):
## insert=[]
## for i in range(len(FIFTH_RED_DATA[0])):
## for x in range(len(FIFTH_RED_DATA[1])):
## if z != 63:
## if THETA_COMPARE(t_3(FIFTH_RED_DATA[z][i]),t_3(FIFTH_RED_DATA[z+1][x]),z+1)==True:
## insert.append(x)
## if z ==63:
## if THETA_COMPARE(t_3(FIFTH_RED_DATA[z][i]),t_3(FIFTH_RED_DATA[0][x]),0)==True:
## insert.append(x)
## to_return.append(sorted(U_V(insert)))
##
##split_back=to_return[-1]
##split_front=to_return[0:len(to_return)-1]
##to_iter=[split_back]+split_front
##
##to_print(to_iter)
##print('b')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
##while True==True:
## ip=set_main_build(64,25)
## op=theta(ip)
## print(compliment_test(list_concat(mod_5_split(t_3(ip))),
## list_concat(mod_5_split(t_3(op)))))
##to_return=MOD_5_THETA_BREAK(op,0)
##for i in range(len(to_return)):
## if THETA_COMPARE(ip,to_return[i],coi)==True and THETA_COMPARE(ip,to_return[i],coi)==True:
## print(i)
##TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
##'''
##The T set is theta invert copy pasta
##'''
def to_print(object):
for i in range(len(object)):
print(object[i])
def L_P(SET,n):
to_return=[]
j=0
k=n
while k<len(SET)+1:
to_return.append(SET[j:k])
j=k
k+=n
return(to_return)
def bin_n_bit(dec,n):
return(str(format(dec,'0'+n+'b')))
def s_l(bit_string):
bit_list=[]
for i in range(len(bit_string)):
bit_list.append(bit_string[i])
return(bit_list)
def l_s(bit_list):
bit_string=''
for i in range(len(bit_list)):
bit_string+=bit_list[i]
return(bit_string)
def rotate_left(bit_string,n):
if n==0:
return(bit_string)
bit_list = s_l(bit_string)
count=0
while count <= n-1:
list_main=list(bit_list)
var_0=list_main.pop(0)
list_main=list(list_main+[var_0])
bit_list=list(list_main)
count+=1
return(l_s(list_main))
def xo(bit_string_1,bit_string_2):
xor_list=[]
for i in range(len(bit_string_1)):
if bit_string_1[i]=='0' and bit_string_2[i]=='0':
xor_list.append('0')
if bit_string_1[i]=='1' and bit_string_2[i]=='1':
xor_list.append('0')
if bit_string_1[i]=='0' and bit_string_2[i]=='1':
xor_list.append('1')
if bit_string_1[i]=='1' and bit_string_2[i]=='0':
xor_list.append('1')
return(l_s(xor_list))
def THETA_COMPARE(t_0,t_1,col):
#Theta compare will take two possible theta through puts and returns True
#if both col's of the theta through puts are equal values. Returns
#False is the theta through puts are not the same values.
for i in range(len(t_0)):
if t_0[i][col]!=t_1[i][col]:
return(False)
return(True)
def list_concat(list_of_lists):
to_return=[]
for i in range(len(list_of_lists)):
to_return+=list_of_lists[i]
return(to_return)
def index_search(a_set,index_set):
#This function will take a set and a respective index set and
#return the index locations if a_set
to_return=[]
for i in range(len(index_set)):
to_return.append(a_set[index_set[i]])
return(to_return)
def rc_con(sub_set):
#Function to take take some set and do a row column split
to_return=[]
for i in range(len(sub_set[0])):
insert=''
for x in range(len(sub_set)):
insert+=sub_set[x][i]
to_return.append(insert)
return(to_return)
def rc_lcon(sub_set):
to_return=[]
for i in range(len(sub_set[0])):
insert=[]
for x in range(len(sub_set)):
insert+=[sub_set[x][i]]
to_return.append(insert)
return(to_return)
def str_build(a_list):
to_return=''
for i in range(len(a_list)):
to_return+=str(a_list[i])
return(to_return)
def set_main_build(size,iter_len):
import numpy
to_return=[]
for i in range(iter_len):
to_return.append(str_build(list(numpy.random.randint(2,size=(size,)))))
return(to_return)
def theta(s):
c_xz=[]
for i in range(5):
c_xz.append(xo(xo(xo(xo(s[i],s[i+5]),s[i+10]),s[i+15]),s[i+20]))
d_xz=[]
for i in range(5):
d_xz.append(xo(c_xz[(i-1)%5],rotate_left(c_xz[(i+1)%5],1)))
a_xyz=[]
for i in range(5):
a_xyz.append([xo(s[i],d_xz[i]),
xo(s[i+5],d_xz[i]),
xo(s[i+10],d_xz[i]),
xo(s[i+15],d_xz[i]),
xo(s[i+20],d_xz[i])])
a_xyz=list_concat(a_xyz)
order_return=[]
for i in range(5):
order_return.append([a_xyz[i],a_xyz[i+5],a_xyz[i+10],a_xyz[i+15],a_xyz[i+20]])
return(list_concat(order_return))
def t_3(a_xyz):
order_return=[]
for i in range(5):
order_return.append([a_xyz[i],a_xyz[i+5],a_xyz[i+10],a_xyz[i+15],a_xyz[i+20]])
return(list_concat(order_return))
def mod_5_split(theta_through_put):
#Function will take a theta throug put and will grab 5 row checks
#for processing. Once 5 rwo chucks are returned the function return
#do a row column conversion.
to_convert=L_P(theta_through_put,5)
to_return=[]
for i in range(len(to_convert)):
to_return.append(rc_con(to_convert[i]))
return(to_return)
def COI_RETURN(op,coi):
#First call to mod_5_split
if coi != 63:
to_iter=mod_5_split(t_3(op))
set_0=[]
for i in range(len(to_iter)):
set_0.append(to_iter[i][coi])
to_return_0=[]
for i in range(len(set_0)):
to_return_0.append([set_0[i],not_str(set_0[i])])
set_1=[]
for i in range(len(to_iter)):
set_1.append(to_iter[i][coi+1])
to_return_1=[]
for i in range(len(set_1)):
to_return_1.append([set_1[i],not_str(set_1[i])])
return(to_return_0,to_return_1)
if coi == 63:
to_iter=mod_5_split(t_3(op))
set_0=[]
for i in range(len(to_iter)):
set_0.append(to_iter[i][coi])
to_return_0=[]
for i in range(len(set_0)):
to_return_0.append([set_0[i],not_str(set_0[i])])
set_1=[]
for i in range(len(to_iter)):
set_1.append(to_iter[i][0])
to_return_1=[]
for i in range(len(set_1)):
to_return_1.append([set_1[i],not_str(set_1[i])])
return(to_return_0,to_return_1)
def theta_allocation_builder(str_set_0,str_set_1,coi):
#This is a lazy step to handel end point index wrapping code length could
#be reduced pointing to the index 63 for to_allocate[i][0].
if coi != 63:
to_allocate=L_P([0]*1600,64)
for i in range(len(str_set_0)):
to_allocate[i][coi]=str_set_0[i]
to_allocate[i][coi+1]=str_set_1[i]
to_return=[]
for i in range(len(to_allocate)):
insert=''
for x in range(len(to_allocate[i])):
if type(to_allocate[i][x])!=type(''):
insert+=str(to_allocate[i][x])
if type(to_allocate[i][x])==type(''):
insert+=to_allocate[i][x]
to_return.append(insert)
return(to_return)
if coi == 63:
to_allocate=L_P([0]*1600,64)
for i in range(len(str_set_0)):
to_allocate[i][coi]=str_set_0[i]
to_allocate[i][0]=str_set_1[i]
to_return=[]
for i in range(len(to_allocate)):
insert=''
for x in range(len(to_allocate[i])):
if type(to_allocate[i][x])!=type(''):
insert+=str(to_allocate[i][x])
if type(to_allocate[i][x])==type(''):
insert+=to_allocate[i][x]
to_return.append(insert)
return(to_return)
def MOD_5_THETA_BREAK(op,coi):
coi_hold=list_concat(COI_RETURN(op,coi))
to_return=[]
for i in range(1024):
a_str=''
c_str=bin_n_bit(i,'10')
for x in range(len(c_str)):
if c_str[x]=='0':
a_str+=coi_hold[x][0]
if c_str[x]=='1':
a_str+=coi_hold[x][1]
allocation_set=L_P(a_str,25)
insert=t_3(theta_allocation_builder(allocation_set[0],allocation_set[1],coi))
a_theta=theta(insert)
if THETA_COMPARE(a_theta,op,coi)==True:
to_return.append(insert)
return(to_return)
def THETA_COL_EXTRACT(a_theta,col_set):
return(index_search(rc_con(a_theta),col_set))
def THETA_COL_INSERT(insert_val_str_set,col_set):
to_allocate=rc_lcon(L_P([0]*1600,64))
for i in range(len(col_set)):
for x in range(len(to_allocate)):
to_allocate[col_set[i]]=insert_val_str_set[i]
to_return=[]
for i in range(len(to_allocate)):
if type(to_allocate[i])!=type(''):
to_return.append('0'*25)
if type(to_allocate[i])==type(''):
to_return.append(to_allocate[i])
return(rc_con(to_return))
#TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
'''
theta_delta_data represents 11-value sets that matches index
'''
'''
theta_delta_data proofs
Below is a more refined method for theta analysis, all functions touching
CRYPTO_REDUCTION would need to be retained, CRYPTO_REDUCTION_SECONDARY
is need, and might be a constant of theta and is worth investigating.
A third reduction will likely be needed, but the delta propogation looks
promissing.
'''
'''
I need to refine this solution to reflect information in the paper
new techniques for trail bounds and application to differential trails
in Keccak. Paper refelcts charateritcs in bit oriented
ciphers. First the authors claim in section 4.1 all 5 steps in keccak are
reversiable, and indicate theta() at the targeted primitive.
'''
'''
Note that delta crypto is not completely reduced based on index searching
likely the root cause of the undefined nature of single column inversion
successful correctness. Crytpo delta reduction should have fixed this
should complete confirmation step on all reductions.
'''
'''
Maxed out possible reduction need to reshift to columns with an iii,xxx
bound: do a count check sort by max and try and capture the most possible
values in column set then would have to brute force check. It's understood
that logic can be extracted from DELTA to produce further sets that must be
equal based on natural propogation. HARD STOP CONFIRM SETS BEFORE FURTHER
TESTING. (TEST COMPLETE:PASSED).
'''
'''
[3, [0, 320, 640]]
[3, [65, 385, 705]]
[3, [192, 512, 1472]]
[4, [1, 641, 961, 1281]]
[4, [64, 704, 1024, 1344]]
[4, [193, 833, 1153, 1473]]
[4, [448, 768, 1088, 1408]]
[5, [256, 576, 896, 1216, 1536]]
'''
'''
[3, [[61, 701], [61, 1021], [381, 701], [701, 1341], [381, 1021], [1021, 1341], [385, 1345], [705, 1345], [388, 1348], [1028, 1348]]]
[3, [[124, 444], [124, 1404], [444, 764], [444, 1084], [1084, 1404], [449, 1409], [1089, 1409], [457, 1417], [1097, 1417]]]
[5, [[0, 960], [0, 1280], [320, 960], [640, 960], [320, 1280], [640, 1280], [324, 1284], [644, 1284], [327, 967], [967, 1287]]]
[5, [[192, 832], [192, 1152], [512, 832], [832, 1472], [512, 1152], [1152, 1472], [516, 1156], [1156, 1476], [517, 1157], [1157, 1477]]]
[5, [[257, 577], [257, 897], [577, 1217], [577, 1537], [897, 1537], [579, 1219], [1219, 1539], [580, 1220], [1220, 1540]]]
[9, [[63, 703], [63, 1023], [383, 703], [63, 1343], [383, 1343], [64, 384], [384, 704], [384, 1344], [65, 1025], [65, 1345], [385, 1025], [705, 1025]]]
'''
'''
Functional reduction of from 2^50 to approximately 2^19 max observed
although the reduction was observed the node count distrubtion assumed
normal and highly likely. Now an isolated brute force 2-column solution should
be possible, but again by the LCR an accurate linked chain is highly unlikely.
Traversing forward might still be defined, still looking at upwards of 2^25
operation per theta inversion. Will need to write a some value worm fucntion to
push values into an arbitary delta set.
'''
================================================================================================
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
def is_in_truth(value,a_set):
#Will search through a_set looking to see if value is contained in that set
#and returns true if the values is in the set and returns false if the value
#is not in the set.
for i in range(len(a_set)):
if value==a_set[i]:
return(True)
return(False)
def mod_64(col):
#Function will based on column of intrest return the index value that is pushed
#for a particular mod 5 set of values returned from COL_HIT(col). But the patteren
#was developed visually
to_return=[col]
for i in range(24):
to_return.append(to_return[-1]+64)
return(to_return)
def theta_insert(value_set):
#This fucntion will take a set of index values as an input and build
#theta pushing '1' as the value to pass to those index locations, don't need to
#allocate locations that are initilized to '0'.
init=['0']*1600
for i in range(len(value_set)):
init[value_set[i]]='1'
return(L_P(l_s(init),64))
def THETA_BREAKER(theta_output):
#Function will take a pure theta input then it will concatinate these strings
#and iterate over this whole string. It will return two sets, the first being
#all input pairs that must be equal, second all input pairs that must not
#be equal.
to_check=str_concat(theta_output)
insert_0=[]
for i in range(len(theta_delta_data)):
if to_check[int(theta_delta_data[i][0])]==to_check[int(theta_delta_data[i][1])]:
insert_0.append(theta_delta_data[i])
insert_1=[]
for i in range(len(theta_delta_data)):
if to_check[int(theta_delta_data[i][0])]!=to_check[int(theta_delta_data[i][1])]:
insert_1.append(theta_delta_data[i])
return(insert_0,insert_1)
def set_reduction(set_0,set_1):
#Return True if either sets contain any value contained in the other set
for i in range(len(set_0)):
for x in range(len(set_1)):
if set_0[i]==set_1[x]:
return(True)
return(False)
def CRYPTO_REDUCTION_FILTER(nested_lists):
#A filter to be used in CRYPTO_REDUCTION() to structure the data for conclusion
#processing.
to_return=[]
for i in range(len(nested_lists)):
insert=[]
for x in range(len(nested_lists[i])):
insert+=nested_lists[i][x]
to_return.append(U_V(sorted(insert)))
return(to_return)
def CRYPTO_REDUCTION(var_sets,bool_filter,direction_int):
#Function will take an input from [MAPPING_FILTER(col,FIRST_MAPPING(col,builder))]
#as a nested_sets, in thay it's a list of lists of variable len, and pass sets of
#the same logical values. Before attack mapping check theory against true theta
#output, and if incorrect confrim IO. Also build filter. Build is column of intrest
#in a possible output of theta.
to_return=[]
while var_sets!=[]:
insert=[]
insert.append(var_sets.pop(direction_int))
try:
for i in range(len(var_sets)):
if set_reduction(insert[direction_int],var_sets[i])==True:
insert.append(var_sets.pop(i))
except IndexError:
to_return.append(insert)
if bool_filter==None:
return(to_return)
if bool_filter==True:
return(CRYPTO_REDUCTION_FILTER(to_return))
def CRYPTO_REDUCTION_SECONDARY(var_sets,direction_int):
#Takes an output from crypto_reduction and eliminates repeated values based on
#the length extension of the larger set. Based on some assumtions of the
#structure of the first reduction. But should by the nature of the multi
#set output of theta_data still reduce correctly.
to_return=[]
while var_sets!=[]:
to_check=var_sets[direction_int]
insert=[]
try:
for i in range(1,len(var_sets)):
if set_reduction(to_check,var_sets[i])==True:
if len(to_check) > len(var_sets[i]):
insert.append(to_check)
var_sets.pop(direction_int)
var_sets.pop(i)
if len(to_check) < len(var_sets[i]):
insert.append(var_sets[i])
var_sets.pop(direction_int)
var_sets.pop(i)
except IndexError:
None==None
if insert==[]:
to_return.append(to_check)
var_sets.pop(direction_int)
if insert!=[]:
to_return.append(insert[direction_int])
return(U_V(to_return))
def CRYPTO_DELTA_REDUCTION(var_sets,bool_filter,direction_int):
#Updated and corrected delta reduction same form as primary reducntion
#with some adjustment of handeling sets of 2 with list concatination.
#Filter not used for any delta reductions.
to_return=[]
while var_sets!=[]:
insert=[]
insert.append(var_sets.pop(direction_int))
try:
for i in range(len(var_sets)):
if set_reduction(U_V(list_concat(insert[direction_int])),U_V(list_concat(var_sets[i])))==True:
insert.append(var_sets.pop(i))
except IndexError:
to_return.append(list_concat(insert))
if bool_filter==None:
return(to_return)
if bool_filter==True:
return(CRYPTO_REDUCTION_FILTER(to_return))
def COUNT_HIT(set_0,set_1):
#Will take set_0 and count how many of it's values are represented
#in set_1
count=0
for i in range(len(set_0)):
if set_1.count(set_0[i])!=0:
count+=1
return(count)
def MULTI_COUNT(MULTI,coi):
to_return=[]
search_values=mod_64(coi)+mod_64(coi+1)
for i in range(len(MULTI)):
to_return.append([COUNT_HIT(search_values,MULTI[i]),MULTI[i]])
return(to_return)
def DELTA_COUNT(DELTA,coi):
to_return=[]
search_values=mod_64(coi)+mod_64(coi+1)
for i in range(len(DELTA)):
to_insert=list_concat(DELTA[i])
to_return.append([COUNT_HIT(search_values,to_insert),DELTA[i]])
return(to_return)
def NODE_GRAB(a_set):
to_return=[]
for i in range(1,len(a_set)+1):
if a_set[-i][0]!=0:
to_return.append(a_set[-i][1])
if a_set[-i][0]==0:
break
return(to_return)
def TYPE_RETURN(a_set):
#Checks a_set that is len=2 and returns true if either
#value of a_set is a string
if type(a_set[0])==type('') or type(a_set[1])==type(''):
return(True)
return(False)
def TYPE_CON(a_set):
a_set=list_concat(a_set)
for i in range(len(a_set)):
if type(a_set[i])!=type(''):
return(False)
return(True)
def TYPE_INT(a_set):
to_return=[]
for i in range(len(a_set)):
if TYPE_RETURN(a_set[i])==True:
if type(a_set[i][0])==type(''):
to_return.append([a_set[i][1],not_str(a_set[i][0])])
if type(a_set[i][0])!=type(''):
to_return.append([a_set[i][0],not_str(a_set[i][1])])
return(to_return)
def ALLOCATION(delta_set,value_set):
delta_copy=list(delta_set)
for i in range(len(value_set)):
for x in range(len(delta_set)):
for z in range(len(delta_set[x])):
if delta_set[x][z]==value_set[i][0]:
delta_copy[x][z]=value_set[i][1]
return(delta_copy)
def INIT_REG(delta_set,value):
delta_reg=list(delta_set)
reg_val=delta_set[0][0]
for i in range(len(delta_set)):
for x in range(len(delta_set[i])):
if delta_set[i][x]==reg_val:
delta_reg[i][x]=value
return(delta_set)
def WORM(value,delta_set):
delta_set=INIT_REG(delta_set,value)
to_pass=TYPE_INT(delta_set)
while TYPE_CON(delta_set)==False:
delta_set=ALLOCATION(delta_set,to_pass)
to_pass=TYPE_INT(delta_set)
return(delta_set)
def THETA_NODES(theta_output,direction,coi):
#This function will bind reduction functions will have to define a direction
#of derivation, column of intrest.
init=THETA_BREAKER(theta_output)
MULTI=CRYPTO_REDUCTION_SECONDARY(CRYPTO_REDUCTION(init[0],True,direction),direction)
DELTA=CRYPTO_DELTA_REDUCTION(CRYPTO_REDUCTION(init[1],None,direction),None,direction)
NODE_0=NODE_GRAB(sorted(MULTI_COUNT(MULTI,coi)))
NODE_1=NODE_GRAB(sorted(DELTA_COUNT(DELTA,coi)))
search_values=mod_64(coi)+mod_64(coi+1)
COUNT=COUNT_HIT(search_values,sorted(U_V(list_concat(NODE_0)+list_concat(list_concat(NODE_1)))))
return(COUNT,NODE_0,NODE_1)
def MISSED_VALUE(set_0,set_1,coi):
#Returns missed values that reduction was not able to capture
to_return=[]
search_values=mod_64(coi)+mod_64(coi+1)
total=sorted(U_V(list_concat(set_0)+list_concat(list_concat(set_1))))
for i in range(len(total)):
if is_in_truth(search_values[i],total)==False:
to_return.append(search_values[i])
return(to_return)
def MULTI_SET_ALLOCATION(str_value,multi_set):
to_return=[]
for i in range(len(multi_set)):
to_return.append([multi_set[i],str_value])
return(to_return)
def DELTA_SET_ALLOCATION(str_value,delta_set,delta_set_copy):
value_set=WORM(str_value,delta_set)
to_return=[]
for i in range(len(delta_set)):
for x in range(len(delta_set[i])):
to_return.append([delta_set_copy[i][x],value_set[i][x]])
return(to_return)
def MISSED_SET_ALLOCATION(str_value,int_value):
return([int_value,str_value])
def DELTA_COPY(a_delta):
to_return=[]
for i in range(len(a_delta)):
insert_0=[]
for x in range(len(a_delta[i])):
insert_1=[]
for z in range(len(a_delta[i][x])):
insert_1.append(int(a_delta[i][x][z]))
insert_0.append(list(insert_1))
to_return.append(list(insert_0))
return(list(to_return))
def ALLOCATION_FILTER(a_set):
#Note that allocation filter should only pull values that contain '1's.
#So that is to say col0 and col1 represnt allocated values.
to_return=[]
for i in range(len(a_set)):
if a_set[i][-1]=='1':
to_return.append(a_set[i][0])
return(to_return)
def COL_FILTER(col,a_list):
to_return=[]
a_set=mod_64(col)+mod_64(col+1)
for i in range(len(a_list)):
if is_in_truth(a_list[i],a_set)==True:
to_return.append(a_list[i])
return(to_return)
def COL_ISO(theta_output,col):
to_return=[]
for i in range(len(theta_output)):
to_return.append([theta_output[i][col]+theta_output[i][col+1]])
return(to_return)
def COL_SUB_SPLIT(a_set,col):
to_return=[]
to_search_0=mod_64(col)
to_search_1=mod_64(col+1)
for i in range(len(a_set)):
insert_0=[]
insert_1=[]
for x in range(len(a_set[i])):
if is_in_truth(a_set[i][x],to_search_0)==True:
insert_0.append(a_set[i][x])
if is_in_truth(a_set[i][x],to_search_1)==True:
insert_1.append(a_set[i][x])
to_return.append([sorted(insert_0),sorted(insert_1)])
return(to_return)
def theta_invert_0():
from col0 import col0
from col1 import col1
col=0
to_return=[]
for i in range(len(col0)):
for x in range(len(col1)):
if THETA_COMPARE(op,theta(theta_insert(list(set(col0[i]+col1[x])))),col)==True:
if THETA_COMPARE(op,theta(theta_insert(list(set(col0[i]+col1[x])))),col+1)==True:
to_return.append([i,x])
if i%100==0:
print(i)
def theta_invert_1():
ip=sha_seed()
op=theta(ip)
yyy=THETA_NODES(op,0,0)
to_print(yyy[1])
to_print(yyy[2])
to_print(MISSED_VALUE(yyy[1],yyy[2],0))
def THETA_INVERT_PROOF():
col=0
direction=0
to_hold_0=THETA_NODES(op,direction,col)
to_hold_1=MISSED_VALUE(to_hold_0[1],to_hold_0[2],col)
multi=to_hold_0[1]
delta=to_hold_0[2]
delta_copy=DELTA_COPY(delta)
miss=to_hold_1
to_iter=len(multi+delta+miss)
to_print(multi)
to_print(delta)
to_print(miss)
to_return=[]
for index in range(2**(to_iter)):
#str_value='01000100010000111'
str_value=bin_n_bit(index,str(to_iter))
a=len(multi)
b=len(delta)
c=len(miss)
set_0=[]
set_1=[]
set_2=[]
for i in range(a):
set_0.append(MULTI_SET_ALLOCATION(str_value[i],multi[i]))
count=0
for x in range(a,a+b):
set_1.append(DELTA_SET_ALLOCATION(str_value[x],delta[count],delta_copy[count]))
count+=1
count=0
for z in range(a+b,a+b+c):
set_2.append(MISSED_SET_ALLOCATION(str_value[z],miss[count]))
count+=1
set_0=list_concat(set_0)
set_1=list_concat(set_1)
total=COL_FILTER(col,U_V(ALLOCATION_FILTER(set_0+set_1+set_2)))
theta_input=theta_insert(total)
theta_output=theta(theta_input)
if THETA_COMPARE(theta_output,op,col)==True:
to_return.append(total)
delta=list(delta_copy)
delta_copy=DELTA_COPY(delta)
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$REDUCTION_MAIN_DEPRICATED$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
==========================================================================================================
'''
It's understood that the reduction return will produce a delta, multi and miss
sets of index values that are considered the nodes of interest for a particular column.
Now from this we brute forced all possible allocation nodes, for a particular column
and returned the '1's allocation locations for a node set (where by the node set contained
values that in both possible input columns for specifed output colum). Then the same process
is completed for the next output column. It's understood that for two possible output colums
there should be three total input columns that can be allocated. With the middle column containing
overlapping values that are allocated. Now to test: if there are nested for loops over these
allocation sets with appropriate filters the middle column should link sets to produce the correct
output at both columsn of intrest. But by the LCR while correct outputs for two columns can be
produced there are signifigantly larger numbers of sets that satisfy these conditions to the
extent that to identify the correct input set there needs to be a learning step. What characteritcs
of the correct set would the system see? It's unserstood that in defining 2 output columns
that 3 input colums can be allocated in the the process. There is a possibility that length
characteristics could be a factor but it can't be determined with any real degree of confidence.
So attention must be paid to columns that aren't ideifty is 2 column success state. It should
be stated that a global reduction of theta_delta_data should be attemped. The question needs
to be raised; can delta and multi sets be combined? If they contain the same index then yes
a delta should be able to propogate between set types. So it can be argued that the theta_delta_data
could be reduced to root nodes? A reduction was attempted for theta_data, it was determined the .index
method produced the same sets as theta_index_data for what it's worth. What's more interesting is
the fact that the diff one testing of theta_data produced the same delta index locations as
theta_index_data. Direction now whould be to check the sub loops that make theta. Sub loop
mapping? The sub loops aren't bijective. Remember multiple inputs per sub functions. Further steps
where ataken to break theta down into the components developed in the original formula, there where 4
sub function that where outlined below. It's now understood that the mod 5 sets of t_3(ip) and t_3(op)
must be either compliments or equal. These will be our new primary nodes for brute force mapping, it's holds
from previous analysis that single bit nodes of intrest are accurate in producing correct propagations.
(On the record it's retarded you didn't start at this point). It's TBD if it's possible to find any
differential propogations for the mod 5 sets. But the logic holds in saying: if there is a single bit
differentail that connents two mod 5 sets that a mod 5 allocation should infact propigate between mod 5
sets. So when validating a column of intrest 2^17 is likely closer to 2^10. Is it possible that you can
achieve differential propogations through a whole row of mod 5 sets? Unless there is a concentration of
missed set values in a mod 5 set. There is the potentail for total complexity of 2^5 if it can be proven the
exsistence of mod 5 propogations. Potentially without the need for theta? If you can say that there is
complete mod 5 linkage an arbitary injection would propogate to an entire mod 5 row, provided either
injection completes the loop, becuse if one violates the loop the other injection would be selected. If
both injections violate the loop (assuming the exsistence of a loop path) there would be the need for
serious evaluation.
'''
'''
Once the data base has been estblished index saving should be the nest step
once index saving is completed one should turn to evaluating "and" set couples.
Still TBD if this will just flat produce the already provided op. Will
continued looping complete reduction????? Time for rest.Now again the
issue was the LCR, we were nievely searching of set_n and set_n+1
only for linkage, when the real reduction is a nested for loop checking for
secondary column relation so it's a secondary theta check that needs to be
completed. Some type of dual set linkage. In essence it would be to build
4 sets instead of two. There will be no free propogation, the column loops will
be a future factor by nested for loops to check two outputs is the only method
for continued propoagtions, the base has been created. The linkage still needs
to be at it's core theta must be called again in all future reductions.
'''
'''
Agenda:
1) Edit code to adjust for error handeling at 63-0 column transition.
2) Test for the exsistance of mod 5 index linkage. Do this for a few
iterations of a theta ip/op becuse there will be a substantional
time investment to follow.
3) If there is entire mod 5 linkage, you will need to develop new
allocation functions that can pull the the actual/compilment sets.
4) If there isn't entire mod 5 linkage partial reduction allocation
functions will need to be developed. Shloud in theory improve current
mapping preformance.
'''
##TESTING CONT.#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment