cleanup to read as equation

This commit is contained in:
2024-06-26 17:23:31 -05:00
parent dc4caf14a6
commit 395c7887fe
6 changed files with 209 additions and 1648 deletions

View File

@@ -1,125 +1,196 @@
from src.models import AlphabetKey, ClientKeys, MutualKeys, ClientPersistentDataKeys, ClientEphemeralDataKeys, \ from src.models import (
MutualPersistentDataKeys, MutualEphemeralDataKeys, ClientPersistentMediumKeys, ClientEphemeralMediumKeys, \ AlphabetKey, ClientKeys, MutualKeys, ClientPersistentDataKeys, ClientEphemeralDataKeys,
MutualPersistentMediumKeys, MutualEphemeralMediumKeys, DarcKey, OuterKey MutualPersistentDataKeys, MutualEphemeralDataKeys, ClientPersistentMediumKeys, ClientEphemeralMediumKeys,
MutualPersistentMediumKeys, MutualEphemeralMediumKeys, DarcKey, OuterKey, Mask
)
def darc_phase2(alphabet: AlphabetKey, medium: AlphabetKey, client_keys: ClientKeys, mutual_keys: MutualKeys): def darc_phase2(
alphabet_phase2 = receive_alphabet(alphabet, client_keys.persistent.data, client_keys.ephemeral.data, mutual_keys.persistent.data, mutual_keys.ephemeral.data) alphabet_phase1: AlphabetKey,
medium = receive_medium(medium, client_keys.persistent.medium, client_keys.ephemeral.medium, mutual_keys.persistent.medium, mutual_keys.ephemeral.medium) medium_phase1: AlphabetKey,
return alphabet_phase2, medium client_keys: ClientKeys,
mutual_keys: MutualKeys
):
alphabet_phase2 = receive_alphabet(
alphabet_phase1,
client_keys.persistent.data,
client_keys.ephemeral.data,
mutual_keys.persistent.data,
mutual_keys.ephemeral.data
)
medium_phase2 = receive_medium(
medium_phase1,
client_keys.persistent.medium,
client_keys.ephemeral.medium,
mutual_keys.persistent.medium,
mutual_keys.ephemeral.medium
)
return alphabet_phase2, medium_phase2
def receive_alphabet(alphabet_phase1: AlphabetKey, client_persistent_keys: ClientPersistentDataKeys, client_ephemeral_keys: ClientEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys): def receive_alphabet(
mo2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2 alphabet_phase1: AlphabetKey,
mi1_mo2 = (mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1) < mo2 client_persistent_data_keys: ClientPersistentDataKeys,
mo1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1 client_ephemeral_data_keys: ClientEphemeralDataKeys,
mutual_persistent_data_keys: MutualPersistentDataKeys,
mutual_ephemeral_data_keys: MutualEphemeralDataKeys
):
mdi1 = mutual_persistent_data_keys.inner_key_1 << mutual_ephemeral_data_keys.inner_key_1
mdo1 = mutual_persistent_data_keys.outer_key_1 << mutual_ephemeral_data_keys.outer_key_1
mdo2 = mutual_persistent_data_keys.outer_key_2 << mutual_ephemeral_data_keys.outer_key_2
mdo3 = mutual_persistent_data_keys.outer_key_3 << mutual_ephemeral_data_keys.outer_key_3
cdi1 = client_persistent_data_keys.inner_key_1 << client_ephemeral_data_keys.inner_key_1
cdo1 = client_persistent_data_keys.outer_key_1 << client_ephemeral_data_keys.outer_key_1
cdo2 = client_persistent_data_keys.outer_key_2 << client_ephemeral_data_keys.outer_key_2
substitution = client_ephemeral_keys.alpha_key ^ client_persistent_keys.alpha_key ^ mutual_persistent_keys.alpha_key cdo1_cdo2 = cdo1 << cdo2
result = (
alphabet_phase1 ^ substitution = (
((substitution < mo1) << mi1_mo2) client_ephemeral_data_keys.alpha_key ^
client_persistent_data_keys.alpha_key ^
mutual_persistent_data_keys.alpha_key
) )
mo3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3 alphabet_phase2 = ((((
alphabet_phase1 ^
result = result < ~mo3 ((substitution < mdo1) << (mdi1 < mdo2))
ci1 = client_persistent_keys.inner_key_1 << client_ephemeral_keys.inner_key_1 ) < ~mdo3)) << cdi1) < (mdo3 << cdo1_cdo2)
co1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1
co2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2
mo3_co1_co2 = mo3 << co1 << co2
alphabet_phase2 = (result << ci1) < mo3_co1_co2
return alphabet_phase2 return alphabet_phase2
def receive_medium(medium_phase1: AlphabetKey, client_persistent_keys: ClientPersistentMediumKeys, client_ephemeral_keys: ClientEphemeralMediumKeys, mutual_persistent_keys: MutualPersistentMediumKeys, mutual_ephemeral_keys: MutualEphemeralMediumKeys): def receive_medium(
mi1 = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1 medium_phase1: AlphabetKey,
mo1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1 client_persistent_medium_keys: ClientPersistentMediumKeys,
mo2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2 client_ephemeral_medium_keys: ClientEphemeralMediumKeys,
mo3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3 mutual_persistent_medium_keys: MutualPersistentMediumKeys,
mutual_ephemeral_medium_keys: MutualEphemeralMediumKeys
):
mmi1 = mutual_persistent_medium_keys.inner_key_1 << mutual_ephemeral_medium_keys.inner_key_1
mmo1 = mutual_persistent_medium_keys.outer_key_1 << mutual_ephemeral_medium_keys.outer_key_1
mmo2 = mutual_persistent_medium_keys.outer_key_2 << mutual_ephemeral_medium_keys.outer_key_2
mmo3 = mutual_persistent_medium_keys.outer_key_3 << mutual_ephemeral_medium_keys.outer_key_3
mi1_mo2 = mi1 < mo2 cmi1 = client_persistent_medium_keys.inner_key_1 << client_ephemeral_medium_keys.inner_key_1
cmo1 = client_persistent_medium_keys.outer_key_1 << client_ephemeral_medium_keys.outer_key_1
cmo2 = client_persistent_medium_keys.outer_key_2 << client_ephemeral_medium_keys.outer_key_2
substitution = client_ephemeral_keys.alpha_key ^ client_persistent_keys.alpha_key ^ mutual_persistent_keys.alpha_key substitution = (
sub_mo1_mi1_mo2 = (substitution < mo1) << mi1_mo2 client_ephemeral_medium_keys.alpha_key ^
result = medium_phase1 ^ sub_mo1_mi1_mo2 client_persistent_medium_keys.alpha_key ^
mutual_persistent_medium_keys.alpha_key
)
ci1 = client_persistent_keys.inner_key_1 << client_ephemeral_keys.inner_key_1 medium_phase2 = (
ci1_mo3 = ci1 < mo3 (
result = result << ci1_mo3 medium_phase1 ^
((substitution < mmo1) << (mmi1 < mmo2))
co1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1 ) << (cmi1 < mmo3)
co2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2 ) < (cmo1 << cmo2)
medium_phase2 = result < (co1 << co2)
return medium_phase2 return medium_phase2
def transmit_alphabet(alphabet_phase2: DarcKey, client_persistent_keys: ClientPersistentDataKeys, client_ephemeral_keys: ClientEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys): def transmit_alphabet(
mo2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2 alphabet_phase2: DarcKey,
mo3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3 client_persistent_data_keys: ClientPersistentDataKeys,
client_ephemeral_data_keys: ClientEphemeralDataKeys,
mutual_persistent_data_keys: MutualPersistentDataKeys,
mutual_ephemeral_data_keys: MutualEphemeralDataKeys
):
mdpi2 = mutual_persistent_data_keys.inner_key_2
mdi1 = mutual_persistent_data_keys.inner_key_1 << mutual_ephemeral_data_keys.inner_key_1
mdo1 = mutual_persistent_data_keys.outer_key_1 << mutual_ephemeral_data_keys.outer_key_1
mdo2 = mutual_persistent_data_keys.outer_key_2 << mutual_ephemeral_data_keys.outer_key_2
mdo3 = mutual_persistent_data_keys.outer_key_3 << mutual_ephemeral_data_keys.outer_key_3
co1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1 cdi1 = client_persistent_data_keys.inner_key_1 << client_ephemeral_data_keys.inner_key_1
co2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2 cdo1 = client_persistent_data_keys.outer_key_1 << client_ephemeral_data_keys.outer_key_1
cdo2 = client_persistent_data_keys.outer_key_2 << client_ephemeral_data_keys.outer_key_2
co1_co2 = co1 << co2 cdo1_cdo2 = cdo1 << cdo2
mo3_co1_co2 = mo3 << co1 << co2
ncei1_ncpi1_mpi2 = ~client_ephemeral_keys.inner_key_1 << ~client_persistent_keys.inner_key_1 << mutual_persistent_keys.inner_key_2 substitution = (
ncei1_ncpi1_mpi2__mo3_co1_co2 = ncei1_ncpi1_mpi2 < mo3_co1_co2 client_ephemeral_data_keys.alpha_key ^
result = alphabet_phase2 << ncei1_ncpi1_mpi2__mo3_co1_co2 client_persistent_data_keys.alpha_key ^
mutual_ephemeral_data_keys.alpha_key
)
mo1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1 alphabet_phase3 = (
(alphabet_phase2 << ((~cdi1 << mdpi2) < (mdo3 << cdo1_cdo2))) ^
substitution = client_ephemeral_keys.alpha_key ^ client_persistent_keys.alpha_key ^ mutual_ephemeral_keys.alpha_key (((substitution < mdo1) << ((mdi1 < mdo2) << (mdpi2 < mdo3))) < cdo1_cdo2)
)
mi1_mo2_mpi2_mo3 = (((mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1) < mo2) << (mutual_persistent_keys.inner_key_2 < mo3)) #< co1_co2
alphabet_phase3 = result ^ (((substitution < mo1) << mi1_mo2_mpi2_mo3 ) < co1_co2)
return alphabet_phase3 return alphabet_phase3
def transmit_medium(medium_phase2: DarcKey, client_persistent_keys: ClientPersistentMediumKeys, client_ephemeral_keys: ClientEphemeralMediumKeys, mutual_persistent_keys: MutualPersistentMediumKeys, mutual_ephemeral_keys: MutualEphemeralMediumKeys): def transmit_medium(
mo3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3 medium_phase2: DarcKey,
co1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1 client_persistent_medium_keys: ClientPersistentMediumKeys,
co2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2 client_ephemeral_medium_keys: ClientEphemeralMediumKeys,
mutual_persistent_medium_keys: MutualPersistentMediumKeys,
mutual_ephemeral_medium_keys: MutualEphemeralMediumKeys
):
mmpi1 = mutual_persistent_medium_keys.inner_key_2
mmi1 = mutual_persistent_medium_keys.inner_key_1 << mutual_ephemeral_medium_keys.inner_key_1
mmo1 = mutual_persistent_medium_keys.outer_key_1 << mutual_ephemeral_medium_keys.outer_key_1
mmo2 = mutual_persistent_medium_keys.outer_key_2 << mutual_ephemeral_medium_keys.outer_key_2
mmo3 = mutual_persistent_medium_keys.outer_key_3 << mutual_ephemeral_medium_keys.outer_key_3
co1_co2 = co1 << co2 cmi1 = client_persistent_medium_keys.inner_key_1 << client_ephemeral_medium_keys.inner_key_1
cmo1 = client_persistent_medium_keys.outer_key_1 << client_ephemeral_medium_keys.outer_key_1
cmo2 = client_persistent_medium_keys.outer_key_2 << client_ephemeral_medium_keys.outer_key_2
mo2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2 cmo1_cmo2 = cmo1 << cmo2
mi1 = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mi1_mo2 = mi1 < mo2 substitution = (
mpi1_mo3 = mutual_persistent_keys.inner_key_2 < mo3 client_persistent_medium_keys.alpha_key ^
mi1_mo2_mpi1_mo3 = mi1_mo2 << mpi1_mo3 client_ephemeral_medium_keys.alpha_key ^
mutual_ephemeral_medium_keys.alpha_key
)
ncei1_ncpi2 = ~(client_persistent_keys.inner_key_1 << client_ephemeral_keys.inner_key_1) << mutual_persistent_keys.inner_key_2 medium_phase3 = (
ncei1_ncpi2__mo3 = ncei1_ncpi2 < mo3 ((medium_phase2 < ~cmo1_cmo2) << ((~cmi1 << mmpi1) < mmo3)) ^
((substitution < mmo1) << ((mmi1 < mmo2) << (mmpi1 < mmo3)))
result = ((medium_phase2 < ~co1_co2) << ncei1_ncpi2__mo3) ) < cmo1_cmo2
mo1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
sub = client_persistent_keys.alpha_key ^ client_ephemeral_keys.alpha_key ^ mutual_ephemeral_keys.alpha_key
sub_mo1 = sub < mo1
medium_phase3 = (result ^ (sub_mo1 << mi1_mo2_mpi1_mo3)) < co1_co2
return medium_phase3 return medium_phase3
def darc_phase3(alphabet_phase2: AlphabetKey, medium_phase2: AlphabetKey, client_keys: ClientKeys, mutual_keys: MutualKeys): def darc_phase3(
alphabet_phase3 = transmit_alphabet(alphabet_phase2, client_keys.persistent.data, client_keys.ephemeral.data, mutual_keys.persistent.data, mutual_keys.ephemeral.data) alphabet_phase2: AlphabetKey,
medium_phase3 = transmit_medium(medium_phase2, client_keys.persistent.medium, client_keys.ephemeral.medium, mutual_keys.persistent.medium, mutual_keys.ephemeral.medium) medium_phase2: AlphabetKey,
client_keys: ClientKeys,
mutual_keys: MutualKeys
):
alphabet_phase3 = transmit_alphabet(
alphabet_phase2,
client_keys.persistent.data,
client_keys.ephemeral.data,
mutual_keys.persistent.data,
mutual_keys.ephemeral.data
)
medium_phase3 = transmit_medium(
medium_phase2,
client_keys.persistent.medium,
client_keys.ephemeral.medium,
mutual_keys.persistent.medium,
mutual_keys.ephemeral.medium
)
return alphabet_phase3, medium_phase3 return alphabet_phase3, medium_phase3
def merge_message(alphabet_phase3: AlphabetKey, medium_phase3: AlphabetKey, client_keys: ClientKeys, mutual_keys: MutualKeys, input_sequence: list[int]): def merge_message(
alphabet_phase3: AlphabetKey,
medium_phase3: AlphabetKey,
client_keys: ClientKeys,
mutual_keys: MutualKeys,
input_sequence: list[int]
):
height = len(alphabet_phase3.matrix) height = len(alphabet_phase3.matrix)
width = len(alphabet_phase3.matrix[0]) width = len(alphabet_phase3.matrix[0])
msg_len = len(input_sequence) msg_len = len(input_sequence)
eof_arr = AlphabetKey.init_matrix(width, height, 255).matrix[0] eof_arr = AlphabetKey.init_matrix(width, height, 255).matrix[0]
#eof_msg_mask = Mask.init_matrix(width, height, msg_len)
if msg_len < height: if msg_len < height:
padded_input_sequence = OuterKey.init_matrix(height) padded_input_sequence = OuterKey.init_matrix(height)
@@ -129,27 +200,24 @@ def merge_message(alphabet_phase3: AlphabetKey, medium_phase3: AlphabetKey, clie
cdo1 = client_keys.persistent.data.outer_key_1 << client_keys.ephemeral.data.outer_key_1 cdo1 = client_keys.persistent.data.outer_key_1 << client_keys.ephemeral.data.outer_key_1
cdo2 = client_keys.persistent.data.outer_key_2 << client_keys.ephemeral.data.outer_key_2 cdo2 = client_keys.persistent.data.outer_key_2 << client_keys.ephemeral.data.outer_key_2
ncdo1_ncdo2 = ~(cdo1 << cdo2)
ncdo1_ncdo2_inp = ncdo1_ncdo2 << padded_input_sequence
cmo1 = client_keys.persistent.medium.outer_key_1 << client_keys.ephemeral.medium.outer_key_1
cmo2 = client_keys.persistent.medium.outer_key_2 << client_keys.ephemeral.medium.outer_key_2
alpha_ncdo1_ncdo2_inp = alphabet_phase3 < ncdo1_ncdo2_inp
ncmo2_ncmo1 = ~(cmo1 << cmo2)
alpha_ncdo1_ncdo2_inp = (alphabet_phase3 < (~(cdo1 << cdo2) << padded_input_sequence))
if msg_len < height: if msg_len < height:
alpha_ncdo1_ncdo2_inp.matrix[msg_len] = eof_arr alpha_ncdo1_ncdo2_inp.matrix[msg_len] = eof_arr
mmi3 = mutual_keys.persistent.medium.inner_key_3 << mutual_keys.ephemeral.medium.inner_key_3 mmi3 = mutual_keys.persistent.medium.inner_key_3 << mutual_keys.ephemeral.medium.inner_key_3
mmo6 = mutual_keys.persistent.medium.outer_key_6 << mutual_keys.ephemeral.medium.outer_key_6
mmo4 = mutual_keys.persistent.medium.outer_key_4 << mutual_keys.ephemeral.medium.outer_key_4
mmi3_nmmo6_nmmo4 = mmi3 < ~(mmo4 << mmo6)
mmo5 = mutual_keys.persistent.medium.outer_key_5 << mutual_keys.ephemeral.medium.outer_key_5
mmi4 = mutual_keys.persistent.medium.inner_key_4 << mutual_keys.ephemeral.medium.inner_key_4 mmi4 = mutual_keys.persistent.medium.inner_key_4 << mutual_keys.ephemeral.medium.inner_key_4
mmo4 = mutual_keys.persistent.medium.outer_key_4 << mutual_keys.ephemeral.medium.outer_key_4
mmo5 = mutual_keys.persistent.medium.outer_key_5 << mutual_keys.ephemeral.medium.outer_key_5
mmo6 = mutual_keys.persistent.medium.outer_key_6 << mutual_keys.ephemeral.medium.outer_key_6
darc_message = (((medium_phase3 < ncmo2_ncmo1) ^ (alpha_ncdo1_ncdo2_inp << mmi3_nmmo6_nmmo4)) < mmo4) << (mmi4 < (mmo5 << ~mmo6)) cmo1 = client_keys.persistent.medium.outer_key_1 << client_keys.ephemeral.medium.outer_key_1
cmo2 = client_keys.persistent.medium.outer_key_2 << client_keys.ephemeral.medium.outer_key_2
darc_message = (
(
(medium_phase3 < ~(cmo1 << cmo2)) ^
(alpha_ncdo1_ncdo2_inp << (mmi3 < ~(mmo4 << mmo6)))
) < mmo4
) << (mmi4 < (mmo5 << ~mmo6))
return darc_message return darc_message

View File

@@ -106,23 +106,6 @@ class DarcKey(BaseModel):
return True return True
def column_substitution(self, column: int, substitution: list[int]):
assert len(substitution) == len(self.matrix)
assert len(self.matrix[0]) > column >= 0
output = []
for i, el in enumerate(self.matrix):
row = []
for j, el2 in enumerate(el):
if j == column:
row.append(substitution[i])
else:
row.append(el2)
output.append(row)
return DarcKey(
matrix=output,
key_type=self.key_type
)
class OuterKey(DarcKey): class OuterKey(DarcKey):
key_type = DarcKeyTypes.outer_shuffle key_type = DarcKeyTypes.outer_shuffle
@@ -162,6 +145,25 @@ class AlphabetKey(DarcKey):
) )
class Mask(DarcKey):
key_type = DarcKeyTypes.alphabet
max_value: int = 255
@classmethod
def init_matrix(cls, width: int, height: int, col_mask: int):
""" originally buildScramble """
mask = cls._random_mask(width, cls.max_value)
matrix = [[0 for _ in range(width)] for _ in range(height)]
if col_mask < height:
matrix[col_mask] = mask
return Mask(
matrix=matrix,
max_value=cls.max_value
)
class ClientEphemeralDataKeys(BaseModel): class ClientEphemeralDataKeys(BaseModel):
outer_key_1: OuterKey outer_key_1: OuterKey
outer_key_2: OuterKey outer_key_2: OuterKey

View File

@@ -1,6 +1,8 @@
from src.models import AlphabetKey, ServerPersistentDataKeys, ServerEphemeralDataKeys, MutualPersistentDataKeys, \ from src.models import (
MutualEphemeralDataKeys, ServerKeys, MutualKeys, ServerPersistentMediumKeys, ServerEphemeralMediumKeys, \ AlphabetKey, ServerPersistentDataKeys, ServerEphemeralDataKeys, MutualPersistentDataKeys,
MutualPersistentMediumKeys, MutualEphemeralMediumKeys, DarcKey MutualEphemeralDataKeys, ServerKeys, MutualKeys, ServerPersistentMediumKeys, ServerEphemeralMediumKeys,
MutualPersistentMediumKeys, MutualEphemeralMediumKeys
)
def darc_phase1(alphabet: AlphabetKey, server_keys: ServerKeys, mutual_keys: MutualKeys): def darc_phase1(alphabet: AlphabetKey, server_keys: ServerKeys, mutual_keys: MutualKeys):
@@ -9,19 +11,25 @@ def darc_phase1(alphabet: AlphabetKey, server_keys: ServerKeys, mutual_keys: Mut
return alphabet_phase1, medium_phase1 return alphabet_phase1, medium_phase1
def translate_data(alphabet: AlphabetKey, server_persistent_keys: ServerPersistentDataKeys, server_ephemeral_keys: ServerEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys): def translate_data(
so1 = server_persistent_keys.outer_key_1 << server_ephemeral_keys.outer_key_1 alphabet: AlphabetKey,
mo3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3 server_persistent_data_keys: ServerPersistentDataKeys,
si1_mo3 = (server_persistent_keys.inner_key_1 << server_ephemeral_keys.inner_key_1) < mo3 server_ephemeral_data_keys: ServerEphemeralDataKeys,
mutual_persistent_data_keys: MutualPersistentDataKeys,
mutual_ephemeral_data_keys: MutualEphemeralDataKeys
):
sdo1 = server_persistent_data_keys.outer_key_1 << server_ephemeral_data_keys.outer_key_1
sdi1 = server_persistent_data_keys.inner_key_1 << server_ephemeral_data_keys.inner_key_1
mo2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2 mdi1 = mutual_persistent_data_keys.inner_key_1 << mutual_ephemeral_data_keys.inner_key_1
mi1_mo2 = (mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1) < mo2 mdo1 = mutual_persistent_data_keys.outer_key_1 << mutual_ephemeral_data_keys.outer_key_1
mo1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1 mdo2 = mutual_persistent_data_keys.outer_key_2 << mutual_ephemeral_data_keys.outer_key_2
mdo3 = mutual_persistent_data_keys.outer_key_3 << mutual_ephemeral_data_keys.outer_key_3
substitution = server_persistent_keys.alpha_key ^ server_ephemeral_keys.alpha_key substitution = server_persistent_data_keys.alpha_key ^ server_ephemeral_data_keys.alpha_key
alpha_phase1 = ( alpha_phase1 = (
((alphabet< so1) << si1_mo3) ^ ((alphabet < sdo1) << (sdi1 < mdo3)) ^
((substitution < mo1) << mi1_mo2) ((substitution < mdo1) << (mdi1 < mdo2))
) )
return alpha_phase1 return alpha_phase1

File diff suppressed because it is too large Load Diff

View File

@@ -1,487 +0,0 @@
from src.models import DarcKey, DarcKeyTypes
if __name__ == "__main__":
height = 10
width = 7
# B_o_m
# 2 Outer (Mutual) (Substitution) Function Key
outer_mutual_substitution_function_key = DarcKey(matrix=[['9', '7', '4', '2', '5', '3', '0', '6', '1', '8']], key_type=DarcKeyTypes.outer_shuffle)
# 3 Outer (Mutual) (Substitution) Function Function Key
outer_mutual_substitution_function_function_key = DarcKey(matrix=[['8', '1', '4', '5', '2', '3', '7', '6', '0', '9']], key_type=DarcKeyTypes.outer_shuffle)
# 4 Outer Server (Mutual) Shuffle (Permutation) Function Key
outer_mutual_shuffle_permutation_function_key = DarcKey(matrix=[['3', '9', '2', '5', '0', '7', '6', '8', '1', '4']], key_type=DarcKeyTypes.outer_shuffle)
# 5 Outer Client Shuffle (Permutation) Key
outer_client_shuffle_permutation_key = DarcKey(matrix=[['6', '4', '7', '8', '0', '2', '1', '9', '5', '3']], key_type=DarcKeyTypes.outer_shuffle)
# 6 Outer Client Shuffle (Permutation) Function Key
outer_client_shuffle_permutation_function_key = DarcKey(matrix=[['4', '2', '1', '0', '5', '7', '8', '9', '3', '6']], key_type=DarcKeyTypes.outer_shuffle)
# 7 Outer Server Shuffle (Permutation) Key
outer_server_shuffle_permutation_key = DarcKey(matrix=[['4', '9', '6', '0', '7', '5', '3', '1', '2', '8']], key_type=DarcKeyTypes.outer_shuffle)
# 15 Outer (Mutual) (Substitution) Function ephemeral Key
outer_mutual_substitution_function_ephemeral_key = DarcKey(matrix=[
['0', '9', '6', '2', '1', '5', '3', '8', '7', '4']
], key_type=DarcKeyTypes.outer_shuffle)
# 16 Outer (Mutual) (Substitution) Function Function ephemeral Key
outer_mutual_substitution_function_function_ephemeral_key = DarcKey(matrix=[
['2', '3', '9', '7', '6', '0', '1', '4', '8', '5']
], key_type=DarcKeyTypes.outer_shuffle)
# 17 Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key
outer_server_mutual_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[
['0', '8', '5', '9', '7', '3', '1', '4', '6', '2']
], key_type=DarcKeyTypes.outer_shuffle)
# 18 Outer Client Shuffle (Permutation) ephemeral Key
outer_client_shuffle_permutation_ephemeral_key = DarcKey(matrix=[
['1', '4', '2', '9', '5', '7', '8', '3', '0', '6']
], key_type=DarcKeyTypes.outer_shuffle)
# 19 Outer Client Shuffle (Permutation) Function ephemeral Key
outer_client_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[
['4', '3', '2', '5', '1', '6', '7', '8', '0', '9']
], key_type=DarcKeyTypes.outer_shuffle)
# 20 Outer Server Shuffle (Permutation) ephemeral Key
outer_server_shuffle_permutation_ephemeral_key = DarcKey(matrix=[
['7', '5', '2', '1', '8', '4', '3', '6', '9', '0']
], key_type=DarcKeyTypes.outer_shuffle)
# 29 Alphabet Input Sequence the message
alphabet_input_sequence = DarcKey(matrix=[
['0', '2', '4', '6', '8', '1', '3', '5', '7', '9']
], key_type=DarcKeyTypes.outer_shuffle)
# 1 Alphabet Values
alphabet_values = DarcKey(matrix=[
['10', '28', '38', '41', '51', '64', '70'],
['15', '25', '33', '48', '56', '69', '71'],
['13', '22', '36', '47', '54', '60', '72'],
['12', '24', '31', '43', '58', '63', '73'],
['11', '21', '39', '49', '53', '65', '74'],
['18', '20', '32', '45', '52', '61', '75'],
['14', '29', '37', '44', '57', '68', '76'],
['19', '23', '34', '40', '59', '62', '77'],
['17', '27', '35', '42', '55', '67', '78'],
['16', '26', '30', '46', '50', '66', '79']
], key_type=DarcKeyTypes.alphabet)
# 8 (Mutual) (Substitution) Function Key
mutual_substitution_function_key = DarcKey(matrix=[
['1', '5', '0', '2', '3', '6', '4'],
['5', '2', '6', '4', '1', '3', '0'],
['4', '2', '3', '5', '6', '1', '0'],
['0', '3', '1', '6', '5', '2', '4'],
['4', '1', '3', '0', '6', '5', '2'],
['6', '3', '4', '2', '5', '1', '0'],
['2', '3', '0', '4', '1', '6', '5'],
['4', '0', '6', '5', '2', '3', '1'],
['3', '2', '4', '1', '0', '5', '6'],
['2', '3', '4', '1', '5', '0', '6']
], key_type=DarcKeyTypes.inner_shuffle)
# 9 Client Shuffle (Permutation) Key X
client_shuffle_permutation_key_x = DarcKey(matrix=[
['6', '3', '1', '4', '5', '0', '2'],
['6', '5', '0', '2', '3', '4', '1'],
['1', '4', '0', '6', '3', '2', '5'],
['6', '1', '4', '5', '3', '2', '0'],
['2', '0', '1', '4', '3', '5', '6'],
['3', '0', '6', '2', '1', '4', '5'],
['3', '2', '0', '1', '6', '4', '5'],
['6', '2', '3', '0', '1', '5', '4'],
['3', '0', '6', '5', '4', '1', '2'],
['3', '2', '5', '0', '4', '1', '6']
], key_type=DarcKeyTypes.inner_shuffle)
# 10 Client Shuffle (Permutation) Key A (remove A)
client_shuffle_permutation_key_a = DarcKey(matrix=[
['6', '0', '3', '5', '2', '1', '4'],
['4', '3', '2', '5', '0', '1', '6'],
['5', '4', '1', '0', '2', '3', '6'],
['3', '6', '1', '4', '5', '2', '0'],
['3', '5', '4', '2', '0', '1', '6'],
['6', '1', '5', '4', '2', '3', '0'],
['0', '4', '6', '3', '5', '1', '2'],
['0', '6', '4', '3', '1', '2', '5'],
['5', '0', '6', '3', '4', '1', '2'],
['3', '2', '0', '4', '1', '6', '5']
], key_type=DarcKeyTypes.inner_shuffle)
# 11 Server Shuffle (Permutation) Key
server_shuffle_permutation_key = DarcKey(matrix=[
['5', '2', '3', '0', '6', '4', '1'],
['5', '2', '6', '3', '0', '1', '4'],
['1', '3', '5', '0', '2', '6', '4'],
['6', '2', '1', '4', '5', '0', '3'],
['2', '3', '4', '1', '5', '6', '0'],
['3', '2', '0', '1', '5', '4', '6'],
['2', '6', '0', '3', '4', '1', '5'],
['3', '0', '4', '6', '2', '5', '1'],
['5', '3', '2', '0', '6', '4', '1'],
['1', '4', '5', '3', '2', '6', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# 21 (Mutual) (Substitution) Function ephemeral Key
mutual_substitution_function_ephemeral_key = DarcKey(matrix=[
['6', '0', '1', '4', '2', '3', '5'],
['2', '3', '6', '4', '0', '1', '5'],
['2', '4', '0', '3', '6', '1', '5'],
['0', '4', '2', '3', '1', '5', '6'],
['6', '4', '2', '5', '1', '0', '3'],
['5', '1', '0', '6', '4', '2', '3'],
['1', '2', '4', '3', '6', '0', '5'],
['6', '1', '4', '0', '5', '3', '2'],
['2', '3', '5', '4', '6', '0', '1'],
['1', '6', '4', '3', '5', '2', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# 22 Client Shuffle (Permutation) ephemeral Key A (remove A)
client_shuffle_permutation_ephemeral_key_a = DarcKey(matrix=[
['5', '0', '4', '3', '2', '6', '1'],
['0', '6', '2', '1', '5', '3', '4'],
['1', '2', '0', '3', '5', '4', '6'],
['0', '2', '6', '3', '4', '5', '1'],
['5', '1', '2', '0', '3', '4', '6'],
['1', '0', '3', '4', '5', '6', '2'],
['3', '0', '5', '2', '6', '4', '1'],
['6', '4', '5', '3', '0', '2', '1'],
['2', '4', '6', '0', '3', '5', '1'],
['4', '6', '2', '3', '5', '1', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# 23 Server Shuffle (Permutation) ephemeral Key 1 (remove 1)
server_shuffle_permutation_ephemeral_key_1 = DarcKey(matrix=[
['6', '1', '3', '0', '4', '2', '5'],
['3', '2', '1', '0', '4', '5', '6'],
['2', '4', '3', '5', '0', '6', '1'],
['4', '1', '3', '6', '0', '2', '5'],
['1', '4', '2', '3', '0', '5', '6'],
['6', '4', '5', '0', '2', '3', '1'],
['0', '4', '2', '3', '1', '5', '6'],
['0', '6', '3', '5', '1', '2', '4'],
['2', '6', '3', '1', '4', '5', '0'],
['5', '0', '4', '1', '6', '3', '2']
], key_type=DarcKeyTypes.inner_shuffle)
# 12 Shared (Mutual) (Substitution) Component 1
shared_mutual_substitution_component_1 = DarcKey(matrix=[
['81', '150', '209', '32', '246', '219', '15'],
['100', '15', '50', '179', '52', '1', '142'],
['98', '34', '170', '6', '195', '115', '117'],
['205', '169', '12', '151', '139', '91', '114'],
['192', '153', '175', '62', '249', '230', '103'],
['56', '54', '44', '107', '125', '122', '219'],
['28', '16', '32', '27', '95', '248', '200'],
['152', '121', '40', '198', '19', '55', '59'],
['189', '227', '175', '102', '171', '135', '170'],
['182', '144', '202', '64', '253', '89', '196']
], key_type=DarcKeyTypes.alphabet)
# 13 Client (Substitution) Key
client_substitution_key = DarcKey(matrix=[
['148', '232', '147', '96', '20', '201', '150'],
['120', '0', '158', '250', '176', '223', '82'],
['12', '81', '193', '212', '247', '100', '1'],
['127', '211', '164', '202', '25', '149', '34'],
['214', '38', '10', '197', '195', '97', '193'],
['177', '120', '199', '180', '206', '184', '155'],
['154', '146', '186', '205', '190', '47', '169'],
['164', '80', '233', '207', '214', '91', '108'],
['123', '101', '231', '244', '92', '88', '12'],
['222', '193', '85', '98', '224', '145', '0']
], key_type=DarcKeyTypes.alphabet)
# 14 Server (Substitution) Key
server_substitution_key = DarcKey(matrix=[
['163', '247', '59', '226', '186', '179', '35'],
['140', '180', '54', '88', '40', '252', '97'],
['229', '247', '16', '206', '186', '125', '81'],
['221', '222', '54', '22', '190', '18', '122'],
['126', '130', '83', '142', '152', '238', '237'],
['76', '168', '77', '176', '198', '119', '104'],
['121', '96', '80', '75', '138', '219', '122'],
['92', '210', '20', '56', '232', '219', '245'],
['111', '1', '155', '236', '15', '184', '0'],
['36', '31', '143', '5', '112', '206', '106']
],
key_type=DarcKeyTypes.alphabet
)
# 24 Server (Substitution) ephemeral Unique Component Function
server_substitution_ephemeral_unique_component_function = 5
# 25 Shared (Mutual) (Substitution) ephemeral Key
shared_mutual_substitution_ephemeral_key = DarcKey(matrix=[
['106', '113', '9', '54', '49', '4', '207'],
['184', '3', '232', '179', '15', '113', '142'],
['129', '44', '164', '54', '1', '32', '201'],
['106', '50', '246', '140', '149', '179', '109'],
['210', '11', '69', '193', '77', '245', '62'],
['37', '76', '137', '24', '220', '30', '165'],
['40', '57', '147', '225', '24', '176', '103'],
['37', '212', '189', '203', '218', '138', '168'],
['73', '227', '38', '164', '20', '239', '24'],
['7', '194', '254', '76', '0', '244', '215']
], key_type=DarcKeyTypes.alphabet)
# 26 Client (Substitution) ephemeral Key
client_substitution_ephemeral_key = DarcKey(matrix=[
['21', '149', '75', '73', '228', '81', '79'],
['41', '189', '80', '209', '45', '101', '53'],
['139', '238', '141', '159', '30', '79', '214'],
['239', '234', '72', '75', '80', '190', '124'],
['203', '225', '246', '200', '205', '195', '92'],
['201', '185', '113', '101', '176', '216', '106'],
['14', '210', '125', '70', '53', '128', '57'],
['115', '27', '97', '39', '199', '26', '104'],
['29', '4', '55', '5', '13', '57', '19'],
['158', '184', '137', '0', '221', '12', '217']
], key_type=DarcKeyTypes.alphabet)
# 27 Server (Substitution) ephemeral Random Component
server_substitution_ephemeral_random_component = DarcKey(matrix=[
['191', '50', '229', '60', '201', '64', '45'],
['31', '88', '90', '8', '153', '6', '228'],
['117', '63', '38', '90', '236', '207', '254'],
['64', '219', '36', '3', '119', '205', '171'],
['172', '138', '153', '52', '161', '137', '216'],
['49', '150', '210', '129', '174', '190', '54'],
['81', '230', '135', '200', '218', '31', '52'],
['128', '253', '177', '220', '1', '83', '3'],
['204', '199', '43', '50', '148', '215', '6'],
['79', '124', '128', '30', '74', '242', '85']
], key_type=DarcKeyTypes.alphabet)
# 28 Server (Substitution) ephemeral Unique Component
server_substitution_ephemeral_unique_component = DarcKey(matrix=[
['7', '190', '58', '75', '135', '15', '214', '149', '244', '224']
], key_type=DarcKeyTypes.alphabet)
# 30 Shared (Mutual) (Substitution) Key
shared_mutual_substitution_key = shared_mutual_substitution_component_1 ^ client_substitution_key
# 31 Outer (Mutual) Function Function ephemeral Key Applied = Outer (Mutual) (Substitution) Function Function Key << Outer (Mutual) (Substitution) Function Function ephemeral Key
outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key
# 32 Inner (Mutual) Function Applied Key = (Mutual) (Substitution) Function Key << (Mutual) (Substitution) Function ephemeral Key
inner_mutual_function_applied_key = mutual_substitution_function_key << mutual_substitution_function_ephemeral_key
# 33 Inner (Mutual) Function Key Scratch = Inner (Mutual) Function Applied Key << Outer (Mutual) Function Function ephemeral Key Applied
inner_mutual_function_key_scratch = inner_mutual_function_applied_key < outer_mutual_function_function_ephemeral_key_applied
# 34 Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied = Outer Server (Mutual) Shuffle (Permutation) Function Key << Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key
outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied = outer_mutual_shuffle_permutation_function_key << outer_server_mutual_shuffle_permutation_function_ephemeral_key
# 35 Client Shuffle (Permutation) Key X Scratch = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied
client_shuffle_permutation_key_x_scratch = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 36 Inner Function Key Scratch 2 = Inner (Mutual) Function Key Scratch << Client Shuffle (Permutation) Key X Scratch
inner_function_key_scratch_2 = inner_mutual_function_key_scratch << client_shuffle_permutation_key_x_scratch
# 37 Outer (Mutual) Function ephemeral Key Applied = Outer (Mutual) (Substitution) Function Key < Outer (Mutual) (Substitution) Function ephemeral Key
outer_mutual_function_ephemeral_key_applied = outer_mutual_substitution_function_key << outer_mutual_substitution_function_ephemeral_key
# 38 Server (Substitution) Key Scratch = Server (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied
server_substitution_key_scratch = server_substitution_key < outer_mutual_function_ephemeral_key_applied
# 39 Shared (Mutual) (Substitution) Key Scratch = Shared (Mutual) (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied
shared_mutual_substitution_key_scratch = shared_mutual_substitution_key < outer_mutual_function_ephemeral_key_applied
# 40 Shared (Mutual) (Substitution) ephemeral Key Server Scratch = Shared (Mutual) (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied
shared_mutual_substitution_ephemeral_key_server_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied
# line 78
# 41 Server Client Shuffle (Permutation) = Server Shuffle (Permutation) Key << Client Shuffle (Permutation) Key X
server_client_shuffle_permutation = server_shuffle_permutation_key << client_shuffle_permutation_key_x
# 42 Server Client Shuffle (Permutation) Inverse
server_client_shuffle_permutation_inverse = ~server_client_shuffle_permutation
# 43 Server Shuffle (Permutation) ephemeral Key 1 Inverse (remove 1) = ~(Server Shuffle (Permutation) ephemeral Key 1 (remove 1))
server_shuffle_permutation_ephemeral_key_1_inverse = ~server_shuffle_permutation_ephemeral_key_1
# 44 Server Shuffle (Permutation) ephemeral Key Applied = Server Client Shuffle (Permutation) Inverse < Server Shuffle (Permutation) ephemeral Key 1 Inverse (remove 1)
server_shuffle_permutation_ephemeral_key_applied = server_client_shuffle_permutation_inverse << server_shuffle_permutation_ephemeral_key_1_inverse
# line 82
# 45 Server Shuffle (Permutation) ephemeral Key Applied Scratch = Server Shuffle (Permutation) ephemeral Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied
server_shuffle_permutation_ephemeral_key_applied_scratch = server_shuffle_permutation_ephemeral_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 46 Server Shuffle (Permutation) ephemeral Key Applied Scratch Inverse = ~Server Shuffle (Permutation) ephemeral Key Applied Scratch
server_shuffle_permutation_ephemeral_key_applied_scratch_inverse = ~server_shuffle_permutation_ephemeral_key_applied_scratch
# 47 Outer Server Shuffle (Permutation) ephemeral Key Applied = Outer Server Shuffle (Permutation) Key < Outer Server Shuffle (Permutation) ephemeral Key
outer_server_shuffle_permutation_ephemeral_key_applied = outer_server_shuffle_permutation_key << outer_server_shuffle_permutation_ephemeral_key
# 48 Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) ephemeral Key Applied
alphabet_scratch_1 = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied
# 49 Alphabet Scratch 2 = Alphabet Scratch 1 << Server Shuffle (Permutation) ephemeral Key Applied Scratch Inverse
alphabet_scratch_2 = alphabet_scratch_1 << server_shuffle_permutation_ephemeral_key_applied_scratch_inverse
# 50 Server (Substitution) ephemeral Component Scratch 1 = Server (Substitution) ephemeral Random Component.column_substitution( Server (Substitution) ephemeral Unique Component Function ,Server (Substitution) ephemeral Unique Component)
server_substitution_ephemeral_component_scratch_1 = server_substitution_ephemeral_random_component.column_substitution(
server_substitution_ephemeral_unique_component_function,
server_substitution_ephemeral_unique_component.matrix[0]
)
# 51 Server (Substitution) ephemeral Component Scratch 2 = Server (Substitution) ephemeral Component Scratch 1 < Outer (Mutual) Function ephemeral Key Applied
server_substitution_ephemeral_component_scratch_2 = server_substitution_ephemeral_component_scratch_1 < outer_mutual_function_ephemeral_key_applied
# 52 Server (Substitution) ephemeral Component Scratch 3 = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2)
server_substitution_ephemeral_component_scratch_3 = alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_component_scratch_2 << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2)
# 52 Inner Function Key Scratch 2 Inverse = ~Inner Function Key Scratch 2
inner_function_key_scratch_2_inverse = ~inner_function_key_scratch_2
# 54 Server (Substitution) ephemeral Key Scratch = Server (Substitution) ephemeral Component Scratch 3 << Inner Function Key Scratch 2 Inverse
server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_component_scratch_3 << inner_function_key_scratch_2_inverse
# 55 Outer (Mutual) Function ephemeral Key Applied Inverse = ~Outer (Mutual) Function ephemeral Key Applied
outer_mutual_function_ephemeral_key_applied_inverse = ~outer_mutual_function_ephemeral_key_applied
# 56 Server (Substitution) ephemeral Key = Server (Substitution) ephemeral Key Scratch < Outer (Mutual) Function ephemeral Key Applied Inverse
server_substitution_ephemeral_key = server_substitution_ephemeral_key_scratch < outer_mutual_function_ephemeral_key_applied_inverse
# line 94
""" Server Tx (Phase 1) """
# 57 Inner Server Shuffle (Permutation) Key Applied = Server Shuffle (Permutation) ephemeral Key 1 (remove 1) << Server Shuffle (Permutation) Key
inner_server_shuffle_permutation_key_applied = server_shuffle_permutation_ephemeral_key_1 << server_shuffle_permutation_key
# 58 Outer Server Shuffle (Permutation) Key Applied = Inner Server Shuffle (Permutation) Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied
outer_server_shuffle_permutation_key_applied = inner_server_shuffle_permutation_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 59 Server (Substitution) ephemeral Key Scratch = Server (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied
server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied
# 86 Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) ephemeral Key Applied
#outer_shuffle_permutation = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied
## 87 Inner Shuffle (Permutation) = Outer Shuffle (Permutation) << Outer Server Shuffle (Permutation) Key Applied
#inner_shuffle_permutation = outer_shuffle_permutation << outer_server_shuffle_permutation_key_applied
## 88 Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch)
#translation_substitution = inner_shuffle_permutation ^ (
# server_substitution_ephemeral_key_scratch << inner_mutual_function_key_scratch) ^ (
# server_substitution_key_scratch << inner_mutual_function_key_scratch)
# line 108
""" Client Rx (Phase 2) """
# 62 Client (Substitution) Key A Scratch = Client (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied
client_substitution_key_a_scratch = client_substitution_key < outer_mutual_function_ephemeral_key_applied
# 63 Client (Substitution) ephemeral Key A Scratch = Client (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied
client_substitution_ephemeral_key_a_scratch = client_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied
# 64 Client Shuffle (Permutation) Key A Applied (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) << Client Shuffle (Permutation) ephemeral Key A (remove A)
client_shuffle_permutation_key_a_applied = client_shuffle_permutation_key_a << client_shuffle_permutation_ephemeral_key_a
# 65 Client Shuffle (Permutation) Key A Scratch (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied
client_shuffle_permutation_key_a_scratch = client_shuffle_permutation_key_a_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 66 Outer Client Shuffle (Permutation) ephemeral Key Applied = Outer Client Shuffle (Permutation) Key << Outer Client Shuffle (Permutation) ephemeral Key
outer_client_shuffle_permutation_ephemeral_key_applied = outer_client_shuffle_permutation_key << outer_client_shuffle_permutation_ephemeral_key
# 67 Outer Client Shuffle (Permutation) Function ephemeral Key Applied = Outer Client Shuffle (Permutation) Function Key << Outer Client Shuffle (Permutation) Function ephemeral Key
outer_client_shuffle_permutation_function_ephemeral_key_applied = outer_client_shuffle_permutation_function_key << outer_client_shuffle_permutation_function_ephemeral_key
# 68 Outer Client Shuffle (Permutation) Function Key Applied = Outer Client Shuffle (Permutation) ephemeral Key Applied << Outer Client Shuffle (Permutation) Function ephemeral Key Applied
outer_client_shuffle_permutation_function_key_applied = outer_client_shuffle_permutation_ephemeral_key_applied << outer_client_shuffle_permutation_function_ephemeral_key_applied
# 69 Outer Client Shuffle (Permutation) Function Key Applied Inverse = ~Outer Client Shuffle (Permutation) Function Key Applied
outer_client_shuffle_permutation_function_key_applied_inverse = ~outer_client_shuffle_permutation_function_key_applied
# 70 Alphabet Input Sequence Scratch = Outer Client Shuffle (Permutation) Function Key Applied Inverse << Alphabet Input Sequence
alphabet_input_sequence_scratch = outer_client_shuffle_permutation_function_key_applied_inverse << alphabet_input_sequence
# 89 Translation (Substitution) - Client Data = Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch)
#translation_substitution_client_data = translation_substitution ^ (
# shared_mutual_substitution_key_scratch << inner_mutual_function_key_scratch) ^ (
# client_substitution_key_a_scratch << inner_mutual_function_key_scratch) ^ (
# client_substitution_ephemeral_key_a_scratch << inner_mutual_function_key_scratch)
## 90 Inner Shuffle (Permutation) - CSKA+CSEKA = Translation (Substitution) - Client Data << Client Shuffle (Permutation) Key A Scratch (remove A)
#inner_shuffle_permutation_cska_cseka = translation_substitution_client_data << client_shuffle_permutation_key_a_scratch
## 91 Outer Shuffle (Permutation) - Client Rest = Inner Shuffle (Permutation) - CSKA+CSEKA << Outer Client Shuffle (Permutation) Function Key Applied
#outer_shuffle_permutation_client_rest = inner_shuffle_permutation_cska_cseka < outer_client_shuffle_permutation_function_key_applied
# line 130
""" Client Tx (Phase 3) """
# 71 Client Shuffle (Permutation) Key A Inverse (remove A) = ~Client Shuffle (Permutation) Key A (remove A)
client_shuffle_permutation_key_a_inverse = ~client_shuffle_permutation_key_a
# 72 Client Shuffle (Permutation) Key B (remove B) = Client Shuffle (Permutation) Key A Inverse (remove A) << Client Shuffle (Permutation) Key X
client_shuffle_permutation_key_b = client_shuffle_permutation_key_a_inverse << client_shuffle_permutation_key_x
# 73 Client Shuffle (Permutation) ephemeral Key A (remove A) Inverse = ~Client Shuffle (Permutation) ephemeral Key A (remove A)
client_shuffle_permutation_ephemeral_key_a_inverse = ~client_shuffle_permutation_ephemeral_key_a
# 74 Client Shuffle (Permutation) Key B Applied = Client Shuffle (Permutation) ephemeral Key B << Client Shuffle (Permutation) Key B (remove B)
client_shuffle_permutation_key_b_applied = client_shuffle_permutation_ephemeral_key_a_inverse << client_shuffle_permutation_key_b
# 75 Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch = Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied
outer_server_mutual_shuffle_permutation_function_key_scratch = outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# 76 Client Shuffle (Permutation) Key B Scratch = Client Shuffle (Permutation) Key B Applied < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch
client_shuffle_permutation_key_b_scratch = client_shuffle_permutation_key_b_applied < outer_server_mutual_shuffle_permutation_function_key_scratch
# 77 Client Shuffle (Permutation) Key X Scratch 2 = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch
client_shuffle_permutation_key_x_scratch_2 = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_key_scratch
# line 144
# 78 Outer Function Function Key Scratch = Outer (Mutual) Function Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied
outer_function_function_key_scratch = outer_mutual_function_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# 79 Inner (Mutual) Function Key Client Scratch = Inner (Mutual) Function Applied Key < Outer Function Function Key Scratch
inner_mutual_function_key_client_scratch = inner_mutual_function_applied_key < outer_function_function_key_scratch
# line 147
# 80 (Mutual) Function Key Scratch 2 = Inner (Mutual) Function Key Client Scratch << client_shuffle_permutation_key_x_scratch_2
mutual_function_key_scratch_2 = inner_mutual_function_key_client_scratch << client_shuffle_permutation_key_x_scratch_2
# 81 Outer (Mutual) Function Key Scratch = Outer (Mutual) Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied
outer_mutual_function_key_scratch = outer_mutual_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# 82 Client (Substitution) Key B Scratch = Client (Substitution) Key < Outer (Mutual) Function Key Scratch
client_substitution_key_b_scratch = client_substitution_key < outer_mutual_function_key_scratch
# 83 Client (Substitution) ephemeral Key B Scratch = Client (Substitution) ephemeral Key < Outer (Mutual) Function Key Scratch
client_substitution_ephemeral_key_b_scratch = client_substitution_ephemeral_key < outer_mutual_function_key_scratch
# 84 Shared (Mutual) (Substitution) ephemeral Key Client Scratch = Shared (Mutual) (Substitution) ephemeral Key < Outer (Mutual) Function Key Scratch
shared_mutual_substitution_ephemeral_key_client_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_key_scratch
# 92 Inner Shuffle (Permutation) - CSEKB +CSKB = Outer Shuffle (Permutation) - Client Rest << Client Shuffle (Permutation) Key B Scratch
#inner_shuffle_permutation_csekb_cskb = outer_shuffle_permutation_client_rest << client_shuffle_permutation_key_b_scratch
## 93 Translation (Substitution) DARC Data = Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2)
#translation_substitution_darc_data = inner_shuffle_permutation_csekb_cskb ^ (
# client_substitution_key_b_scratch << mutual_function_key_scratch_2) ^ (
# client_substitution_ephemeral_key_b_scratch << mutual_function_key_scratch_2) ^ (
# shared_mutual_substitution_ephemeral_key_client_scratch << mutual_function_key_scratch_2)
# line 175
""" Server Rx (Phase 4) """
# 85 Translation (Substitution) = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2)
translation_substitution = (
alphabet_scratch_2 ^
(server_substitution_key_scratch << inner_function_key_scratch_2) ^
(server_substitution_ephemeral_key_scratch << inner_function_key_scratch_2) ^
(shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^
(shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2)
)
a = 1