renamed keys

This commit is contained in:
2024-05-22 20:03:17 -05:00
parent 0927eb197c
commit 895143e746
4 changed files with 560 additions and 556 deletions

View File

@@ -5,201 +5,195 @@ from src.models import ServerEphemeralKeys, ServerPersistentKeys, ClientEphemera
ClientPersistentDataKeys, ClientEphemeralDataKeys, ClientEphemeralMediumKeys, ClientPersistentMediumKeys
import json
height = 10
height = 256
width = 7
block_size = 10
def darc_phase1(alphabet: AlphabetKey, server_keys: ServerKeys, mutual_keys: MutualKeys):
alphabet_phase1 = translate_data(alphabet, server_keys.Persistent.Data, server_keys.Ephemeral.Data, mutual_keys.Persistent.Data, mutual_keys.Ephemeral.Data)
medium = translate_medium(server_keys.Persistent.Medium, server_keys.Ephemeral.Medium, mutual_keys.Persistent.Medium, mutual_keys.Ephemeral.Medium)
alphabet_phase1 = translate_data(alphabet, server_keys.persistent.data, server_keys.ephemeral.data, mutual_keys.persistent.data, mutual_keys.ephemeral.data)
medium = translate_medium(server_keys.persistent.medium, server_keys.ephemeral.medium, mutual_keys.persistent.medium, mutual_keys.ephemeral.medium)
return alphabet_phase1, medium
def translate_data(alphabet: AlphabetKey, server_persistent_keys: ServerPersistentDataKeys, server_ephemeral_keys: ServerEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys):
function_ephemeral_key_applied = mutual_persistent_keys.Inner1 << mutual_ephemeral_keys.Inner1
outer_function_ephemeral_key_applied = mutual_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionKey
outer_function_function_ephemeral_key_applied = mutual_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionKey
outer_server_shuffle_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleKey << server_ephemeral_keys.OuterServerShuffleEphemeralKey
outer_server_shuffle_function_ephemeral_key_applied = mutual_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionKey
input_data = alphabet < outer_server_shuffle_ephemeral_key_applied
server_shuffle_ephemeral_key_applied = server_ephemeral_keys.ServerShuffleEphemeralKey << server_persistent_keys.ServerShuffleKey # TODO: should this be the other way around?
server_shuffle_ephemeral_key_applied = server_shuffle_ephemeral_key_applied < outer_server_shuffle_function_ephemeral_key_applied
input_data = input_data << server_shuffle_ephemeral_key_applied
mutual_inner_key = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_outer_key_1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
mutual_outer_key_3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3
# substitute_function_operands
outer_function_function = outer_function_function_ephemeral_key_applied
inner_function = function_ephemeral_key_applied
outer_function = outer_function_ephemeral_key_applied
operand = input_data
operand1 = server_persistent_keys.ServerKey < outer_function
operand2 = server_ephemeral_keys.ServerEphemeralKey < outer_function
server_inner_key = server_ephemeral_keys.inner_key_1 << server_persistent_keys.inner_key_1 # TODO: should this be the other way around?
server_inner_key = server_inner_key < mutual_outer_key_3
server_outer_key_1 = server_persistent_keys.outer_key_1 << server_ephemeral_keys.outer_key_1
inner_function_shuffled = inner_function < outer_function_function
operand = operand ^ (operand1 << inner_function_shuffled) ^ (operand2 << inner_function_shuffled)
return operand
input_data = alphabet < server_outer_key_1
input_data = input_data << server_inner_key
operand1 = server_persistent_keys.alpha_key_1 < mutual_outer_key_1
operand2 = server_ephemeral_keys.alpha_key_1 < mutual_outer_key_1
mutual_inner_key = mutual_inner_key < mutual_outer_key_2
solution = (operand1 << mutual_inner_key) ^ (operand2 << mutual_inner_key)
alpha_phase1 = input_data ^ solution
return alpha_phase1
def translate_medium(server_persistent_keys: ServerPersistentMediumKeys, server_ephemeral_keys: ServerEphemeralMediumKeys, mutual_persistent_keys: MutualPersistentMediumKeys, mutual_ephemeral_keys: MutualEphemeralMediumKeys):
function_ephemeral_key_applied = mutual_persistent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumKey
outer_function_ephemeral_key_applied = mutual_persistent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey
outer_function_function_ephemeral_key_applied = mutual_persistent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey
mutual_inner_key = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_outer_key_1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
input_data = AlphabetKey(matrix=[[0 for _ in range(width)] for _ in range(height)])
medium = AlphabetKey(matrix=[[0 for _ in range(width)] for _ in range(height)])
# substitute_function_operands
outer_function_function = outer_function_function_ephemeral_key_applied
inner_function = function_ephemeral_key_applied
outer_function = outer_function_ephemeral_key_applied
operand = input_data
operand1 = server_persistent_keys.ServerMediumKey < outer_function
operand2 = server_ephemeral_keys.ServerMediumEphemeralKey < outer_function
operand1 = server_persistent_keys.alpha_key_1 < mutual_outer_key_1
operand2 = server_ephemeral_keys.alpha_key_1 < mutual_outer_key_1
inner_function_shuffled = inner_function < outer_function_function
operand = operand ^ (operand1 << inner_function_shuffled) ^ (operand2 << inner_function_shuffled)
mutual_inner_key = mutual_inner_key < mutual_outer_key_2
operand = medium ^ (operand1 << mutual_inner_key) ^ (operand2 << mutual_inner_key)
return operand
def darc_phase2(alphabet: AlphabetKey, medium: AlphabetKey, client_keys: ClientKeys, mutual_keys: MutualKeys):
alphabet_phase2 = receive_alphabet(alphabet, client_keys.Persistent.Data, client_keys.Ephemeral.Data, mutual_keys.Persistent.Data , mutual_keys.Ephemeral.Data)
medium = receive_medium(medium, client_keys.Persistent.Medium, client_keys.Ephemeral.Medium, mutual_keys.Persistent.Medium, mutual_keys.Ephemeral.Medium)
alphabet_phase2 = receive_alphabet(alphabet, client_keys.persistent.data, client_keys.ephemeral.data, mutual_keys.persistent.data, mutual_keys.ephemeral.data)
medium = receive_medium(medium, client_keys.persistent.medium, client_keys.ephemeral.medium, mutual_keys.persistent.medium, mutual_keys.ephemeral.medium)
return alphabet_phase2, medium
def receive_alphabet(alphabet: AlphabetKey, client_persistent_keys: ClientPersistentDataKeys, client_ephemeral_keys: ClientEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys):
function_key_applied = mutual_persistent_keys.Inner1 << mutual_ephemeral_keys.Inner1
outer_function_key_applied = mutual_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionKey
outer_function_function_key_applied = mutual_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionKey
mutual_inner_key = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_outer_key_1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
mutual_outer_key_3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3
inner_function_key_applied = function_key_applied < outer_function_function_key_applied
operand = alphabet
operand1 = client_ephemeral_keys.ClientEphemeralKey < outer_function_key_applied
operand2 = client_persistent_keys.ClientKey < outer_function_key_applied
operand3 = mutual_persistent_keys.MutualKey < outer_function_key_applied
operand1 = client_ephemeral_keys.alpha_key_1 < mutual_outer_key_1
operand2 = client_persistent_keys.alpha_key_1 < mutual_outer_key_1
operand3 = mutual_persistent_keys.alpha_key_1 < mutual_outer_key_1
result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied)
mutual_inner_key = mutual_inner_key < mutual_outer_key_2
outer_server_shuffle_function_key_applied = mutual_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionKey
client_shuffle_key_a_applied = client_persistent_keys.ClientShuffleKeyA << client_ephemeral_keys.ClientShuffleEphemeralKeyA
result = alphabet ^ (operand1 << mutual_inner_key) ^ (operand2 << mutual_inner_key) ^ (operand3 << mutual_inner_key)
result = result << (client_shuffle_key_a_applied < outer_server_shuffle_function_key_applied)
client_inner_key = client_persistent_keys.inner_key_1 << client_ephemeral_keys.inner_key_1
client_inner_key = client_inner_key < mutual_outer_key_3
result = result << client_inner_key
client_outer_key_1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1
client_outer_key_2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2
result = result < (client_outer_key_1 << client_outer_key_2)
outer_client_shuffle_key_applied = client_persistent_keys.OuterClientShuffleKey << client_ephemeral_keys.OuterClientShuffleEphemeralKey
outer_client_shuffle_function_key_applied = client_persistent_keys.OuterClientShuffleFunctionKey << client_ephemeral_keys.OuterClientShuffleFunctionEphemeralKey
outer_client_shuffle_key_applied = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied
result = result < outer_client_shuffle_key_applied
return result
def receive_medium(medium: AlphabetKey, client_persistent_keys: ClientPersistentMediumKeys, client_ephemeral_keys: ClientEphemeralMediumKeys, mutual_persistent_keys: MutualPersistentMediumKeys, mutual_ephemeral_keys: MutualEphemeralMediumKeys):
function_key_applied = mutual_persistent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumKey
outer_function_key_applied = mutual_persistent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey
outer_function_function_key_applied = mutual_persistent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey
mutual_inner_key = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_outer_key_1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
mutual_outer_key_3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3
inner_function_key_applied = function_key_applied < outer_function_function_key_applied
operand = medium
operand1 = client_ephemeral_keys.ClientMediumEphemeralKey < outer_function_key_applied
operand2 = client_persistent_keys.ClientMediumKey < outer_function_key_applied
operand3 = mutual_persistent_keys.MutualMediumKey < outer_function_key_applied
mutual_inner_key = mutual_inner_key < mutual_outer_key_2
result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied)
operand1 = client_ephemeral_keys.alpha_key_1 < mutual_outer_key_1
operand2 = client_persistent_keys.alpha_key_1 < mutual_outer_key_1
operand3 = mutual_persistent_keys.alpha_key_1 < mutual_outer_key_1
client_shuffle_key_a_applied = client_persistent_keys.ClientShuffleMediumKeyA << client_ephemeral_keys.ClientShuffleMediumEphemeralKeyA
outer_server_shuffle_function_key_applied = mutual_persistent_keys.OuterServerShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterServerShuffleFunctionMediumEphemeralKey
client_shuffle_key_a_applied = client_shuffle_key_a_applied < outer_server_shuffle_function_key_applied
result = result << client_shuffle_key_a_applied
result = medium ^ (operand1 << mutual_inner_key) ^ (operand2 << mutual_inner_key) ^ (operand3 << mutual_inner_key)
outer_client_shuffle_key_applied = client_persistent_keys.OuterClientShuffleMediumKey << client_ephemeral_keys.OuterClientShuffleMediumEphemeralKey
outer_client_shuffle_function_key_applied = client_persistent_keys.OuterClientShuffleFunctionMediumKey << client_ephemeral_keys.OuterClientShuffleFunctionMediumEphemeralKey
outer_client_shuffle_key_applied = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied
result = result < outer_client_shuffle_key_applied
client_inner_key = client_persistent_keys.inner_key_1 << client_ephemeral_keys.inner_key_1
client_inner_key = client_inner_key < mutual_outer_key_3
result = result << client_inner_key
client_outer_key_1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1
client_outer_key2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2
client_outer_key_1 = client_outer_key_1 << client_outer_key2
result = result < client_outer_key_1
return result
def darc_phase3(alphabet: AlphabetKey, medium: AlphabetKey, client_keys: ClientKeys, mutual_keys: MutualKeys):
alphabet_phase3 = transmit_alphabet(alphabet, client_keys.Persistent.Data, client_keys.Ephemeral.Data, mutual_keys.Persistent.Data, mutual_keys.Ephemeral.Data)
medium = transmit_medium(medium, client_keys.Persistent.Medium, client_keys.Ephemeral.Medium, mutual_keys.Persistent.Medium, mutual_keys.Ephemeral.Medium)
alphabet_phase3 = transmit_alphabet(alphabet, client_keys.persistent.data, client_keys.ephemeral.data, mutual_keys.persistent.data, mutual_keys.ephemeral.data)
medium = transmit_medium(medium, client_keys.persistent.medium, client_keys.ephemeral.medium, mutual_keys.persistent.medium, mutual_keys.ephemeral.medium)
return alphabet_phase3, medium
def transmit_alphabet(alphabet: DarcKey, client_persistent_keys: ClientPersistentDataKeys, client_ephemeral_keys: ClientEphemeralDataKeys, mutual_persistent_keys: MutualPersistentDataKeys, mutual_ephemeral_keys: MutualEphemeralDataKeys):
outer_server_shuffle_function_key_applied = mutual_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionKey
outer_client_shuffle_key_applied = client_persistent_keys.OuterClientShuffleKey << client_ephemeral_keys.OuterClientShuffleEphemeralKey
outer_client_shuffle_function_key_applied = client_persistent_keys.OuterClientShuffleFunctionKey << client_ephemeral_keys.OuterClientShuffleFunctionEphemeralKey
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
mutual_outer_key_3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3
input_outer_client_shuffle_key = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied
input_outer_server_shuffle_function_key = outer_server_shuffle_function_key_applied << input_outer_client_shuffle_key
outer_function_function_key_applied = mutual_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionKey
outer_function_function_key_applied = outer_function_function_key_applied << input_outer_client_shuffle_key
client_outer_key_1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1
client_outer_key_2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2
function_key_applied = mutual_persistent_keys.Inner1 << mutual_ephemeral_keys.Inner1
function_key_applied = function_key_applied < outer_function_function_key_applied
client_outer_key = client_outer_key_1 << client_outer_key_2
reordered_shuffle_key_x = mutual_persistent_keys.ClientShuffleKeyX < input_outer_server_shuffle_function_key
mutual_outer_key_3 = mutual_outer_key_3 << client_outer_key
mutual_outer_key_2 = mutual_outer_key_2 << client_outer_key
function_ephemeral_key_applied = function_key_applied << reordered_shuffle_key_x
mutual_inner_key_1 = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_inner_key_1 = mutual_inner_key_1 < mutual_outer_key_2
client_shuffle_key_b = (~client_persistent_keys.ClientShuffleKeyA) << mutual_persistent_keys.ClientShuffleKeyX
client_shuffle_ephemeral_key_b = ~client_ephemeral_keys.ClientShuffleEphemeralKeyA
input_client_shuffle_key_b = client_shuffle_ephemeral_key_b << client_shuffle_key_b
input_client_shuffle_key_b = input_client_shuffle_key_b < input_outer_server_shuffle_function_key
shuffled_items = alphabet << input_client_shuffle_key_b
mutual_inner_key_2 = mutual_persistent_keys.inner_key_2 < mutual_outer_key_3
outer_function_key_applied = mutual_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionKey
input_outer_function_key = outer_function_key_applied << input_outer_client_shuffle_key
mutual_inner_key = mutual_inner_key_1 << mutual_inner_key_2
inner_function_key_applied = function_ephemeral_key_applied
operand = shuffled_items
operand1 = client_ephemeral_keys.ClientEphemeralKey < input_outer_function_key
operand2 = client_persistent_keys.ClientKey < input_outer_function_key
operand3 = mutual_ephemeral_keys.MutualKey < input_outer_function_key
inner_key_1 = ~client_persistent_keys.inner_key_1 << mutual_persistent_keys.inner_key_2
inner_key_2 = ~client_ephemeral_keys.inner_key_1
inner_key_3 = inner_key_2 << inner_key_1
inner_key_3 = inner_key_3 < mutual_outer_key_3
result = alphabet << inner_key_3
result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied)
mutual_outer_key_1 = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
outer_key_1 = mutual_outer_key_1 << client_outer_key
operand1 = client_ephemeral_keys.alpha_key_1 < outer_key_1
operand2 = client_persistent_keys.alpha_key_1 < outer_key_1
operand3 = mutual_ephemeral_keys.alpha_key_1 < outer_key_1
result = result ^ (operand1 << mutual_inner_key) ^ (operand2 << mutual_inner_key) ^ (operand3 << mutual_inner_key)
return result
def transmit_medium(medium: DarcKey, client_persistent_keys: ClientPersistentMediumKeys, client_ephemeral_keys: ClientEphemeralMediumKeys, mutual_persistent_keys: MutualPersistentMediumKeys, mutual_ephemeral_keys: MutualEphemeralMediumKeys):
client_shuffle_ephemeral_key_b = ~client_ephemeral_keys.ClientShuffleMediumEphemeralKeyA
outer_server_shuffle_function_key_applied = mutual_persistent_keys.OuterServerShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterServerShuffleFunctionMediumEphemeralKey
outer_client_shuffle_key_applied = client_persistent_keys.OuterClientShuffleMediumKey << client_ephemeral_keys.OuterClientShuffleMediumEphemeralKey
client_inner_key_1 = ~client_ephemeral_keys.inner_key_1
mutual_outer_key_3 = mutual_persistent_keys.outer_key_3 << mutual_ephemeral_keys.outer_key_3
client_outer_key_1 = client_persistent_keys.outer_key_1 << client_ephemeral_keys.outer_key_1
outer_client_suffle_function_key_applied = client_persistent_keys.OuterClientShuffleFunctionMediumKey << client_ephemeral_keys.OuterClientShuffleFunctionMediumEphemeralKey
input_outer_client_shuffle_key = outer_client_shuffle_key_applied << outer_client_suffle_function_key_applied
input_outer_server_shuffle_function_key = outer_server_shuffle_function_key_applied << input_outer_client_shuffle_key
client_outer_key_2 = client_persistent_keys.outer_key_2 << client_ephemeral_keys.outer_key_2
outer_key_1 = client_outer_key_1 << client_outer_key_2
outer_key_2 = mutual_outer_key_3 << outer_key_1
outer_function_function_key_applied = mutual_persistent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey
outer_function_function_key_applied = outer_function_function_key_applied << input_outer_client_shuffle_key
mutual_outer_key_2 = mutual_persistent_keys.outer_key_2 << mutual_ephemeral_keys.outer_key_2
outer_key_3 = mutual_outer_key_2 << outer_key_1
function_key_applied = mutual_persistent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumKey
function_key_applied = function_key_applied < outer_function_function_key_applied
mutual_inner_key_1 = mutual_persistent_keys.inner_key_1 << mutual_ephemeral_keys.inner_key_1
mutual_inner_key_1 = mutual_inner_key_1 < outer_key_3
reordered_shuffle_key_x = mutual_persistent_keys.ClientShuffleMediumKeyX < input_outer_server_shuffle_function_key
mutual_inner_key_2 = mutual_persistent_keys.inner_key_2 < outer_key_2
function_ephemeral_key_applied = function_key_applied << reordered_shuffle_key_x
inner_key_1 = mutual_inner_key_1 << mutual_inner_key_2
client_shuffle_key_b = (~client_persistent_keys.ClientShuffleMediumKeyA) << mutual_persistent_keys.ClientShuffleMediumKeyX
input_client_shuffle_key_b = client_shuffle_ephemeral_key_b << client_shuffle_key_b
input_client_shuffle_key_b = input_client_shuffle_key_b < input_outer_server_shuffle_function_key
client_shuffle_key_b = (~client_persistent_keys.inner_key_1) << mutual_persistent_keys.inner_key_2
input_client_shuffle_key_b = client_inner_key_1 << client_shuffle_key_b
input_client_shuffle_key_b = input_client_shuffle_key_b < outer_key_2
shuffled_items = medium << input_client_shuffle_key_b
outer_function_key_applied = mutual_persistent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey
input_outer_function_key = outer_function_key_applied << input_outer_client_shuffle_key
outer_function_key_applied = mutual_persistent_keys.outer_key_1 << mutual_ephemeral_keys.outer_key_1
input_outer_function_key = outer_function_key_applied << outer_key_1
inner_function_key_applied = function_ephemeral_key_applied
inner_function_key_applied = inner_key_1
operand = shuffled_items
operand1 = client_ephemeral_keys.ClientMediumEphemeralKey < input_outer_function_key
operand2 = client_persistent_keys.ClientMediumKey < input_outer_function_key
operand3 = mutual_ephemeral_keys.MutualMediumKey < input_outer_function_key
operand1 = client_ephemeral_keys.alpha_key_1 < input_outer_function_key
operand2 = client_persistent_keys.alpha_key_1 < input_outer_function_key
operand3 = mutual_ephemeral_keys.alpha_key_1 < input_outer_function_key
result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied)
return result
def merge_message(alphabet: DarcKey, medium: DarcKey, client_keys: ClientKeys, mutual_keys: MutualKeys, input_sequence: list[int]):
outer_client_shuffle_alphabet_key_applied = client_keys.Persistent.Data.OuterClientShuffleKey << client_keys.Ephemeral.Data.OuterClientShuffleEphemeralKey
outer_client_shuffle_function_alphabet_key_applied = client_keys.Persistent.Data.OuterClientShuffleFunctionKey << client_keys.Ephemeral.Data.OuterClientShuffleFunctionEphemeralKey
outer_client_shuffle_alphabet_key_applied = ~(outer_client_shuffle_alphabet_key_applied << outer_client_shuffle_function_alphabet_key_applied)
client_outer_key_1 = client_keys.persistent.data.outer_key_1 << client_keys.ephemeral.data.outer_key_1
client_outer_key_2 = client_keys.persistent.data.outer_key_2 << client_keys.ephemeral.data.outer_key_2
client_outer_key_1 = ~(client_outer_key_1 << client_outer_key_2)
msg_len = len(input_sequence)
eof_arr = AlphabetKey.init_matrix(width, height, 255).matrix[0]
@@ -210,109 +204,106 @@ def merge_message(alphabet: DarcKey, medium: DarcKey, client_keys: ClientKeys, m
else:
padded_input_sequence = OuterShuffleKey(matrix=[input_sequence])
input_sequence_applied = outer_client_shuffle_alphabet_key_applied << padded_input_sequence
client_outer_key_1 = client_outer_key_1 << padded_input_sequence
outer_client_shuffle_medium_key_applied = client_keys.Persistent.Medium.OuterClientShuffleMediumKey << client_keys.Ephemeral.Medium.OuterClientShuffleMediumEphemeralKey
outer_client_shuffle_function_medium_key_applied = client_keys.Persistent.Medium.OuterClientShuffleFunctionMediumKey << client_keys.Ephemeral.Medium.OuterClientShuffleFunctionMediumEphemeralKey
client_med_outer_key_1 = client_keys.persistent.medium.outer_key_1 << client_keys.ephemeral.medium.outer_key_1
client_med_outer_key_2 = client_keys.persistent.medium.outer_key_2 << client_keys.ephemeral.medium.outer_key_2
outer_client_shuffle_medium_key_applied = outer_client_shuffle_medium_key_applied << outer_client_shuffle_function_medium_key_applied
client_med_outer_key_1 = client_med_outer_key_1 << client_med_outer_key_2
input_sequence_applied = input_sequence_applied << outer_client_shuffle_medium_key_applied
message = alphabet < input_sequence_applied
client_outer_key_1 = client_outer_key_1 << client_med_outer_key_1
message = alphabet < client_outer_key_1
message_pad_key = ~outer_client_shuffle_medium_key_applied
message_pad_key = ~client_med_outer_key_1
if msg_len < height:
message.matrix[message_pad_key.matrix[0][msg_len]] = eof_arr
position_function_key_applied = mutual_keys.Persistent.Medium.PositionFunctionMediumKey << mutual_keys.Ephemeral.Medium.PositionFunctionMediumEphemeralKey
outer_position_function_key_applied = mutual_keys.Persistent.Medium.OuterPositionFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionFunctionMediumEphemeralKey
outer_position_shuffle_key_applied = mutual_keys.Persistent.Medium.OuterPositionShuffleMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionShuffleMediumEphemeralKey
mutual_inner_key_3 = mutual_keys.persistent.medium.inner_key_3 << mutual_keys.ephemeral.medium.inner_key_3
mutual_outer_key_6 = mutual_keys.persistent.medium.outer_key_6 << mutual_keys.ephemeral.medium.outer_key_6
mutual_outer_key_4 = mutual_keys.persistent.medium.outer_key_4 << mutual_keys.ephemeral.medium.outer_key_4
outer_position_function_key_applied = outer_position_shuffle_key_applied << outer_position_function_key_applied
outer_key_1 = mutual_outer_key_4 << mutual_outer_key_6
outer_client_shuffle_medium_key_applied = ~outer_client_shuffle_medium_key_applied
outer_position_function_key_applied = ~(outer_client_shuffle_medium_key_applied << outer_position_function_key_applied)
client_med_outer_key_1 = ~client_med_outer_key_1
outer_key_1 = ~(client_med_outer_key_1 << outer_key_1)
inner_function_key_applied = position_function_key_applied < outer_position_function_key_applied
mutual_inner_key_3 = mutual_inner_key_3 < outer_key_1
operand = medium
operand1 = message
message = medium ^ (message << mutual_inner_key_3)
message = operand ^ (operand1 << inner_function_key_applied)
mutual_outer_key_5 = mutual_keys.persistent.medium.outer_key_5 << mutual_keys.ephemeral.medium.outer_key_5
mutual_inner_key = mutual_keys.persistent.medium.inner_key_4 << mutual_keys.ephemeral.medium.inner_key_2
outer_position_shuffle_function_key_applied = mutual_keys.Persistent.Medium.OuterPositionShuffleFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionShuffleFunctionMediumEphemeralKey
position_shuffle_key_applied = mutual_keys.Persistent.Medium.PositionShuffleMediumKey << mutual_keys.Ephemeral.Medium.PositionShuffleMediumEphemeralKey
mutual_outer_key_4 = client_med_outer_key_1 << mutual_outer_key_4
outer_key_2 = mutual_outer_key_5 << outer_key_1
outer_position_shuffle_key_applied = outer_client_shuffle_medium_key_applied << outer_position_shuffle_key_applied
outer_position_shuffle_function_key_applied = outer_position_shuffle_function_key_applied << outer_position_function_key_applied
message = message << (position_shuffle_key_applied < outer_position_shuffle_function_key_applied)
message = message < outer_position_shuffle_key_applied
message = message << (mutual_inner_key < outer_key_2)
message = message < mutual_outer_key_4
return message
def darc_phase_4(alphabet: AlphabetKey, darc_message: AlphabetKey, server_keys: ServerKeys, mutual_keys: MutualKeys):
outer_position_function_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterPositionFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionFunctionMediumEphemeralKey
outer_position_shuffle_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterPositionShuffleMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionShuffleMediumEphemeralKey
outer_position_function_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_6 << mutual_keys.ephemeral.medium.outer_key_6
outer_position_shuffle_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_4 << mutual_keys.ephemeral.medium.outer_key_4
outer_position_function_ephemeral_key_applied = ~(outer_position_shuffle_ephemeral_key_applied << outer_position_function_ephemeral_key_applied)
outer_position_shuffle_ephemeral_key_applied = ~outer_position_shuffle_ephemeral_key_applied
outer_position_shuffle_function_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterPositionShuffleFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterPositionShuffleFunctionMediumEphemeralKey
outer_position_shuffle_function_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_5 << mutual_keys.ephemeral.medium.outer_key_5
outer_position_shuffle_function_ephemeral_key_applied = outer_position_shuffle_function_ephemeral_key_applied << outer_position_function_ephemeral_key_applied
outer_function_function_medium_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterFunctionFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterFunctionFunctionMediumEphemeralKey
outer_server_shuffle_function_ephemeral_key_applied = mutual_keys.Persistent.Data.OuterServerShuffleFunctionKey << mutual_keys.Ephemeral.Data.OuterServerShuffleFunctionKey
outer_function_function_medium_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_2 << mutual_keys.ephemeral.medium.outer_key_2
outer_server_shuffle_function_ephemeral_key_applied = mutual_keys.persistent.data.outer_key_3 << mutual_keys.ephemeral.data.outer_key_3
outer_server_shuffle_function_medium_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterServerShuffleFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterServerShuffleFunctionMediumEphemeralKey
outer_server_shuffle_function_medium_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_3 << mutual_keys.ephemeral.medium.outer_key_3
function_medium_ephemeral_key_applied = mutual_keys.Persistent.Medium.FunctionMediumKey << mutual_keys.Ephemeral.Medium.FunctionMediumKey
function_medium_ephemeral_key_applied = mutual_keys.persistent.medium.inner_key_1 << mutual_keys.ephemeral.medium.inner_key_1
client_shuffle_medium_key_x = mutual_keys.Persistent.Medium.ClientShuffleMediumKeyX < outer_server_shuffle_function_medium_ephemeral_key_applied
client_shuffle_medium_key_x = mutual_keys.persistent.medium.inner_key_2 < outer_server_shuffle_function_medium_ephemeral_key_applied
client_shuffle_medium_key_x = (function_medium_ephemeral_key_applied < outer_function_function_medium_ephemeral_key_applied) << client_shuffle_medium_key_x
position_shuffle_ephemeral_key_applied = mutual_keys.Persistent.Medium.PositionShuffleMediumKey << mutual_keys.Ephemeral.Medium.PositionShuffleMediumEphemeralKey
position_shuffle_ephemeral_key_applied = mutual_keys.persistent.medium.inner_key_4 << mutual_keys.ephemeral.medium.inner_key_2
position_shuffle_ephemeral_key_applied = position_shuffle_ephemeral_key_applied < outer_position_shuffle_function_ephemeral_key_applied
client_shuffle_medium_key_x = client_shuffle_medium_key_x << position_shuffle_ephemeral_key_applied
outer_function_medium_ephemeral_key_applied = mutual_keys.Persistent.Medium.OuterFunctionMediumKey << mutual_keys.Ephemeral.Medium.OuterFunctionMediumEphemeralKey
outer_function_medium_ephemeral_key_applied = mutual_keys.persistent.medium.outer_key_1 << mutual_keys.ephemeral.medium.outer_key_1
rx_data = darc_message < outer_position_shuffle_ephemeral_key_applied
inner_key = client_shuffle_medium_key_x
operand = rx_data
operand1 = server_keys.Persistent.Medium.ServerMediumKey < outer_function_medium_ephemeral_key_applied
operand2 = server_keys.Ephemeral.Medium.ServerMediumEphemeralKey < outer_function_medium_ephemeral_key_applied
operand3 = mutual_keys.Persistent.Medium.MutualMediumKey < outer_function_medium_ephemeral_key_applied
operand4 = mutual_keys.Ephemeral.Medium.MutualMediumKey < outer_function_medium_ephemeral_key_applied
operand1 = server_keys.persistent.medium.alpha_key_1 < outer_function_medium_ephemeral_key_applied
operand2 = server_keys.ephemeral.medium.alpha_key_1 < outer_function_medium_ephemeral_key_applied
operand3 = mutual_keys.persistent.medium.alpha_key_1 < outer_function_medium_ephemeral_key_applied
operand4 = mutual_keys.ephemeral.medium.alpha_key_1 < outer_function_medium_ephemeral_key_applied
rx_data = operand ^ (operand1 << inner_key) ^ (operand2 << inner_key) ^ (operand3 << inner_key) ^ (operand4 << inner_key)
position_function_ephemeral_key_applied = mutual_keys.Persistent.Medium.PositionFunctionMediumKey << mutual_keys.Ephemeral.Medium.PositionFunctionMediumEphemeralKey
position_function_ephemeral_key_applied = mutual_keys.persistent.medium.inner_key_3 << mutual_keys.ephemeral.medium.inner_key_3
rx_data = rx_data << (~(position_shuffle_ephemeral_key_applied) << (~position_function_ephemeral_key_applied < outer_position_function_ephemeral_key_applied))
client_shuffle_key_x = mutual_keys.Persistent.Data.ClientShuffleKeyX < outer_server_shuffle_function_ephemeral_key_applied
outer_function_function_ephemeral_key_applied = mutual_keys.Persistent.Data.OuterFunctionFunctionKey << mutual_keys.Ephemeral.Data.OuterFunctionFunctionKey
client_shuffle_key_x = mutual_keys.persistent.data.inner_key_2 < outer_server_shuffle_function_ephemeral_key_applied
outer_function_function_ephemeral_key_applied = mutual_keys.persistent.data.outer_key_2 << mutual_keys.ephemeral.data.outer_key_2
function_ephemeral_key_applied = mutual_keys.Persistent.Data.Inner1 << mutual_keys.Ephemeral.Data.Inner1
function_ephemeral_key_applied = mutual_keys.persistent.data.inner_key_1 << mutual_keys.ephemeral.data.inner_key_1
function_ephemeral_key_applied = (function_ephemeral_key_applied < outer_function_function_ephemeral_key_applied) << client_shuffle_key_x
server_shuffle_ephemeral_key_applied = ~(server_keys.Persistent.Data.ServerShuffleKey << mutual_keys.Persistent.Data.ClientShuffleKeyX) << ~(server_keys.Ephemeral.Data.ServerShuffleEphemeralKey)
server_shuffle_ephemeral_key_applied = ~(server_keys.persistent.data.inner_key_1 << mutual_keys.persistent.data.inner_key_2) << ~(server_keys.ephemeral.data.inner_key_1)
server_shuffle_ephemeral_key_applied = ~(server_shuffle_ephemeral_key_applied < outer_server_shuffle_function_ephemeral_key_applied)
outer_server_shuffle_ephemeral_key_applied = server_keys.Persistent.Data.OuterServerShuffleKey << server_keys.Ephemeral.Data.OuterServerShuffleEphemeralKey
outer_server_shuffle_ephemeral_key_applied = server_keys.persistent.data.outer_key_1 << server_keys.ephemeral.data.outer_key_1
alpha_prep = (alphabet < outer_server_shuffle_ephemeral_key_applied) << server_shuffle_ephemeral_key_applied
outer_function_ephemeral_key_applied = mutual_keys.Persistent.Data.OuterFunctionKey << mutual_keys.Ephemeral.Data.OuterFunctionKey
outer_function_ephemeral_key_applied = mutual_keys.persistent.data.outer_key_1 << mutual_keys.ephemeral.data.outer_key_1
inner_key = function_ephemeral_key_applied
operand = alpha_prep
operand1 = server_keys.Persistent.Data.ServerKey < outer_function_ephemeral_key_applied
operand2 = server_keys.Ephemeral.Data.ServerEphemeralKey < outer_function_ephemeral_key_applied
operand3 = mutual_keys.Persistent.Data.MutualKey < outer_function_ephemeral_key_applied
operand4 = mutual_keys.Ephemeral.Data.MutualKey < outer_function_ephemeral_key_applied
operand1 = server_keys.persistent.data.alpha_key_1 < outer_function_ephemeral_key_applied
operand2 = server_keys.ephemeral.data.alpha_key_1 < outer_function_ephemeral_key_applied
operand3 = mutual_keys.persistent.data.alpha_key_1 < outer_function_ephemeral_key_applied
operand4 = mutual_keys.ephemeral.data.alpha_key_1 < outer_function_ephemeral_key_applied
alpha_prep = operand ^ (operand1 << inner_key) ^ (operand2 << inner_key) ^ (operand3 << inner_key) ^ (operand4 << inner_key)
return resolve_message(alpha_prep.matrix, rx_data.matrix)
@@ -354,103 +345,103 @@ if __name__ == "__main__":
#mutual_ephemeral_keys = {k: {"matrix": v} for k, v in mutual_ephemeral_keys.items()}
#client_keys = ClientKeys(
# Persistent=ClientPersistentKeys(
# Data=ClientPersistentDataKeys(
# OuterClientShuffleKey=client_persistent_keys["OuterClientShuffleKey"],
# OuterClientShuffleFunctionKey=client_persistent_keys["OuterClientShuffleFunctionKey"],
# ClientKey=client_persistent_keys["ClientKey"],
# ClientShuffleKeyA=client_persistent_keys["ClientShuffleKeyA"]
# persistent=ClientPersistentKeys(
# data=ClientPersistentDataKeys(
# outer_key_1=client_persistent_keys["outer_key_1"],
# outer_key_2=client_persistent_keys["outer_key_2"],
# alpha_key_1=client_persistent_keys["alpha_key_1"],
# inner_key_2=client_persistent_keys["inner_key_2"]
# ),
# Medium=ClientPersistentMediumKeys(
# OuterClientShuffleMediumKey=client_persistent_keys["OuterClientShuffleMediumKey"],
# OuterClientShuffleFunctionMediumKey=client_persistent_keys["OuterClientShuffleFunctionMediumKey"],
# ClientShuffleMediumKeyA=client_persistent_keys["ClientShuffleMediumKeyA"],
# ClientMediumKey=client_persistent_keys["ClientMediumKey"]
# medium=ClientPersistentMediumKeys(
# outer_key_1=client_persistent_keys["outer_key_1"],
# outer_key_2=client_persistent_keys["outer_key_2"],
# inner_key_2=client_persistent_keys["inner_key_2"],
# alpha_key_1=client_persistent_keys["alpha_key_1"]
# )
# ),
# Ephemeral=ClientEphemeralKeys(
# Data=ClientEphemeralDataKeys(
# OuterClientShuffleEphemeralKey=client_ephemeral_keys["OuterClientShuffleEphemeralKey"],
# OuterClientShuffleFunctionEphemeralKey=client_ephemeral_keys["OuterClientShuffleFunctionEphemeralKey"],
# ClientEphemeralKey=client_ephemeral_keys["ClientEphemeralKey"],
# ClientShuffleEphemeralKeyA=client_ephemeral_keys["ClientShuffleEphemeralKeyA"]
# ephemeral=ClientEphemeralKeys(
# data=ClientEphemeralDataKeys(
# outer_key_1=client_ephemeral_keys["outer_key_1"],
# outer_key_2=client_ephemeral_keys["outer_key_2"],
# alpha_key_1=client_ephemeral_keys["alpha_key_1"],
# inner_key_2=client_ephemeral_keys["inner_key_2"]
# ),
# Medium=ClientEphemeralMediumKeys(
# OuterClientShuffleMediumEphemeralKey=client_ephemeral_keys["OuterClientShuffleMediumEphemeralKey"],
# OuterClientShuffleFunctionMediumEphemeralKey=client_ephemeral_keys["OuterClientShuffleFunctionMediumEphemeralKey"],
# ClientShuffleMediumEphemeralKeyA=client_ephemeral_keys["ClientShuffleMediumEphemeralKeyA"],
# ClientMediumEphemeralKey=client_ephemeral_keys["ClientMediumEphemeralKey"]
# medium=ClientEphemeralMediumKeys(
# outer_key_1=client_ephemeral_keys["outer_key_1"],
# outer_key_2=client_ephemeral_keys["outer_key_2"],
# inner_key_2=client_ephemeral_keys["inner_key_2"],
# alpha_key_1=client_ephemeral_keys["alpha_key_1"]
# )
# )
#)
#server_keys = ServerKeys(
# Persistent=ServerPersistentKeys(
# Data=ServerPersistentDataKeys(
# OuterServerShuffleKey=server_persistent_keys["OuterServerShuffleKey"],
# ServerKey=server_persistent_keys["ServerKey"],
# ServerShuffleKey=server_persistent_keys["ServerShuffleKey"]
# persistent=ServerPersistentKeys(
# data=ServerPersistentDataKeys(
# outer_key_1=server_persistent_keys["outer_key_1"],
# alpha_key_1=server_persistent_keys["alpha_key_1"],
# inner_key_2=server_persistent_keys["inner_key_2"]
# ),
# Medium=ServerPersistentMediumKeys(
# ServerMediumKey=server_persistent_keys["ServerMediumKey"],
# medium=ServerPersistentMediumKeys(
# alpha_key_1=server_persistent_keys["alpha_key_1"],
# )
# ),
# Ephemeral=ServerEphemeralKeys(
# Data=ServerEphemeralDataKeys(
# OuterServerShuffleEphemeralKey=server_ephemeral_keys["OuterServerShuffleEphemeralKey"],
# ServerEphemeralKey=server_ephemeral_keys["ServerEphemeralKey"],
# ServerShuffleEphemeralKey=server_ephemeral_keys["ServerShuffleEphemeralKey"]
# ephemeral=ServerEphemeralKeys(
# data=ServerEphemeralDataKeys(
# outer_key_1=server_ephemeral_keys["outer_key_1"],
# alpha_key_1=server_ephemeral_keys["alpha_key_1"],
# inner_key_2=server_ephemeral_keys["inner_key_2"]
# ),
# Medium=ServerEphemeralMediumKeys(
# ServerMediumEphemeralKey=server_ephemeral_keys["ServerMediumEphemeralKey"],
# medium=ServerEphemeralMediumKeys(
# alpha_key_1=server_ephemeral_keys["alpha_key_1"],
# )
# )
#)
#mutual_keys = MutualKeys(
# Persistent=MutualPersistentKeys(
# Data=MutualPersistentDataKeys(
# OuterFunctionKey=server_persistent_keys["OuterFunctionKey"],
# OuterFunctionFunctionKey=server_persistent_keys["OuterFunctionFunctionKey"],
# OuterServerShuffleFunctionKey=server_persistent_keys["OuterServerShuffleFunctionKey"],
# MutualKey=server_persistent_keys["MutualKey"],
# Inner1=server_persistent_keys["FunctionKey"],
# ClientShuffleKeyX=server_persistent_keys["ClientShuffleKeyX"],
# persistent=MutualPersistentKeys(
# data=MutualPersistentDataKeys(
# outer_key_1=server_persistent_keys["outer_key_1"],
# outer_key_2=server_persistent_keys["outer_key_2"],
# outer_key_6=server_persistent_keys["outer_key_6"],
# alpha_key_1=server_persistent_keys["alpha_key_1"],
# inner_key_2=server_persistent_keys["FunctionKey"],
# inner_key_1=server_persistent_keys["inner_key_1"],
# ),
# Medium=MutualPersistentMediumKeys(
# MutualMediumKey=server_persistent_keys["MutualMediumKey"],
# OuterFunctionMediumKey=server_persistent_keys["OuterFunctionMediumKey"],
# OuterFunctionFunctionMediumKey=server_persistent_keys["OuterFunctionFunctionMediumKey"],
# OuterServerShuffleFunctionMediumKey=server_persistent_keys["OuterServerShuffleFunctionMediumKey"],
# FunctionMediumKey=server_persistent_keys["FunctionMediumKey"],
# ClientShuffleMediumKeyX=server_persistent_keys["ClientShuffleMediumKeyX"],
# OuterPositionShuffleMediumKey=server_persistent_keys["OuterPositionShuffleMediumKey"],
# OuterPositionShuffleFunctionMediumKey=server_persistent_keys["OuterPositionShuffleFunctionMediumKey"],
# OuterPositionFunctionMediumKey=server_persistent_keys["OuterPositionFunctionMediumKey"],
# PositionFunctionMediumKey=server_persistent_keys["PositionFunctionMediumKey"],
# PositionShuffleMediumKey=server_persistent_keys["PositionShuffleMediumKey"],
# medium=MutualPersistentMediumKeys(
# alpha_key_1=server_persistent_keys["alpha_key_1"],
# outer_key_1=server_persistent_keys["outer_key_1"],
# outer_key_2=server_persistent_keys["outer_key_2"],
# outer_key_6=server_persistent_keys["outer_key_6"],
# inner_key_2=server_persistent_keys["inner_key_2"],
# inner_key_1=server_persistent_keys["inner_key_1"],
# outer_key_3=server_persistent_keys["outer_key_3"],
# outer_key_5=server_persistent_keys["outer_key_5"],
# outer_key_4=server_persistent_keys["outer_key_4"],
# inner_key_3=server_persistent_keys["inner_key_3"],
# inner_key_1=server_persistent_keys["inner_key_1"],
# )
# ),
# Ephemeral=MutualEphemeralKeys(
# Data=MutualEphemeralDataKeys(
# MutualKey=mutual_ephemeral_keys["MutualEphemeralKey"],
# Inner1=mutual_ephemeral_keys["FunctionEphemeralKey"],
# OuterFunctionKey=mutual_ephemeral_keys["OuterFunctionEphemeralKey"],
# OuterFunctionFunctionKey=mutual_ephemeral_keys["OuterFunctionFunctionEphemeralKey"],
# OuterServerShuffleFunctionKey=mutual_ephemeral_keys["OuterServerShuffleFunctionEphemeralKey"]
# ephemeral=MutualEphemeralKeys(
# data=MutualEphemeralDataKeys(
# alpha_key_1=mutual_ephemeral_keys["MutualEphemeralKey"],
# inner_key_2=mutual_ephemeral_keys["FunctionEphemeralKey"],
# outer_key_1=mutual_ephemeral_keys["OuterFunctionEphemeralKey"],
# outer_key_2=mutual_ephemeral_keys["OuterFunctionFunctionEphemeralKey"],
# outer_key_6=mutual_ephemeral_keys["OuterServerShuffleFunctionEphemeralKey"]
# ),
# Medium=MutualEphemeralMediumKeys(
# MutualMediumKey=mutual_ephemeral_keys["MutualMediumEphemeralKey"],
# FunctionMediumKey=mutual_ephemeral_keys["FunctionMediumEphemeralKey"],
# PositionFunctionMediumEphemeralKey=mutual_ephemeral_keys["PositionFunctionMediumEphemeralKey"],
# OuterFunctionMediumEphemeralKey=mutual_ephemeral_keys["OuterFunctionMediumEphemeralKey"],
# OuterFunctionFunctionMediumEphemeralKey=mutual_ephemeral_keys["OuterFunctionFunctionMediumEphemeralKey"],
# OuterPositionFunctionMediumEphemeralKey=mutual_ephemeral_keys["OuterPositionFunctionMediumEphemeralKey"],
# OuterServerShuffleFunctionMediumEphemeralKey=mutual_ephemeral_keys["OuterServerShuffleFunctionMediumEphemeralKey"],
# OuterPositionShuffleFunctionMediumEphemeralKey=mutual_ephemeral_keys["OuterPositionShuffleFunctionMediumEphemeralKey"],
# PositionShuffleMediumEphemeralKey=mutual_ephemeral_keys["PositionShuffleMediumEphemeralKey"],
# OuterPositionShuffleMediumEphemeralKey=mutual_ephemeral_keys["OuterPositionShuffleMediumEphemeralKey"]
# medium=MutualEphemeralMediumKeys(
# alpha_key_1=mutual_ephemeral_keys["MutualMediumEphemeralKey"],
# inner_key_2=mutual_ephemeral_keys["FunctionMediumEphemeralKey"],
# inner_key_3=mutual_ephemeral_keys["inner_key_3"],
# outer_key_1=mutual_ephemeral_keys["outer_key_1"],
# outer_key_2=mutual_ephemeral_keys["outer_key_2"],
# outer_key_6=mutual_ephemeral_keys["outer_key_6"],
# outer_key_3=mutual_ephemeral_keys["outer_key_3"],
# outer_key_5=mutual_ephemeral_keys["outer_key_5"],
# inner_key_2=mutual_ephemeral_keys["inner_key_2"],
# outer_key_4=mutual_ephemeral_keys["outer_key_4"]
# )
# )
@@ -463,17 +454,17 @@ if __name__ == "__main__":
client_keys = ClientKeys.random_init(height, width)
alphabet = AlphabetKey.init_matrix(width, height, 255)
server_keys.Persistent.Data.ServerKey = server_keys.Persistent.Data.ServerKey ^ mutual_keys.Persistent.Data.MutualKey
server_keys.Persistent.Medium.ServerMediumKey = server_keys.Persistent.Medium.ServerMediumKey ^ mutual_keys.Persistent.Medium.MutualMediumKey
server_keys.persistent.data.alpha_key_1 = server_keys.persistent.data.alpha_key_1 ^ mutual_keys.persistent.data.alpha_key_1
server_keys.persistent.medium.alpha_key_1 = server_keys.persistent.medium.alpha_key_1 ^ mutual_keys.persistent.medium.alpha_key_1
mutual_keys.Persistent.Data.MutualKey = mutual_keys.Persistent.Data.MutualKey ^ client_keys.Persistent.Data.ClientKey
mutual_keys.Persistent.Medium.MutualMediumKey = mutual_keys.Persistent.Medium.MutualMediumKey ^ client_keys.Persistent.Medium.ClientMediumKey
mutual_keys.persistent.data.alpha_key_1 = mutual_keys.persistent.data.alpha_key_1 ^ client_keys.persistent.data.alpha_key_1
mutual_keys.persistent.medium.alpha_key_1 = mutual_keys.persistent.medium.alpha_key_1 ^ client_keys.persistent.medium.alpha_key_1
(phase1_alphabet, phase1_medium) = darc_phase1(alphabet, server_keys, mutual_keys)
(phase2_alphabet, phase2_medium) = darc_phase2(phase1_alphabet, phase1_medium, client_keys, mutual_keys)
(phase3_alphabet, phase3_medium) = darc_phase3(phase2_alphabet, phase2_medium, client_keys, mutual_keys)
original_message = [ 0, 2, 4, 6, 0, 5, 9, 9, 1, 7 ]
original_message = OuterShuffleKey.init_matrix(height).matrix[0]
darc_message = merge_message(phase3_alphabet, phase3_medium, client_keys, mutual_keys, original_message)
message = darc_phase_4(alphabet, darc_message, server_keys, mutual_keys)

View File

@@ -22,7 +22,7 @@ if __name__ == "__main__":
['16', '26', '30', '46', '50', '66', '79']
], key_type=DarcKeyTypes.alphabet)
""" Persistent Keys Generation """
""" persistent Keys Generation """
"""
Outer (Mutual) (Substitution) Function Key 9 7 4 2 5 3 0 6 1 8
Outer (Mutual) (Substitution) Function Function Key 8 1 4 5 2 3 7 6 0 9
@@ -343,51 +343,51 @@ if __name__ == "__main__":
server_mutual_substitution_key_4 = server_substitution_component_1 ^ shared_mutual_substitution_component_5
""" Ephemeral Key Generation """
""" ephemeral Key Generation """
"""
Outer (Mutual) (Substitution) Function Ephemeral Key 0 9 6 2 1 5 3 8 7 4
Outer (Mutual) (Substitution) Function Function Ephemeral Key 2 3 9 7 6 0 1 4 8 5
Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key 0 8 5 9 7 3 1 4 6 2
Outer Client Shuffle (Permutation) Ephemeral Key 1 4 2 9 5 7 8 3 0 6
Outer Client Shuffle (Permutation) Function Ephemeral Key 4 3 2 5 1 6 7 8 0 9
Outer Server Shuffle (Permutation) Ephemeral Key 7 5 2 1 8 4 3 6 9 0
Outer (Mutual) (Substitution) Function ephemeral Key 0 9 6 2 1 5 3 8 7 4
Outer (Mutual) (Substitution) Function Function ephemeral Key 2 3 9 7 6 0 1 4 8 5
Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key 0 8 5 9 7 3 1 4 6 2
Outer Client Shuffle (Permutation) ephemeral Key 1 4 2 9 5 7 8 3 0 6
Outer Client Shuffle (Permutation) Function ephemeral Key 4 3 2 5 1 6 7 8 0 9
Outer Server Shuffle (Permutation) ephemeral Key 7 5 2 1 8 4 3 6 9 0
"""
# Outer (Mutual) (Substitution) Function Ephemeral Key
# 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)
# Outer (Mutual) (Substitution) Function Function Ephemeral Key
# 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)
# Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key
# 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)
# Outer Client Shuffle (Permutation) Ephemeral Key
# 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)
# Outer Client Shuffle (Permutation) Function Ephemeral Key
# 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)
# Outer Server Shuffle (Permutation) Ephemeral Key
# 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)
"""
(Mutual) (Substitution) Function Ephemeral Key 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
Client Shuffle (Permutation) Ephemeral Key A (remove A) 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
Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) 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
(Mutual) (Substitution) Function ephemeral Key 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
Client Shuffle (Permutation) ephemeral Key A (remove A) 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
Server Shuffle (Permutation) ephemeral Key 1 (remove 1) 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
"""
# (Mutual) (Substitution) Function Ephemeral Key
# (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'],
@@ -401,7 +401,7 @@ if __name__ == "__main__":
['1', '6', '4', '3', '5', '2', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# Client Shuffle (Permutation) Ephemeral Key A (remove A)
# 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'],
@@ -415,7 +415,7 @@ if __name__ == "__main__":
['4', '6', '2', '3', '5', '1', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# Server Shuffle (Permutation) Ephemeral Key 1 (remove 1)
# 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'],
@@ -429,16 +429,16 @@ if __name__ == "__main__":
['5', '0', '4', '1', '6', '3', '2']
], key_type=DarcKeyTypes.inner_shuffle)
# Server (Substitution) Ephemeral Unique Component Function
# Server (Substitution) ephemeral Unique Component Function
server_substitution_ephemeral_unique_component_function = 5
"""
Shared (Mutual) (Substitution) Ephemeral Key 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
Client (Substitution) Ephemeral Key 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
Server (Substitution) Ephemeral Random Component 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
Shared (Mutual) (Substitution) ephemeral Key 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
Client (Substitution) ephemeral Key 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
Server (Substitution) ephemeral Random Component 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
"""
# Shared (Mutual) (Substitution) Ephemeral Key
# 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'],
@@ -452,7 +452,7 @@ if __name__ == "__main__":
['7', '194', '254', '76', '0', '244', '215']
], key_type=DarcKeyTypes.alphabet)
# Client (Substitution) Ephemeral Key
# Client (Substitution) ephemeral Key
client_substitution_ephemeral_key = DarcKey(matrix=[
['21', '149', '75', '73', '228', '81', '79'],
['41', '189', '80', '209', '45', '101', '53'],
@@ -466,7 +466,7 @@ if __name__ == "__main__":
['158', '184', '137', '0', '221', '12', '217']
], key_type=DarcKeyTypes.alphabet)
# Server (Substitution) Ephemeral Random Component
# 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'],
@@ -481,42 +481,42 @@ if __name__ == "__main__":
], key_type=DarcKeyTypes.alphabet)
"""
Server (Substitution) Ephemeral Unique Component 7 190 58 75 135 15 214 149 244 224
Server (Substitution) ephemeral Unique Component 7 190 58 75 135 15 214 149 244 224
"""
# Server (Substitution) Ephemeral Unique Component
# 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)
# 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
outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key
# 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
inner_mutual_function_applied_key = mutual_substitution_function_key << mutual_substitution_function_ephemeral_key
# 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
inner_mutual_function_key_scratch = inner_mutual_function_applied_key < outer_mutual_function_function_ephemeral_key_applied
# 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 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
# 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
client_shuffle_permutation_key_x_scratch = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 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
# 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
outer_mutual_function_ephemeral_key_applied = outer_mutual_substitution_function_key << outer_mutual_substitution_function_ephemeral_key
# 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
server_substitution_key_scratch = server_substitution_key < outer_mutual_function_ephemeral_key_applied
# 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
shared_mutual_substitution_key_scratch = shared_mutual_substitution_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
# 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
@@ -526,43 +526,43 @@ if __name__ == "__main__":
# Server Client Shuffle (Permutation) Inverse
server_client_shuffle_permutation_inverse = ~server_client_shuffle_permutation
# Server Shuffle (Permutation) Ephemeral Key 1 Inverse (remove 1) = ~(Server Shuffle (Permutation) Ephemeral Key 1 (remove 1))
# 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
# 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 (remove 1)
server_shuffle_permutation_ephemeral_key_applied = server_client_shuffle_permutation_inverse << server_shuffle_permutation_ephemeral_key_1_inverse
# line 82
# 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
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 Inverse = ~Server Shuffle (Permutation) Ephemeral Key Applied Scratch
# 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
# 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
outer_server_shuffle_permutation_ephemeral_key_applied = outer_server_shuffle_permutation_key << outer_server_shuffle_permutation_ephemeral_key
# Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) Ephemeral Key Applied
# Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) ephemeral Key Applied
alphabet_scratch_1 = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied
# 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
alphabet_scratch_2 = alphabet_scratch_1 << server_shuffle_permutation_ephemeral_key_applied_scratch_inverse
# 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)
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]
)
# 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
server_substitution_ephemeral_component_scratch_2 = server_substitution_ephemeral_component_scratch_1 < outer_mutual_function_ephemeral_key_applied
"""
# 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)
# 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)
=BITXOR(
# 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)
# 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)
BITXOR(
# Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2)
# Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Component Scratch 2 << Inner Function Key Scratch 2)
BITXOR(
# Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2)
BITXOR(
@@ -584,7 +584,7 @@ if __name__ == "__main__":
)
),
# Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2
# Server (Substitution) ephemeral Component Scratch 2 << Inner Function Key Scratch 2
HLOOKUP(
BN73, # Inner Function Key Scratch 2
INDIRECT(
@@ -596,7 +596,7 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
ROW($BB88) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Component Scratch 2
ROW($BB88) - ROW($BD$5) + 1, # Server (Substitution) ephemeral Component Scratch 2
FALSE
)
),
@@ -616,7 +616,7 @@ if __name__ == "__main__":
FALSE
)
),
# Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2
# Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2
HLOOKUP(
BN73, # Inner Function Key Scratch 2
INDIRECT(
@@ -628,25 +628,25 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
ROW($BB77) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch
ROW($BB77) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) ephemeral Key Server Scratch
FALSE
)
)
"""
# 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)
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)
# Inner Function Key Scratch 2 Inverse = ~Inner Function Key Scratch 2
inner_function_key_scratch_2_inverse = ~inner_function_key_scratch_2
# 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
server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_component_scratch_3 << inner_function_key_scratch_2_inverse
# 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
outer_mutual_function_ephemeral_key_applied_inverse = ~outer_mutual_function_ephemeral_key_applied
# 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
server_substitution_ephemeral_key = server_substitution_ephemeral_key_scratch < outer_mutual_function_ephemeral_key_applied_inverse
"""
server_substitution_ephemeral_key_expected = 159 243 217 236 133 191 86 8 248 18 181 54 164 252 86 139 223 48 37 67 24 126 115 91 230 221 105 196 56 172 101 158 124 89 183 228 118 232 199 12 229 156 157 115 233 158 138 123 11 211 238 246 43 210 158 65 62 158 234 252 88 81 243 67 209 43 108 31 29 28
@@ -671,13 +671,13 @@ if __name__ == "__main__":
# line 94
""" Server Tx (Phase 1) """
# 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 (remove 1) << Server Shuffle (Permutation) Key
inner_server_shuffle_permutation_key_applied = server_shuffle_permutation_ephemeral_key_1 << server_shuffle_permutation_key
# 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
outer_server_shuffle_permutation_key_applied = inner_server_shuffle_permutation_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied
# 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
server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied
@@ -685,32 +685,32 @@ if __name__ == "__main__":
server_substitution_key_scratch_2 = server_substitution_key_scratch
# line 105
# 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
outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key
# line 108
""" Server Tx (Phase 1) """
# 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
client_substitution_key_a_scratch = client_substitution_key < outer_mutual_function_ephemeral_key_applied
# 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
client_substitution_ephemeral_key_a_scratch = client_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied
# 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 (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
# 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 (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
# 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
outer_client_shuffle_permutation_ephemeral_key_applied = outer_client_shuffle_permutation_key << outer_client_shuffle_permutation_ephemeral_key
# 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
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 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
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 Inverse = ~Outer Client Shuffle (Permutation) Function Key Applied
@@ -737,14 +737,14 @@ if __name__ == "__main__":
# 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
# Client Shuffle (Permutation) Ephemeral Key A (remove A) Inverse = ~Client Shuffle (Permutation) Ephemeral Key A (remove A)
# 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
# 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 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
# 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
outer_server_mutual_shuffle_permutation_function_key_scratch = outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# Client Shuffle (Permutation) Key B Scratch = Client Shuffle (Permutation) Key B Applied < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch
@@ -754,7 +754,7 @@ if __name__ == "__main__":
client_shuffle_permutation_key_x_scratch_2 = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_key_scratch
# line 144
# 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
outer_function_function_key_scratch = outer_mutual_function_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# Inner (Mutual) Function Key Client Scratch = Inner (Mutual) Function Applied Key < Outer Function Function Key Scratch
@@ -764,20 +764,20 @@ if __name__ == "__main__":
# (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
# 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
outer_mutual_function_key_scratch = outer_mutual_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied
# 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
# 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
client_substitution_ephemeral_key_b_scratch = client_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
# 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
# Shared (Mutual) (Substitution) Ephemeral Key Client Scratch
# Shared (Mutual) (Substitution) ephemeral Key Client Scratch
# DARC Message Data TODO: unsure how to compute this
# DARC Message Data Check = DARC Message Data < Alphabet Input Sequence Scratch
@@ -786,11 +786,11 @@ if __name__ == "__main__":
""" Server Rx (Phase 4) """
"""
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)
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)
=BITXOR(
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)
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)
BITXOR(
Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2)
Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Key Scratch << Inner Function Key Scratch 2)
BITXOR(
Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2)
BITXOR(
@@ -803,11 +803,11 @@ if __name__ == "__main__":
FALSE
)
),
Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2
Server (Substitution) ephemeral Key Scratch << Inner Function Key Scratch 2
HLOOKUP(
BN184, # Inner Function Key Scratch 2
INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)),
ROW($BB201) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Key Scratch
ROW($BB201) - ROW($BD$5) + 1, # Server (Substitution) ephemeral Key Scratch
FALSE
)
),
@@ -819,33 +819,33 @@ if __name__ == "__main__":
FALSE
)
),
(Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2)
(Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2)
HLOOKUP(
BN184, # Inner Function Key Scratch 2
INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)),
ROW($BB203) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch
ROW($BB203) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) ephemeral Key Server Scratch
FALSE
)
)
"""
# 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)
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)
""" Final """
""" Server Tx (Phase 1) """
# Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) Ephemeral Key Applied
# Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) ephemeral Key Applied
outer_shuffle_permutation = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied
# Inner Shuffle (Permutation) = Outer Shuffle (Permutation) << Outer Server Shuffle (Permutation) Key Applied
inner_shuffle_permutation = outer_shuffle_permutation << outer_server_shuffle_permutation_key_applied
"""
# Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch)
# Inner Shuffle (Permutation) ^ (Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch)
=BITXOR(
# Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch)
# Inner Shuffle (Permutation) ^ (Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch)
BITXOR(
# Inner Shuffle (Permutation)
@INDIRECT(
@@ -856,7 +856,7 @@ if __name__ == "__main__":
1
)
),
# Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch
# Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch
HLOOKUP(
BN107, # Inner (Mutual) Function Key Scratch
INDIRECT(
@@ -868,7 +868,7 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
@ROW($BB103) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Key Scratch
@ROW($BB103) - ROW($BD$5) + 1, # Server (Substitution) ephemeral Key Scratch
FALSE
)
),
@@ -889,12 +889,12 @@ if __name__ == "__main__":
)
)
"""
# Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch)
# Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch)
translation_substitution = inner_shuffle_permutation ^ (server_substitution_ephemeral_key_scratch << inner_mutual_function_key_scratch) ^ (server_substitution_key_scratch_2 << inner_mutual_function_key_scratch)
""" Client Rx (Phase 2) """
"""
# 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) ^ (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)
=BITXOR(
# Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch)
BITXOR(
@@ -933,7 +933,7 @@ if __name__ == "__main__":
FALSE
)
),
Client (Substitution) Ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch
Client (Substitution) ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch
HLOOKUP(
BN111, # Inner (Mutual) Function Key Scratch
INDIRECT(
@@ -945,13 +945,13 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
ROW($BB114) - ROW($BD$5) + 1, # Client (Substitution) Ephemeral Key A Scratch
ROW($BB114) - ROW($BD$5) + 1, # Client (Substitution) ephemeral Key A Scratch
FALSE
)
)
"""
# 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)
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)
# Inner Shuffle (Permutation) - CSKA+CSEKA = Translation (Substitution) - Client Data << Client Shuffle (Permutation) Key A Scratch (remove A)
@@ -964,9 +964,9 @@ if __name__ == "__main__":
inner_shuffle_permutation_csekb_cskb = outer_shuffle_permutation_client_rest << client_shuffle_permutation_key_b_scratch
"""
# 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)
# 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)
=BITXOR(
# 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)
# 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)
BITXOR(
# Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2)
BITXOR(
@@ -987,7 +987,7 @@ if __name__ == "__main__":
FALSE
)
),
# Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2
# Client (Substitution) ephemeral Key B Scratch << (Mutual) Function Key Scratch 2
HLOOKUP(
BN147, # (Mutual) Function Key Scratch 2
INDIRECT(
@@ -999,11 +999,11 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
ROW($BB151) - ROW($BD$5) + 1, # Client (Substitution) Ephemeral Key B Scratch
ROW($BB151) - ROW($BD$5) + 1, # Client (Substitution) ephemeral Key B Scratch
FALSE
)
),
# Shared (Mutual) (Substitution) Ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2
# Shared (Mutual) (Substitution) ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2
HLOOKUP(
BN147, # (Mutual) Function Key Scratch 2
INDIRECT(
@@ -1015,12 +1015,12 @@ if __name__ == "__main__":
@CELL("col", BN$5) - BN$5 + $E$2 - 1
)
),
ROW($BB152) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Client Scratch
ROW($BB152) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) ephemeral Key Client Scratch
FALSE
)
)
"""
# 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)
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)
a = 1
""" Server Rx (Phase 4) """

View File

@@ -20,32 +20,32 @@ if __name__ == "__main__":
# 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
# 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
# 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
# 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
# 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
# 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
# 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)
@@ -127,7 +127,7 @@ if __name__ == "__main__":
# 21 (Mutual) (Substitution) Function Ephemeral Key
# 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'],
@@ -141,7 +141,7 @@ if __name__ == "__main__":
['1', '6', '4', '3', '5', '2', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# 22 Client Shuffle (Permutation) Ephemeral Key A (remove A)
# 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'],
@@ -155,7 +155,7 @@ if __name__ == "__main__":
['4', '6', '2', '3', '5', '1', '0']
], key_type=DarcKeyTypes.inner_shuffle)
# 23 Server Shuffle (Permutation) Ephemeral Key 1 (remove 1)
# 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'],
@@ -214,10 +214,10 @@ if __name__ == "__main__":
key_type=DarcKeyTypes.alphabet
)
# 24 Server (Substitution) Ephemeral Unique Component Function
# 24 Server (Substitution) ephemeral Unique Component Function
server_substitution_ephemeral_unique_component_function = 5
# 25 Shared (Mutual) (Substitution) Ephemeral Key
# 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'],
@@ -231,7 +231,7 @@ if __name__ == "__main__":
['7', '194', '254', '76', '0', '244', '215']
], key_type=DarcKeyTypes.alphabet)
# 26 Client (Substitution) Ephemeral Key
# 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'],
@@ -245,7 +245,7 @@ if __name__ == "__main__":
['158', '184', '137', '0', '221', '12', '217']
], key_type=DarcKeyTypes.alphabet)
# 27 Server (Substitution) Ephemeral Random Component
# 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'],
@@ -259,7 +259,7 @@ if __name__ == "__main__":
['79', '124', '128', '30', '74', '242', '85']
], key_type=DarcKeyTypes.alphabet)
# 28 Server (Substitution) Ephemeral Unique Component
# 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)
@@ -267,34 +267,34 @@ if __name__ == "__main__":
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
@@ -304,71 +304,71 @@ if __name__ == "__main__":
# 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))
# 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)
# 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
# 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
# 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
# 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
# 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
# 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)
# 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
# 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)
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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)
## 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)
@@ -376,25 +376,25 @@ if __name__ == "__main__":
# line 108
""" Client Rx (Phase 2) """
# 62 Client (Substitution) Key A Scratch = Client (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied
# 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
# 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)
# 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
# 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
# 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
# 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
# 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
@@ -403,7 +403,7 @@ if __name__ == "__main__":
# 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)
# 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) ^ (
@@ -424,13 +424,13 @@ if __name__ == "__main__":
# 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)
# 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)
# 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
# 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
@@ -440,7 +440,7 @@ if __name__ == "__main__":
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
# 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
@@ -450,22 +450,22 @@ if __name__ == "__main__":
# 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
# 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
# 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
# 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)
## 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) ^ (
@@ -474,7 +474,7 @@ if __name__ == "__main__":
# 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)
# 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) ^

View File

@@ -146,306 +146,319 @@ class AlphabetKey(DarcKey):
class ClientEphemeralDataKeys(BaseModel):
OuterClientShuffleEphemeralKey: OuterShuffleKey
OuterClientShuffleFunctionEphemeralKey: OuterShuffleKey
ClientEphemeralKey: AlphabetKey
ClientShuffleEphemeralKeyA: InnerShuffleKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return ClientEphemeralDataKeys(
OuterClientShuffleEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterClientShuffleFunctionEphemeralKey=OuterShuffleKey.init_matrix(height),
ClientEphemeralKey=AlphabetKey.init_matrix(width, height, 255),
ClientShuffleEphemeralKeyA=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
)
class ClientEphemeralMediumKeys(BaseModel):
OuterClientShuffleMediumEphemeralKey: OuterShuffleKey
OuterClientShuffleFunctionMediumEphemeralKey: OuterShuffleKey
ClientShuffleMediumEphemeralKeyA: InnerShuffleKey
ClientMediumEphemeralKey: AlphabetKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
inner_key_1: InnerShuffleKey
alpha_key_1: AlphabetKey
@classmethod
def random_init(cls, height: int, width: int):
return ClientEphemeralMediumKeys(
OuterClientShuffleMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterClientShuffleFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
ClientShuffleMediumEphemeralKeyA=InnerShuffleKey.init_matrix(width, height),
ClientMediumEphemeralKey=AlphabetKey.init_matrix(width, height, 255)
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255)
)
class ClientPersistentDataKeys(BaseModel):
ClientKey: AlphabetKey
ClientShuffleKeyA: InnerShuffleKey
OuterClientShuffleKey: OuterShuffleKey
OuterClientShuffleFunctionKey: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return ClientPersistentDataKeys(
ClientKey=AlphabetKey.init_matrix(width, height, 255),
ClientShuffleKeyA=InnerShuffleKey.init_matrix(width, height),
OuterClientShuffleKey=OuterShuffleKey.init_matrix(height),
OuterClientShuffleFunctionKey=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
)
class ClientPersistentMediumKeys(BaseModel):
OuterClientShuffleMediumKey: OuterShuffleKey
OuterClientShuffleFunctionMediumKey: OuterShuffleKey
ClientShuffleMediumKeyA: InnerShuffleKey
ClientMediumKey: AlphabetKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
inner_key_1: InnerShuffleKey
alpha_key_1: AlphabetKey
@classmethod
def random_init(cls, height: int, width: int):
return ClientPersistentMediumKeys(
OuterClientShuffleMediumKey=OuterShuffleKey.init_matrix(height),
OuterClientShuffleFunctionMediumKey=OuterShuffleKey.init_matrix(height),
ClientShuffleMediumKeyA=InnerShuffleKey.init_matrix(width, height),
ClientMediumKey=AlphabetKey.init_matrix(width, height, 255)
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255)
)
class ServerEphemeralDataKeys(BaseModel):
OuterServerShuffleEphemeralKey: OuterShuffleKey
ServerEphemeralKey: AlphabetKey
ServerShuffleEphemeralKey: InnerShuffleKey
outer_key_1: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return ServerEphemeralDataKeys(
OuterServerShuffleEphemeralKey=OuterShuffleKey.init_matrix(height),
ServerEphemeralKey=AlphabetKey.init_matrix(width, height, 255),
ServerShuffleEphemeralKey=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
)
class ServerEphemeralMediumKeys(BaseModel):
ServerMediumEphemeralKey: AlphabetKey
alpha_key_1: AlphabetKey
@classmethod
def random_init(cls, height: int, width: int):
return ServerEphemeralMediumKeys(
ServerMediumEphemeralKey=AlphabetKey.init_matrix(width, height, 255)
alpha_key_1=AlphabetKey.init_matrix(width, height, 255)
)
class ServerPersistentDataKeys(BaseModel):
OuterServerShuffleKey: OuterShuffleKey
ServerKey: AlphabetKey
ServerShuffleKey: InnerShuffleKey
outer_key_1: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return ServerPersistentDataKeys(
OuterServerShuffleKey=OuterShuffleKey.init_matrix(height),
ServerKey=AlphabetKey.init_matrix(width, height, 255),
ServerShuffleKey=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
)
class ServerPersistentMediumKeys(BaseModel):
ServerMediumKey: AlphabetKey
alpha_key_1: AlphabetKey
@classmethod
def random_init(cls, height: int, width: int):
return ServerPersistentMediumKeys(
ServerMediumKey=AlphabetKey.init_matrix(width, height, 255)
alpha_key_1=AlphabetKey.init_matrix(width, height, 255)
)
class MutualEphemeralDataKeys(BaseModel):
MutualKey: AlphabetKey
Inner1: InnerShuffleKey
OuterFunctionKey: OuterShuffleKey
OuterFunctionFunctionKey: OuterShuffleKey
OuterServerShuffleFunctionKey: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
outer_key_3: OuterShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return MutualEphemeralDataKeys(
MutualKey=AlphabetKey.init_matrix(width, height, 255),
Inner1=InnerShuffleKey.init_matrix(width, height),
OuterFunctionKey=OuterShuffleKey.init_matrix(height),
OuterFunctionFunctionKey=OuterShuffleKey.init_matrix(height),
OuterServerShuffleFunctionKey=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
outer_key_3=OuterShuffleKey.init_matrix(height),
)
class MutualEphemeralMediumKeys(BaseModel):
MutualMediumKey: AlphabetKey
FunctionMediumKey: InnerShuffleKey
PositionFunctionMediumEphemeralKey: InnerShuffleKey
OuterFunctionMediumEphemeralKey: OuterShuffleKey
OuterFunctionFunctionMediumEphemeralKey: OuterShuffleKey
OuterPositionFunctionMediumEphemeralKey: OuterShuffleKey
OuterServerShuffleFunctionMediumEphemeralKey: OuterShuffleKey
OuterPositionShuffleFunctionMediumEphemeralKey: OuterShuffleKey
PositionShuffleMediumEphemeralKey: InnerShuffleKey
OuterPositionShuffleMediumEphemeralKey: OuterShuffleKey
alpha_key_1: AlphabetKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
outer_key_3: OuterShuffleKey
outer_key_4: OuterShuffleKey
outer_key_5: OuterShuffleKey
outer_key_6: OuterShuffleKey
inner_key_1: InnerShuffleKey
inner_key_2: InnerShuffleKey
inner_key_3: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return MutualEphemeralMediumKeys(
MutualMediumKey=AlphabetKey.init_matrix(width, height, 255),
FunctionMediumKey=InnerShuffleKey.init_matrix(width, height),
PositionFunctionMediumEphemeralKey=InnerShuffleKey.init_matrix(width, height),
OuterFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterFunctionFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterPositionFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterServerShuffleFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
OuterPositionShuffleFunctionMediumEphemeralKey=OuterShuffleKey.init_matrix(height),
PositionShuffleMediumEphemeralKey=InnerShuffleKey.init_matrix(width, height),
OuterPositionShuffleMediumEphemeralKey=OuterShuffleKey.init_matrix(height)
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
outer_key_3=OuterShuffleKey.init_matrix(height),
outer_key_4=OuterShuffleKey.init_matrix(height),
outer_key_5=OuterShuffleKey.init_matrix(height),
outer_key_6=OuterShuffleKey.init_matrix(height),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
inner_key_2=InnerShuffleKey.init_matrix(width, height),
inner_key_3=InnerShuffleKey.init_matrix(width, height),
)
class MutualPersistentDataKeys(BaseModel):
OuterFunctionKey: OuterShuffleKey
OuterFunctionFunctionKey: OuterShuffleKey
OuterServerShuffleFunctionKey: OuterShuffleKey
MutualKey: AlphabetKey
Inner1: InnerShuffleKey
ClientShuffleKeyX: InnerShuffleKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
outer_key_3: OuterShuffleKey
alpha_key_1: AlphabetKey
inner_key_1: InnerShuffleKey
inner_key_2: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return MutualPersistentDataKeys(
OuterFunctionKey=OuterShuffleKey.init_matrix(height),
OuterFunctionFunctionKey=OuterShuffleKey.init_matrix(height),
OuterServerShuffleFunctionKey=OuterShuffleKey.init_matrix(height),
MutualKey=AlphabetKey.init_matrix(width, height, 255),
Inner1=InnerShuffleKey.init_matrix(width, height),
ClientShuffleKeyX=InnerShuffleKey.init_matrix(width, height),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
outer_key_3=OuterShuffleKey.init_matrix(height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
inner_key_2=InnerShuffleKey.init_matrix(width, height),
)
class MutualPersistentMediumKeys(BaseModel):
MutualMediumKey: AlphabetKey
OuterFunctionMediumKey: OuterShuffleKey
OuterFunctionFunctionMediumKey: OuterShuffleKey
OuterServerShuffleFunctionMediumKey: OuterShuffleKey
FunctionMediumKey: InnerShuffleKey
ClientShuffleMediumKeyX: InnerShuffleKey
OuterPositionShuffleMediumKey: OuterShuffleKey
OuterPositionShuffleFunctionMediumKey: OuterShuffleKey
OuterPositionFunctionMediumKey: OuterShuffleKey
PositionFunctionMediumKey: InnerShuffleKey
PositionShuffleMediumKey: InnerShuffleKey
alpha_key_1: AlphabetKey
outer_key_1: OuterShuffleKey
outer_key_2: OuterShuffleKey
outer_key_3: OuterShuffleKey
outer_key_4: OuterShuffleKey
outer_key_5: OuterShuffleKey
outer_key_6: OuterShuffleKey
inner_key_1: InnerShuffleKey
inner_key_2: InnerShuffleKey
inner_key_3: InnerShuffleKey
inner_key_4: InnerShuffleKey
@classmethod
def random_init(cls, height: int, width: int):
return MutualPersistentMediumKeys(
MutualMediumKey=AlphabetKey.init_matrix(width, height, 255),
OuterFunctionMediumKey=OuterShuffleKey.init_matrix(height),
OuterFunctionFunctionMediumKey=OuterShuffleKey.init_matrix(height),
OuterServerShuffleFunctionMediumKey=OuterShuffleKey.init_matrix(height),
FunctionMediumKey=InnerShuffleKey.init_matrix(width, height),
ClientShuffleMediumKeyX=InnerShuffleKey.init_matrix(width, height),
OuterPositionShuffleMediumKey=OuterShuffleKey.init_matrix(height),
OuterPositionShuffleFunctionMediumKey=OuterShuffleKey.init_matrix(height),
OuterPositionFunctionMediumKey=OuterShuffleKey.init_matrix(height),
PositionFunctionMediumKey=InnerShuffleKey.init_matrix(width, height),
PositionShuffleMediumKey=InnerShuffleKey.init_matrix(width, height),
alpha_key_1=AlphabetKey.init_matrix(width, height, 255),
outer_key_1=OuterShuffleKey.init_matrix(height),
outer_key_2=OuterShuffleKey.init_matrix(height),
outer_key_3=OuterShuffleKey.init_matrix(height),
outer_key_4=OuterShuffleKey.init_matrix(height),
outer_key_5=OuterShuffleKey.init_matrix(height),
outer_key_6=OuterShuffleKey.init_matrix(height),
inner_key_1=InnerShuffleKey.init_matrix(width, height),
inner_key_2=InnerShuffleKey.init_matrix(width, height),
inner_key_3=InnerShuffleKey.init_matrix(width, height),
inner_key_4=InnerShuffleKey.init_matrix(width, height),
)
class ServerPersistentKeys(BaseModel):
Data: ServerPersistentDataKeys
Medium: ServerPersistentMediumKeys
data: ServerPersistentDataKeys
medium: ServerPersistentMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return ServerPersistentKeys(
Data=ServerPersistentDataKeys.random_init(height, width),
Medium=ServerPersistentMediumKeys.random_init(height, width)
data=ServerPersistentDataKeys.random_init(height, width),
medium=ServerPersistentMediumKeys.random_init(height, width)
)
class ClientPersistentKeys(BaseModel):
Data: ClientPersistentDataKeys
Medium: ClientPersistentMediumKeys
data: ClientPersistentDataKeys
medium: ClientPersistentMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return ClientPersistentKeys(
Data=ClientPersistentDataKeys.random_init(height, width),
Medium=ClientPersistentMediumKeys.random_init(height, width)
data=ClientPersistentDataKeys.random_init(height, width),
medium=ClientPersistentMediumKeys.random_init(height, width)
)
class MutualPersistentKeys(BaseModel):
Data: MutualPersistentDataKeys
Medium: MutualPersistentMediumKeys
data: MutualPersistentDataKeys
medium: MutualPersistentMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return MutualPersistentKeys(
Data=MutualPersistentDataKeys.random_init(height, width),
Medium=MutualPersistentMediumKeys.random_init(height, width)
data=MutualPersistentDataKeys.random_init(height, width),
medium=MutualPersistentMediumKeys.random_init(height, width)
)
class ServerEphemeralKeys(BaseModel):
Data: ServerEphemeralDataKeys
Medium: ServerEphemeralMediumKeys
data: ServerEphemeralDataKeys
medium: ServerEphemeralMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return ServerEphemeralKeys(
Data=ServerEphemeralDataKeys.random_init(height, width),
Medium=ServerEphemeralMediumKeys.random_init(height, width)
data=ServerEphemeralDataKeys.random_init(height, width),
medium=ServerEphemeralMediumKeys.random_init(height, width)
)
class MutualEphemeralKeys(BaseModel):
Data: MutualEphemeralDataKeys
Medium: MutualEphemeralMediumKeys
data: MutualEphemeralDataKeys
medium: MutualEphemeralMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return MutualEphemeralKeys(
Data=MutualEphemeralDataKeys.random_init(height, width),
Medium=MutualEphemeralMediumKeys.random_init(height, width)
data=MutualEphemeralDataKeys.random_init(height, width),
medium=MutualEphemeralMediumKeys.random_init(height, width)
)
class ClientEphemeralKeys(BaseModel):
Data: ClientEphemeralDataKeys
Medium: ClientEphemeralMediumKeys
data: ClientEphemeralDataKeys
medium: ClientEphemeralMediumKeys
@classmethod
def random_init(cls, height: int, width: int):
return ClientEphemeralKeys(
Data=ClientEphemeralDataKeys.random_init(height, width),
Medium=ClientEphemeralMediumKeys.random_init(height, width)
data=ClientEphemeralDataKeys.random_init(height, width),
medium=ClientEphemeralMediumKeys.random_init(height, width)
)
class ServerKeys(BaseModel):
Persistent: ServerPersistentKeys
Ephemeral: ServerEphemeralKeys
persistent: ServerPersistentKeys
ephemeral: ServerEphemeralKeys
@classmethod
def random_init(cls, height: int, width: int):
return ServerKeys(
Persistent=ServerPersistentKeys.random_init(height, width),
Ephemeral=ServerEphemeralKeys.random_init(height, width)
persistent=ServerPersistentKeys.random_init(height, width),
ephemeral=ServerEphemeralKeys.random_init(height, width)
)
class MutualKeys(BaseModel):
Persistent: MutualPersistentKeys
Ephemeral: MutualEphemeralKeys
persistent: MutualPersistentKeys
ephemeral: MutualEphemeralKeys
@classmethod
def random_init(cls, height: int, width: int):
return MutualKeys(
Persistent=MutualPersistentKeys.random_init(height, width),
Ephemeral=MutualEphemeralKeys.random_init(height, width)
persistent=MutualPersistentKeys.random_init(height, width),
ephemeral=MutualEphemeralKeys.random_init(height, width)
)
class ClientKeys(BaseModel):
Persistent: ClientPersistentKeys
Ephemeral: ClientEphemeralKeys
persistent: ClientPersistentKeys
ephemeral: ClientEphemeralKeys
@classmethod
def random_init(cls, height: int, width: int):
return ClientKeys(
Persistent=ClientPersistentKeys.random_init(height, width),
Ephemeral=ClientEphemeralKeys.random_init(height, width)
persistent=ClientPersistentKeys.random_init(height, width),
ephemeral=ClientEphemeralKeys.random_init(height, width)
)