This commit is contained in:
2024-08-02 10:42:47 -05:00
parent 9211a922fe
commit cad2553703
2 changed files with 63 additions and 130 deletions

View File

@@ -1,68 +1 @@
# DARC
### translate data
```
alpha_phase1 = (
((alphabet < sdo1) << (sdi1 < mdo3)) ^
(((spda ^ seda) < mdo1) << (mdi1 < mdo2))
)
```
### receive alphabet
```
alphabet_phase2 = ((((
alphabet_phase1 ^
(((ceda ^ cpda ^ mpda) < mdo1) << (mdi1 < mdo2))
) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)
```
#### Replace Alphabet Phase 1
```
alphabet_phase2 = ((((
((alphabet < sdo1) << (sdi1 < mdo3)) ^
(((spda ^ seda) < mdo1) << (mdi1 < mdo2)) ^
(((ceda ^ cpda ^ mpda) < mdo1) << (mdi1 < mdo2))
) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)
```
#### Simplified Expression
```
alphabet_phase2 = ((((
((alphabet < sdo1) << (sdi1 < mdo3)) ^
(((ceda ^ cpda ^ mpda ^ spda ^ seda) < mdo1) << (mdi1 < mdo2))
) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)
```
recall:
- `spda = s_a ^ m_a`
- `mpda = m_a ^ c_a`
- `cpda = c_a`
#### Final Alphabet Phase 2
```
alphabet_phase2 = ((((
((alphabet < sdo1) << (sdi1 < mdo3)) ^
(((ceda ^ s_a ^ seda) < mdo1) << (mdi1 < mdo2))
) < ~mdo3)) << cdi1) < (mdo3 << cdo1 << cdo2)
```
### transmit alphabet
```
alphabet_phase3 = (
(alphabet_phase2 << ((~cdi1 << mdpi2) < (mdo3 << cdo1 << cdo2))) ^
((((ceda ^ cpda ^ meda) < mdo1) << ((mdi1 < mdo2) << (mdpi2 < mdo3))) < (cdo1 << cdo2))
)
```
#### Distribute cdo1 << cdo2 term and replace alphabet_phase2
```
alphabet_phase3 = (
((
(alphabet_phase2 << ((~cdi1 << mdpi2) < (mdo3 << cdo1 << cdo2))) ^
((((ceda ^ cpda ^ meda) < mdo1) << ((mdi1 < mdo2) << (mdpi2 < mdo3))) < (cdo1 << cdo2))
) << ((~cdi1 << mdpi2) < (mdo3 << cdo1_cdo2))) ^
(
(
((ceda ^ cpda ^ meda) < (mdo1 << cdo1 << cdo2)) << ((mdi1 < (mdo2 << cdo1 << cdo2)) << (mdpi2 < (mdo3 << cdo1 << cdo2)))
)
)
)
```

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 121,
"execution_count": 1,
"outputs": [],
"source": [
"from src.models import SubstitutionKey, OuterKey, Mask, ServerKeys, MutualKeys, ClientKeys\n",
@@ -11,31 +11,31 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.644601Z",
"start_time": "2024-07-04T19:31:39.628805Z"
"end_time": "2024-07-18T21:01:01.803060Z",
"start_time": "2024-07-18T21:01:01.280375Z"
}
}
},
{
"cell_type": "code",
"execution_count": 122,
"execution_count": 2,
"outputs": [],
"source": [
"def create_random_message(message_len, height):\n",
" message = OuterKey.init_matrix(height).matrix[0]\n",
" return message[:message_len]"
" rand_message = OuterKey.init_matrix(height).matrix[0]\n",
" return rand_message[:message_len]"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.644729Z",
"start_time": "2024-07-04T19:31:39.630714Z"
"end_time": "2024-07-18T21:01:01.808394Z",
"start_time": "2024-07-18T21:01:01.805877Z"
}
}
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 3,
"outputs": [],
"source": [
"height = 70\n",
@@ -46,14 +46,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.645110Z",
"start_time": "2024-07-04T19:31:39.634024Z"
"end_time": "2024-07-18T21:01:01.822786Z",
"start_time": "2024-07-18T21:01:01.809032Z"
}
}
},
{
"cell_type": "code",
"execution_count": 124,
"execution_count": 4,
"outputs": [],
"source": [
"server_substitution_data = SubstitutionKey.init_matrix(width, height)\n",
@@ -82,14 +82,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.666246Z",
"start_time": "2024-07-04T19:31:39.638300Z"
"end_time": "2024-07-18T21:01:01.916064Z",
"start_time": "2024-07-18T21:01:01.815030Z"
}
}
},
{
"cell_type": "code",
"execution_count": 125,
"execution_count": 5,
"outputs": [],
"source": [
"sdi1 = server_keys.persistent.data.inner_key_1 << server_keys.ephemeral.data.inner_key_1\n",
@@ -133,14 +133,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.676976Z",
"start_time": "2024-07-04T19:31:39.672058Z"
"end_time": "2024-07-18T21:01:01.916423Z",
"start_time": "2024-07-18T21:01:01.850796Z"
}
}
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": 6,
"outputs": [],
"source": [
"cdo1_cdo2 = cdo1 << cdo2\n",
@@ -151,14 +151,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.677097Z",
"start_time": "2024-07-04T19:31:39.674721Z"
"end_time": "2024-07-18T21:01:01.916508Z",
"start_time": "2024-07-18T21:01:01.853430Z"
}
}
},
{
"cell_type": "code",
"execution_count": 127,
"execution_count": 7,
"outputs": [],
"source": [
"m_func_1 = lambda x: (x < mdo1) << (mdi1 < mdo2)\n",
@@ -170,14 +170,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.679186Z",
"start_time": "2024-07-04T19:31:39.677255Z"
"end_time": "2024-07-18T21:01:01.916576Z",
"start_time": "2024-07-18T21:01:01.856185Z"
}
}
},
{
"cell_type": "code",
"execution_count": 128,
"execution_count": 8,
"outputs": [],
"source": [
"medium_phase1 = m_func_2(spma ^ sema)"
@@ -185,20 +185,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.682789Z",
"start_time": "2024-07-04T19:31:39.681048Z"
"end_time": "2024-07-18T21:01:01.916634Z",
"start_time": "2024-07-18T21:01:01.859848Z"
}
}
},
{
"cell_type": "code",
"execution_count": 129,
"execution_count": 9,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 129,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -221,20 +221,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.697827Z",
"start_time": "2024-07-04T19:31:39.687941Z"
"end_time": "2024-07-18T21:01:01.916838Z",
"start_time": "2024-07-18T21:01:01.867649Z"
}
}
},
{
"cell_type": "code",
"execution_count": 130,
"execution_count": 10,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 130,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -253,14 +253,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.712580Z",
"start_time": "2024-07-04T19:31:39.696392Z"
"end_time": "2024-07-18T21:01:01.916949Z",
"start_time": "2024-07-18T21:01:01.876383Z"
}
}
},
{
"cell_type": "code",
"execution_count": 131,
"execution_count": 11,
"outputs": [],
"source": [
"translated_alphabet = (\n",
@@ -276,20 +276,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.712704Z",
"start_time": "2024-07-04T19:31:39.704054Z"
"end_time": "2024-07-18T21:01:01.917063Z",
"start_time": "2024-07-18T21:01:01.883731Z"
}
}
},
{
"cell_type": "code",
"execution_count": 132,
"execution_count": 12,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 132,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -310,20 +310,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.727975Z",
"start_time": "2024-07-04T19:31:39.712372Z"
"end_time": "2024-07-18T21:01:01.917163Z",
"start_time": "2024-07-18T21:01:01.892274Z"
}
}
},
{
"cell_type": "code",
"execution_count": 133,
"execution_count": 13,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 133,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@@ -344,14 +344,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.742787Z",
"start_time": "2024-07-04T19:31:39.721754Z"
"end_time": "2024-07-18T21:01:01.917267Z",
"start_time": "2024-07-18T21:01:01.901400Z"
}
}
},
{
"cell_type": "code",
"execution_count": 134,
"execution_count": 14,
"outputs": [],
"source": [
"eof_msg_mask = Mask.init_matrix(width, height, message_len)\n",
@@ -362,20 +362,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.742960Z",
"start_time": "2024-07-04T19:31:39.726783Z"
"end_time": "2024-07-18T21:01:01.917359Z",
"start_time": "2024-07-18T21:01:01.916301Z"
}
}
},
{
"cell_type": "code",
"execution_count": 135,
"execution_count": 15,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 135,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@@ -401,20 +401,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.743236Z",
"start_time": "2024-07-04T19:31:39.739866Z"
"end_time": "2024-07-18T21:01:01.939417Z",
"start_time": "2024-07-18T21:01:01.916475Z"
}
}
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": 16,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 136,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -430,14 +430,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.761839Z",
"start_time": "2024-07-04T19:31:39.748041Z"
"end_time": "2024-07-18T21:01:01.939925Z",
"start_time": "2024-07-18T21:01:01.928416Z"
}
}
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": 17,
"outputs": [],
"source": [
"orignal_message = resolve_message(translated_alphabet, unwrapped_medium)"
@@ -445,20 +445,20 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.761929Z",
"start_time": "2024-07-04T19:31:39.751011Z"
"end_time": "2024-07-18T21:01:01.940010Z",
"start_time": "2024-07-18T21:01:01.931157Z"
}
}
},
{
"cell_type": "code",
"execution_count": 138,
"execution_count": 18,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 138,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@@ -469,8 +469,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-04T19:31:39.761994Z",
"start_time": "2024-07-04T19:31:39.753450Z"
"end_time": "2024-07-18T21:01:01.940128Z",
"start_time": "2024-07-18T21:01:01.933634Z"
}
}
}