Primer commit
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "34b9df41",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"from entrypoint import ENV_PATH\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"dotenv_path = ENV_PATH\n",
|
||||
"load_dotenv(dotenv_path)\n",
|
||||
"pssword = os.getenv('MASTER_PASSWORD')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "01c8db97",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from security.Encriptar import Encriptar_fernet"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "aecfbf44",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Clave de cifrado: ¤òAíÀÇ®8IgÄËïºÅ2a3duÎ4Ô¯5¦ï¤ç··sôÃmL9xWß\n",
|
||||
"Encriptado (bytes con salt): b'\\xe5\\xba]\\t\\x7f\\xd6\\xa7Y\\xbe[\\xf7!e\\x97\\xc7\\x12gAAAAABoFQxX5Gc_Tyi7ViKNluwd9K8b1sWoJdlBN6OpMJbcG_vb_ZOlMEtlaCH5fGppSg8eegU8LLST-uSTcHh3BVBWfZO17g2uurbFACsyMp8lEQu3sFs='\n",
|
||||
"Desencriptado: Hola, mundo secreto\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Definir la clave como texto plano\n",
|
||||
"print(\"Clave de cifrado:\", pssword)\n",
|
||||
"\n",
|
||||
"# Encriptar un mensaje\n",
|
||||
"mensaje = \"Hola, mundo secreto\"\n",
|
||||
"cifrado = Encriptar_fernet.encriptar(mensaje, pssword)\n",
|
||||
"print(\"Encriptado (bytes con salt):\", cifrado)\n",
|
||||
"\n",
|
||||
"# Desencriptar el mensaje\n",
|
||||
"descifrado = Encriptar_fernet.desencriptar(cifrado, pssword)\n",
|
||||
"print(\"Desencriptado:\", descifrado)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.11"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user