-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cipher #35
base: master
Are you sure you want to change the base?
cipher #35
Changes from 15 commits
ef26e9b
00fc59a
d35f07a
4575762
73d1d1b
339c67a
ec80081
ba8b9d8
f48ff1b
548cfd0
3becf59
2251473
9d196ca
9834c37
8c2e2ac
d2d6b2e
21ae1f7
2bf3451
327df2a
2c5bf54
6a01317
bde486f
9059afa
c3ae21e
a91f50f
e9b288f
bd9aae5
54c1236
be266cc
a2e19fa
6afbaca
49dd4a8
107e0b8
f1733bb
47b1b67
2901836
9391291
7c2f6df
8803628
569a67a
52f5bce
5f78153
42354b7
15d73a6
9e83baa
90d7c5b
ca3d753
27e1af1
79bd917
786e68a
cee2100
8fbe47e
af409ac
678d49e
ddebc72
03bd9f4
54d259d
8b75499
e69aed4
53b17c4
baa2404
a3000b3
f9bedf1
19c837a
e19969b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
const cipher = { | ||
// ... | ||
}; | ||
|
||
export default cipher; | ||
|
||
//1crear una fuction para cifrar// | ||
function code() { | ||
//traer los datos del usuario-nombre// | ||
let name = document.getElementById("nombre").value; | ||
//traer el valor del desplazaamiento// | ||
let offset = document.getElementById("numero").value; | ||
//convertir las letras en mayusculas// | ||
let may = name.toUpperCase(); | ||
//crear una variable vacia donde se almacenara la palabra cifrada// | ||
let newPalabra=''; | ||
//declra el offset// | ||
offset = offset %26; | ||
//obtener los indices del nombre(dato de usuario)// | ||
for (let i=0; i < may.length; i++){ | ||
//obtener codigo ascii de cada letra del nombre// | ||
let palabra = may.charCodeAt(i); | ||
//declara el rango de codigos ascii, solo las mayusculas// | ||
if(palabra >= 65 && palabra<=90){ | ||
//convertir el codigo ascii de cada letra obtenido a un nuevo codigo ascii agregando el desplazamiento(formula)// | ||
newPalabra = String.fromCharCode((palabra - 65 + offset)%26 +65); | ||
|
||
document.write("<rot>" + newPalabra + "<rot>"); | ||
|
||
} | ||
} | ||
} | ||
|
||
function decifrar(){ | ||
let codigo = document.getElementById("codigo").value; | ||
let offset = document.getElementById("numero").value; | ||
let promocion=''; | ||
offset = offset %26; | ||
for (let i=0; i < codigo.length; i++){ | ||
let neCod = codigo.charCodeAt(i); | ||
if(neCod >= 65 && neCod<=90){ | ||
promocion = String.fromCharCode((neCod + 65 - offset - 26)%26 +65); | ||
console.log(promocion); | ||
|
||
} | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Caesar Cipher</title> | ||
<link rel="stylesheet" href="style2.css" /> | ||
</head> | ||
<script src="cipher.js"></script> | ||
<body> | ||
<div id="root2"> | ||
<h1>OBTENIENDO DATOS DEL USUARIO</h1> | ||
|
||
<h2>Ingresa el codigo de promocion:</h2> | ||
<input type="text" name="nombre" id="codigo" placeholder="Nombre"><br> | ||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tu código no es muy legible, cuida la indentación y consistencia |
||
</div> | ||
<input id="button" type="button" value="enviar" onclick="decifrar();"> | ||
|
||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,12 @@ | |
</head> | ||
<body> | ||
<div id="root"> | ||
<h1>Hello world!</h1> | ||
</div> | ||
<script src="index.js" type="module"></script> | ||
<h1>¿Te gustaría un helado?</h1> | ||
<h2>¡Gratis!</h2> | ||
|
||
|
||
<h3>¡Genera tu código aquí!</h3> | ||
</div> | ||
<a href="index2.html"><input type="button" value="Click aquí"></a> | ||
</body> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adri! tu avance es muy bueno y me parece perfecto que ya tengas dominado el tema de git, lo que si es que procura que cada cambio que subas sea significativo, es decir, que no sea solo agregar una llave, una imagen o algo asi, que tenga mas sentido. Buen trabajo! |
||
</html> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Caesar Cipher</title> | ||
<link rel="stylesheet" href="style2.css" /> | ||
</head> | ||
<body> | ||
<div id="root2"> | ||
<h1>HELADOS LOS TRES CERDITOS</h1> | ||
<h2>Ingresa tus datos aquí:</h2> | ||
|
||
<p>Nombre : <input type="text" name="nombre"></p> | ||
<p>Primer apellido : <input type="text" name="apellido"></p> | ||
|
||
<a href="cipher.js"><input type="button" value="Continuar"></a> | ||
|
||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background-image: url("../src/helado\ fondo.jpg"); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bien! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Procura tener consistencia en tu código, si empleas palabras en inglés continua con ellas, tu indentación debe mejorar, por todo lo demás llevas un excelente trabajo!