feat: update rsa.ipynb
This commit is contained in:
40
rsa.ipynb
40
rsa.ipynb
@@ -10,6 +10,26 @@
|
||||
"$\\phi(n)=n\\prod_{p|n}\\left(1-\\frac{1}{p}\\right)$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"id": "84b0bbc4-48f4-4dc9-a1a9-0cab8f68829a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"4\n",
|
||||
"12\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(euler_phi(12))\n",
|
||||
"print(euler_phi(13))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0be1d436-5075-4f2f-96ec-e225179209a7",
|
||||
@@ -21,6 +41,26 @@
|
||||
"\n",
|
||||
"$a^{\\phi(n)}\\equiv1 \\bmod n$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"id": "34b39cb0-1bc0-4f35-8c9f-ff47d575bc9e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1\n",
|
||||
"1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(gcd(7,13))\n",
|
||||
"print(pow(7,euler_phi(13),13))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user