implement spn algebra template
This commit is contained in:
92
darc_substitution.ipynb
Normal file
92
darc_substitution.ipynb
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-08-02T22:22:16.261963Z",
|
||||
"start_time": "2024-08-02T22:22:15.861856Z"
|
||||
}
|
||||
},
|
||||
"source": "from src.models import SubstitutionKey\n",
|
||||
"outputs": [],
|
||||
"execution_count": 2
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-08-02T22:22:16.442689Z",
|
||||
"start_time": "2024-08-02T22:22:16.434147Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"width = 7\n",
|
||||
"height = 10\n",
|
||||
"s1 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"s2 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"s3 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"\n",
|
||||
"c1 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"c2 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"c3 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"\n",
|
||||
"m1 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"m2 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"m3 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"m4 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"m5 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"\n",
|
||||
"s_m1 = s1 ^ m4\n",
|
||||
"c_m1 = c1 ^ m4\n",
|
||||
"s_m4 = s1 ^ m5\n",
|
||||
"c_m4 = c1 ^ m5\n",
|
||||
"\n",
|
||||
"m_c1 = SubstitutionKey.init_matrix(width, height)\n",
|
||||
"m_s1 = SubstitutionKey.init_matrix(width, height) \n",
|
||||
"\n",
|
||||
"m_s2 = m1 ^ m_c1\n",
|
||||
"m_c2 = m1 ^ m_s1\n",
|
||||
"\n",
|
||||
"s_m3 = m_s2 ^ s2 ^ m3\n",
|
||||
"s_m2 = m1 ^ s2 ^ m2 ^ m_s1\n",
|
||||
"c_m2 = m_c2 ^ c2 ^ m2\n",
|
||||
"c_m3 = m1 ^ m_c1 ^ c2 ^ m3\n"
|
||||
],
|
||||
"id": "58883d386ec57cc4",
|
||||
"outputs": [],
|
||||
"execution_count": 3
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"outputs": [],
|
||||
"execution_count": null,
|
||||
"source": "",
|
||||
"id": "2e1b925a48925228"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user