Skip to content

Commit

Permalink
docs: update encryption and decryption descriptions in nb_tenseal.ipy…
Browse files Browse the repository at this point in the history
…nb for clarity; fix error comments in code cells
  • Loading branch information
hsiangjenli committed Nov 7, 2024
1 parent 7f019ff commit 2784be5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions source/resource/notebook/nb_tenseal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"source": [
"## HE consist of four primary algorithms: \n",
"1. **Key Generation** - Generates a public key ( $\\textbf{pk}$ ) and a secret key ( $\\textbf{sk}$ ). \n",
"2. **Encryption** - Encrypts a plaintext tensor ( $\\text{num}$ ) into a ciphertext tensor ( $\\textbf{pk}(\\text{num}) = C_{\\text{num}}$ ). \n",
"3. **Evaluation** \n",
"4. **Decryption** "
"2. **Encryption** - Encrypts a plaintext tensor ( $\\text{num}$ ) into a ciphertext tensor ( $\\textbf{Enc}(\\text{pk}, \\text{num}) = C_{\\text{num}}$ ). \n",
"3. **Evaluation** - Performs operations on ciphertext tensors.\n",
"4. **Decryption** - Decrypts a ciphertext tensor ( $C_{\\text{num}}$ ) into a plaintext tensor ( $\\textbf{Dec}(\\text{sk}, C_{\\text{num}}) = \\text{num}$ )."
]
},
{
Expand Down Expand Up @@ -278,13 +278,13 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[11], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m (\u001b[43mencrypted_vector\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mencrypted_vector\u001b[49m)\u001b[38;5;241m.\u001b[39mdecrypt(sk) \u001b[38;5;66;03m# zero\u001b[39;00m\n",
"Cell \u001b[0;32mIn[11], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m (\u001b[43mencrypted_vector\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mencrypted_vector\u001b[49m)\u001b[38;5;241m.\u001b[39mdecrypt(sk) \u001b[38;5;66;03m# Error\u001b[39;00m\n",
"\u001b[0;31mRuntimeError\u001b[0m: result ciphertext is transparent"
]
}
],
"source": [
"(encrypted_vector - encrypted_vector).decrypt(sk) # zero"
"(encrypted_vector - encrypted_vector).decrypt(sk) # Error"
]
},
{
Expand Down Expand Up @@ -316,7 +316,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -326,13 +326,13 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m (\u001b[43mencrypted_vector\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m)\u001b[38;5;241m.\u001b[39mdecrypt(sk)\n",
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m (\u001b[43mencrypted_vector\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m)\u001b[38;5;241m.\u001b[39mdecrypt(sk) \u001b[38;5;66;03m# Error\u001b[39;00m\n",
"\u001b[0;31mRuntimeError\u001b[0m: result ciphertext is transparent"
]
}
],
"source": [
"(encrypted_vector * 0).decrypt(sk) # zero"
"(encrypted_vector * 0).decrypt(sk) # Error"
]
},
{
Expand Down

0 comments on commit 2784be5

Please sign in to comment.