complete darc tutorial
This commit is contained in:
@@ -2,24 +2,23 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 36,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from src.key_generation import generate_keys\n",
|
"from src.models import SubstitutionKey, OuterKey, Mask, ServerKeys, MutualKeys, ClientKeys\n",
|
||||||
"from src.models import SubstitutionKey, OuterKey, Mask\n",
|
|
||||||
"from src.server_darc import resolve_message"
|
"from src.server_darc import resolve_message"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.863976Z",
|
"end_time": "2024-07-04T18:05:07.552043Z",
|
||||||
"start_time": "2024-07-03T15:44:47.828314Z"
|
"start_time": "2024-07-04T18:05:07.542908Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 37,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def create_random_message(message_len, height):\n",
|
"def create_random_message(message_len, height):\n",
|
||||||
@@ -29,14 +28,14 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.864152Z",
|
"end_time": "2024-07-04T18:05:07.552147Z",
|
||||||
"start_time": "2024-07-03T15:44:47.831989Z"
|
"start_time": "2024-07-04T18:05:07.546164Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 38,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"height = 70\n",
|
"height = 70\n",
|
||||||
@@ -47,31 +46,51 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.864191Z",
|
"end_time": "2024-07-04T18:05:07.552308Z",
|
||||||
"start_time": "2024-07-03T15:44:47.834823Z"
|
"start_time": "2024-07-04T18:05:07.549140Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": 39,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"server_keys, mutual_keys, client_keys = generate_keys(height, width)\n",
|
"server_substitution_data = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"client_substitution_data = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"mutual_substitution_data = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"\n",
|
||||||
|
"server_substitution_medium = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"client_substitution_medium = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"mutual_substitution_medium = SubstitutionKey.init_matrix(width, height)\n",
|
||||||
|
"\n",
|
||||||
|
"server_keys = ServerKeys.random_init(height, width)\n",
|
||||||
|
"mutual_keys = MutualKeys.random_init(height, width)\n",
|
||||||
|
"client_keys = ClientKeys.random_init(height, width)\n",
|
||||||
|
"\n",
|
||||||
|
"server_keys.persistent.data.alpha_key = server_substitution_data ^ mutual_substitution_data\n",
|
||||||
|
"server_keys.persistent.medium.alpha_key = server_substitution_medium ^ mutual_substitution_medium\n",
|
||||||
|
"\n",
|
||||||
|
"mutual_keys.persistent.data.alpha_key = mutual_substitution_data ^ client_substitution_data\n",
|
||||||
|
"mutual_keys.persistent.medium.alpha_key = mutual_substitution_medium ^ client_substitution_medium\n",
|
||||||
|
"\n",
|
||||||
|
"client_keys.persistent.data.alpha_key = client_substitution_data\n",
|
||||||
|
"client_keys.persistent.medium.alpha_key = client_substitution_medium\n",
|
||||||
|
"\n",
|
||||||
"alphabet = SubstitutionKey.init_matrix(width, height, 255)\n",
|
"alphabet = SubstitutionKey.init_matrix(width, height, 255)\n",
|
||||||
"medium = SubstitutionKey(matrix=[[0 for _ in range(width)] for _ in range(height)])"
|
"medium = SubstitutionKey(matrix=[[0 for _ in range(width)] for _ in range(height)])"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.870926Z",
|
"end_time": "2024-07-04T18:05:07.580066Z",
|
||||||
"start_time": "2024-07-03T15:44:47.838679Z"
|
"start_time": "2024-07-04T18:05:07.553448Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 40,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"sdi1 = server_keys.persistent.data.inner_key_1 << server_keys.ephemeral.data.inner_key_1\n",
|
"sdi1 = server_keys.persistent.data.inner_key_1 << server_keys.ephemeral.data.inner_key_1\n",
|
||||||
@@ -115,14 +134,14 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.913517Z",
|
"end_time": "2024-07-04T18:05:07.593317Z",
|
||||||
"start_time": "2024-07-03T15:44:47.870246Z"
|
"start_time": "2024-07-04T18:05:07.587709Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 41,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"cdo1_cdo2 = cdo1 << cdo2\n",
|
"cdo1_cdo2 = cdo1 << cdo2\n",
|
||||||
@@ -133,14 +152,14 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.913738Z",
|
"end_time": "2024-07-04T18:05:07.593468Z",
|
||||||
"start_time": "2024-07-03T15:44:47.873170Z"
|
"start_time": "2024-07-04T18:05:07.590552Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 42,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"m_func_1 = lambda x: (x < mdo1) << (mdi1 < mdo2)\n",
|
"m_func_1 = lambda x: (x < mdo1) << (mdi1 < mdo2)\n",
|
||||||
@@ -152,42 +171,99 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.913781Z",
|
"end_time": "2024-07-04T18:05:07.595183Z",
|
||||||
"start_time": "2024-07-03T15:44:47.875550Z"
|
"start_time": "2024-07-04T18:05:07.593423Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 43,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"medium_phase1 = medium ^ m_func_2(spma ^ sema)\n",
|
"medium_phase1 = medium ^ m_func_2(spma ^ sema)"
|
||||||
"\n",
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2024-07-04T18:05:07.598748Z",
|
||||||
|
"start_time": "2024-07-04T18:05:07.596986Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 52,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 52,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
"medium_phase2 = (\n",
|
"medium_phase2 = (\n",
|
||||||
" (\n",
|
" (\n",
|
||||||
" medium_phase1 ^\n",
|
" medium_phase1 ^\n",
|
||||||
" m_func_2(cema ^ cpma ^ mpma)\n",
|
" m_func_2(cema ^ cpma ^ mpma)\n",
|
||||||
" ) << (cmi1 < mmo3)\n",
|
" ) << (cmi1 < mmo3)\n",
|
||||||
" ) < cmo1_cmo2\n",
|
" ) < cmo1_cmo2\n",
|
||||||
"\n",
|
"medium_phase2 == (\n",
|
||||||
"medium_phase3 = (\n",
|
" (\n",
|
||||||
" ((medium_phase2 < ~cmo1_cmo2) << (~cmi1 < mmo3)) ^\n",
|
" (\n",
|
||||||
" m_func_2(cpma ^ cema ^ mema)\n",
|
" medium ^\n",
|
||||||
" ) << (mpmi2 < mmo3) < cmo1_cmo2\n",
|
" m_func_2(server_substitution_medium ^ sema ^ cema)\n",
|
||||||
"\n"
|
" ) << (cmi1 < mmo3)\n",
|
||||||
|
" ) < cmo1_cmo2\n",
|
||||||
|
")"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.913820Z",
|
"end_time": "2024-07-04T18:05:42.393236Z",
|
||||||
"start_time": "2024-07-03T15:44:47.884399Z"
|
"start_time": "2024-07-04T18:05:42.389787Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 59,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 59,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"medium_phase3 = (\n",
|
||||||
|
" ((medium_phase2 < ~cmo1_cmo2) << (~cmi1 < mmo3)) ^\n",
|
||||||
|
" m_func_2(cpma ^ cema ^ mema)\n",
|
||||||
|
" ) << (mpmi2 < mmo3) < cmo1_cmo2\n",
|
||||||
|
"\n",
|
||||||
|
"medium_phase3 == ((\n",
|
||||||
|
" medium ^\n",
|
||||||
|
" m_func_2(server_substitution_medium ^ sema ^ cpma ^ mema)\n",
|
||||||
|
" ) << (mpmi2 < mmo3) < cmo1_cmo2\n",
|
||||||
|
")"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2024-07-04T18:16:20.923343Z",
|
||||||
|
"start_time": "2024-07-04T18:16:20.920280Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 46,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"translated_alphabet = (\n",
|
"translated_alphabet = (\n",
|
||||||
@@ -198,110 +274,174 @@
|
|||||||
"alphabet_phase1 = (\n",
|
"alphabet_phase1 = (\n",
|
||||||
" s_func_1(alphabet) ^\n",
|
" s_func_1(alphabet) ^\n",
|
||||||
" m_func_1(spda ^ seda)\n",
|
" m_func_1(spda ^ seda)\n",
|
||||||
")\n",
|
")"
|
||||||
"\n",
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2024-07-04T18:05:07.665047Z",
|
||||||
|
"start_time": "2024-07-04T18:05:07.639926Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 62,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 62,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
"alphabet_phase2 = ((((\n",
|
"alphabet_phase2 = ((((\n",
|
||||||
" alphabet_phase1 ^\n",
|
" alphabet_phase1 ^\n",
|
||||||
" m_func_1(ceda ^ cpda ^ mpda)\n",
|
" m_func_1(ceda ^ cpda ^ mpda)\n",
|
||||||
" ) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)\n",
|
" ) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"alphabet_phase2 == (\n",
|
||||||
|
" ((((\n",
|
||||||
|
" s_func_1(alphabet) ^\n",
|
||||||
|
" m_func_1(server_substitution_data ^ seda ^ ceda)\n",
|
||||||
|
" ) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)\n",
|
||||||
|
")"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2024-07-04T18:29:06.076785Z",
|
||||||
|
"start_time": "2024-07-04T18:29:06.071174Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 72,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 72,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
"alphabet_phase3 = (\n",
|
"alphabet_phase3 = (\n",
|
||||||
" ((alphabet_phase2 < ~cdo1_cdo2) << (~cdi1 < mdo3)) ^\n",
|
" ((alphabet_phase2 < ~cdo1_cdo2) << (~cdi1 < mdo3)) ^\n",
|
||||||
" m_func_1(ceda ^ cpda ^ meda)\n",
|
" m_func_1(ceda ^ cpda ^ meda)\n",
|
||||||
" ) << (mpdi2 < mdo3) < cdo1_cdo2\n",
|
" ) << (mpdi2 < mdo3) < cdo1_cdo2\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"alphabet_phase3 == (\n",
|
||||||
"alphabet_phase3 = (\n",
|
" (\n",
|
||||||
" alphabet_phase1 ^ m_func_1(mpda ^ meda)\n",
|
" s_func_1(alphabet) ^\n",
|
||||||
") << (mpdi2 < mdo3) < cdo1_cdo2"
|
" m_func_1(server_substitution_data ^ seda ^ cpda ^ meda)\n",
|
||||||
|
" ) << (mpdi2 < mdo3) < cdo1_cdo2\n",
|
||||||
|
")"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.917104Z",
|
"end_time": "2024-07-04T18:40:21.743276Z",
|
||||||
"start_time": "2024-07-03T15:44:47.899159Z"
|
"start_time": "2024-07-04T18:40:21.739864Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 47,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"eof_msg_mask = Mask.init_matrix(width, height, message_len)\n",
|
"eof_msg_mask = Mask.init_matrix(width, height, message_len)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
|
||||||
"padded_input_sequence = OuterKey.init_matrix(height)\n",
|
"padded_input_sequence = OuterKey.init_matrix(height)\n",
|
||||||
"padded_input_sequence.matrix = [message + padded_input_sequence.matrix[0][message_len:]]\n",
|
"padded_input_sequence.matrix = [message + padded_input_sequence.matrix[0][message_len:]]"
|
||||||
"\n",
|
|
||||||
"darc_message = (\n",
|
|
||||||
" (\n",
|
|
||||||
" (medium_phase3 < ~cmo1_cmo2) ^\n",
|
|
||||||
" ((((alphabet_phase3 < ~cdo1_cdo2) < padded_input_sequence) ^ eof_msg_mask) << (mmi3 < nmmo6_nmmo4))\n",
|
|
||||||
" ) < mmo4\n",
|
|
||||||
" ) << (mmi4 < (mmo5 << ~mmo6))"
|
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.917166Z",
|
"end_time": "2024-07-04T18:05:07.678354Z",
|
||||||
"start_time": "2024-07-03T15:44:47.902305Z"
|
"start_time": "2024-07-04T18:05:07.643198Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 13,
|
"execution_count": 75,
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 75,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"darc_message = ((\n",
|
||||||
|
" (medium_phase3 < ~cmo1_cmo2) ^\n",
|
||||||
|
" ((((alphabet_phase3 < ~cdo1_cdo2) < padded_input_sequence) ^ eof_msg_mask) << (mmi3 < nmmo6_nmmo4))\n",
|
||||||
|
" ) << (mmi4 < (mmo5 << nmmo6_nmmo4))) < mmo4\n",
|
||||||
|
"\n",
|
||||||
|
"darc_message == (\n",
|
||||||
|
" ((\n",
|
||||||
|
" ((\n",
|
||||||
|
" medium ^\n",
|
||||||
|
" m_func_2(server_substitution_medium ^ sema ^ cpma ^ mema)\n",
|
||||||
|
" ) << (mpmi2 < mmo3)) ^\n",
|
||||||
|
" (((((\n",
|
||||||
|
" s_func_1(alphabet) ^\n",
|
||||||
|
" m_func_1(server_substitution_data ^ seda ^ cpda ^ meda)) << (mpdi2 < mdo3)\n",
|
||||||
|
" ) < padded_input_sequence) ^ eof_msg_mask) << (mmi3 < nmmo6_nmmo4))\n",
|
||||||
|
" ) << (mmi4 < (mmo5 << nmmo6_nmmo4))) < mmo4\n",
|
||||||
|
")"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2024-07-04T18:46:10.473478Z",
|
||||||
|
"start_time": "2024-07-04T18:46:10.457255Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 102,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": "True"
|
||||||
|
},
|
||||||
|
"execution_count": 102,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"unwrapped_medium = (\n",
|
"unwrapped_medium = (\n",
|
||||||
" ((darc_message < ~mmo4) << ~(mmi4 < (mmo5 << nmmo6_nmmo4))) ^\n",
|
" ((darc_message < ~mmo4) << ~(mmi4 < (mmo5 << nmmo6_nmmo4))) ^\n",
|
||||||
" (((spma ^ sema ^ mpma ^ mema) < mmo1) << ((mmi1 < mmo2) << (mpmi2 < mmo3)))\n",
|
" (m_func_2(spma ^ sema ^ mpma ^ mema) << (mpmi2 < mmo3))\n",
|
||||||
" ) << (~mmi3 < nmmo6_nmmo4)"
|
" ) << (~mmi3 < nmmo6_nmmo4)\n",
|
||||||
|
"\n",
|
||||||
|
"unwrapped_medium == ((translated_alphabet < padded_input_sequence) ^ eof_msg_mask)"
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.917330Z",
|
"end_time": "2024-07-04T19:21:34.911369Z",
|
||||||
"start_time": "2024-07-03T15:44:47.911658Z"
|
"start_time": "2024-07-04T19:21:34.908479Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 49,
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"darc_message = ((\n",
|
|
||||||
" (\n",
|
|
||||||
" (medium_phase3 < ~cmo1_cmo2) ^\n",
|
|
||||||
" ((((alphabet_phase3 < ~cdo1_cdo2) < padded_input_sequence) ^ eof_msg_mask) << (mmi3 < nmmo6_nmmo4))\n",
|
|
||||||
" ) < mmo4\n",
|
|
||||||
" ) << (mmi4 < (mmo5 << ~mmo6))) < ~mmo4\n",
|
|
||||||
"\n",
|
|
||||||
"darc_message = ((\n",
|
|
||||||
" (\n",
|
|
||||||
" (medium_phase3 < ~cmo1_cmo2) ^\n",
|
|
||||||
" ((((alphabet_phase3 < ~cdo1_cdo2) < padded_input_sequence) ^ eof_msg_mask) << (mmi3 < nmmo6_nmmo4))\n",
|
|
||||||
" )\n",
|
|
||||||
" ) << (mmi4 < (mmo5 << ~mmo6 << ~mmo4)))\n",
|
|
||||||
"\n",
|
|
||||||
"unwrapped_medium = (\n",
|
|
||||||
" (darc_message << ~(mmi4 < (mmo5 << nmmo6_nmmo4))) ^\n",
|
|
||||||
" (((spma ^ sema ^ mpma ^ mema) < mmo1) << ((mmi1 < mmo2) << (mpmi2 < mmo3)))\n",
|
|
||||||
" ) << (~mmi3 < nmmo6_nmmo4)\n"
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"collapsed": false,
|
|
||||||
"ExecuteTime": {
|
|
||||||
"end_time": "2024-07-03T15:44:47.929257Z",
|
|
||||||
"start_time": "2024-07-03T15:44:47.914223Z"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 15,
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"orignal_message = resolve_message(translated_alphabet, unwrapped_medium)"
|
"orignal_message = resolve_message(translated_alphabet, unwrapped_medium)"
|
||||||
@@ -309,20 +449,20 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.929422Z",
|
"end_time": "2024-07-04T18:05:07.678472Z",
|
||||||
"start_time": "2024-07-03T15:44:47.927326Z"
|
"start_time": "2024-07-04T18:05:07.656814Z"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 16,
|
"execution_count": 50,
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": "True"
|
"text/plain": "True"
|
||||||
},
|
},
|
||||||
"execution_count": 16,
|
"execution_count": 50,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -333,34 +473,8 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2024-07-03T15:44:47.945605Z",
|
"end_time": "2024-07-04T18:05:07.678731Z",
|
||||||
"start_time": "2024-07-03T15:44:47.932864Z"
|
"start_time": "2024-07-04T18:05:07.659154Z"
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 16,
|
|
||||||
"outputs": [],
|
|
||||||
"source": [],
|
|
||||||
"metadata": {
|
|
||||||
"collapsed": false,
|
|
||||||
"ExecuteTime": {
|
|
||||||
"end_time": "2024-07-03T15:44:47.945779Z",
|
|
||||||
"start_time": "2024-07-03T15:44:47.935609Z"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 16,
|
|
||||||
"outputs": [],
|
|
||||||
"source": [],
|
|
||||||
"metadata": {
|
|
||||||
"collapsed": false,
|
|
||||||
"ExecuteTime": {
|
|
||||||
"end_time": "2024-07-03T15:44:47.965022Z",
|
|
||||||
"start_time": "2024-07-03T15:44:47.937832Z"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,10 +202,15 @@ def merge_message(
|
|||||||
cmo1 = client_keys.persistent.medium.outer_key_1 << client_keys.ephemeral.medium.outer_key_1
|
cmo1 = client_keys.persistent.medium.outer_key_1 << client_keys.ephemeral.medium.outer_key_1
|
||||||
cmo2 = client_keys.persistent.medium.outer_key_2 << client_keys.ephemeral.medium.outer_key_2
|
cmo2 = client_keys.persistent.medium.outer_key_2 << client_keys.ephemeral.medium.outer_key_2
|
||||||
|
|
||||||
darc_message = (
|
cmo1_cmo2 = cmo1 << cmo2
|
||||||
|
cdo1_cdo2 = cdo1 << cdo2
|
||||||
|
nmmo6_nmmo4 = ~(mmo4 << mmo6)
|
||||||
|
|
||||||
|
darc_message = ((
|
||||||
(
|
(
|
||||||
(medium_phase3 < ~(cmo1 << cmo2)) ^
|
(medium_phase3 < ~cmo1_cmo2) ^
|
||||||
(((alphabet_phase3 < (~(cdo1 << cdo2) << padded_input_sequence)) ^ eof_msg_mask) << (mmi3 < ~(mmo4 << mmo6)))
|
((((alphabet_phase3 < ~cdo1_cdo2) < padded_input_sequence) ^ eof_msg_mask) << (
|
||||||
) < mmo4
|
mmi3 < nmmo6_nmmo4))
|
||||||
) << (mmi4 < (mmo5 << ~mmo6))
|
)
|
||||||
|
) << (mmi4 < (mmo5 << nmmo6_nmmo4))) < mmo4
|
||||||
return darc_message
|
return darc_message
|
||||||
|
|||||||
Reference in New Issue
Block a user