-
Notifications
You must be signed in to change notification settings - Fork 59
Revisión Andrea Toledo, squad 3 #39
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
Open
andreatoledo
wants to merge
13
commits into
Laboratoria:master
Choose a base branch
from
andreatoledo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0156048
cambios
andreatoledo 7a64117
cambios en html
andreatoledo d12be28
cambios en readme
andreatoledo ab9e7cb
subiendo imagenes a readme
andreatoledo 76d7bed
imagenes
andreatoledo 84f547d
cambios
andreatoledo 918ff8b
readme
andreatoledo 4c9dd88
por fin subiendo imagenes a readme
andreatoledo f41f0f9
cambiando mi html
andreatoledo 5755603
cambiando mis imagenes de readme
andreatoledo 4536286
subiendo objetivos de aprendizaje
andreatoledo 83eb981
subiendo mis objetivos de aprendizaje
andreatoledo 8428110
cambiando mi readme
andreatoledo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,66 @@ | ||
| const cipher = { | ||
| // ... | ||
| window.cipher = { | ||
| //crear una función de cifrado | ||
| encode: (offset, toEncode) => { | ||
| let result1 = ''; | ||
| let toUnicode=''; | ||
| let toUnicode1=''; | ||
| let toUnicode2=''; | ||
| //variable donde estara almacenado el ascii encriptado | ||
|
|
||
| for(let i = 0; i< toEncode.length; i++){ //Convertiremos y alamacenamos cada letra de la frase ingresada a código Ascci | ||
| let toAscii = toEncode.charCodeAt(i); //Condicionamos para que la frase almacenada este en el rango de numeros ASCII y no de otros | ||
|
|
||
| if (toAscii>=65 && toAscii<=90){ | ||
| toUnicode = String.fromCharCode((toAscii- 65 + offset)%26 + 65); //Si la letra es MAYÚSCULA Aplicaremos la formula de César para obtener el código ASCII de la letra ya encriptada | ||
| result1 += toUnicode; //codAsciiEncrypted: Guardamos el código ascii encriptado | ||
| }else if (toAscii === 32){ | ||
| toAscii = ((toAscii- 32 + offset)%1 + 32); //valido si hay un espacio en ASCII | ||
| toUnicode1 = String.fromCharCode(toAscii); | ||
| result1 += toUnicode1; | ||
| }else if (toAscii>=97 && toAscii<=122){ | ||
| toUnicode2 = String.fromCharCode((toAscii- 97 + offset)%26 + 97); //Si la letra es minúscula Aplicaremos la formula de César para obtener el código ASCII de la letra ya encriptada | ||
| //codAsciiEncrypted: Guardamos el código ascii encriptado | ||
| result1 += toUnicode2; | ||
|
|
||
| // To ascii y to unicode: Estas funciones estan diseñadas para realizar la "traducción" de códigos de teclas virtuales + flags de estas + estado del teclado + configuración regional del teclado, a sus correspondientes teclas, estas proveen un mecanismo de detección de la tecla bastante efectivo y preciso, | ||
| } | ||
| } | ||
|
|
||
| return result1; //Por ultimo retornamos la nueva frase encriptada | ||
| }, | ||
| decode: (offset, toDecode) => { | ||
| let result2 = ''; | ||
| let toUnicode6=''; | ||
| let toUnicode7=''; | ||
| let toUnicode8=''; | ||
| let toUnicode9=''; | ||
| for(let i = 0; i< toDecode.length; i++){ | ||
| let toAscii = toDecode.charCodeAt(i); | ||
|
|
||
| if (toAscii>=65 && toAscii<=90){ | ||
| toUnicode6 = String.fromCharCode((toAscii+ 65 - offset-26)%26 + 65); | ||
| result2 += toUnicode6; | ||
|
|
||
| }else if (toAscii === 32){ | ||
| toAscii = ((toAscii+ 32 - offset-1)%1 + 32); | ||
| toUnicode7 = String.fromCharCode(toAscii); | ||
| result2 += toUnicode7; | ||
|
|
||
| }else if (toAscii>=97 && toAscii<=122){ | ||
| toUnicode8 = String.fromCharCode((toAscii+97 - offset-38)%26 + 97); | ||
| result2 += toUnicode8; | ||
|
|
||
| }else if (toAscii === 165){ | ||
| toAscii = ((toAscii- 165 + offset)%1 + 165); | ||
| toUnicode9 = String.fromCharCode(toAscii); | ||
| result2 += toUnicode9; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| return result2; | ||
| } | ||
| }; | ||
|
|
||
| export default cipher; | ||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,49 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Caesar Cipher</title> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| </head> | ||
| <body> | ||
| <div id="root"> | ||
| <h1>Hello world!</h1> | ||
| </div> | ||
| <script src="index.js" type="module"></script> | ||
| </body> | ||
| <html lang="es"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Caesar Cipher</title> | ||
|
|
||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <header id="main-header"> | ||
|
|
||
|
|
||
| <MARQUEE> <big> <h1>P E R S O N A L 🔍 D A T A 🔍 P R O T E C T I O N</h1> </big> </MARQUEE> | ||
|
|
||
|
|
||
| </header> | ||
|
|
||
| <div id= "cifrar"> | ||
| <h2 id="instruccion"> I N S T R U C C I O N E S: | ||
| </h2> | ||
| <p> Seleccciona una clave del 1 al 33. | ||
| <p> CLAVE </p> | ||
| <br> | ||
| <input type="number" value min="1" id="offset"> | ||
| <br> Escribe el texto que deseas cifrar | ||
| <p><textarea id="message" placeholder="Escribe aquí" cols="35" rows="4"> | ||
|
|
||
| </textarea> | ||
| <textarea id="container" placeholder="RESULTADO" name="" cols="35" rows="4"> | ||
| </textarea></p> | ||
| <p><input type="button" value="C I F R A R" id="btncifrar"> | ||
| <input type="button" value="D E S C I F R A R" id="btndescifrar"> | ||
| <input type="reset" value="B O R R A R" id="resetbtn"> | ||
| </p> | ||
| </div> | ||
| <div id= "enviar"> | ||
| <p><a href= index1.html target=_blank><button>VOLVER AL INICIO </button></a> </p> | ||
| <footer id="main-footer"> | ||
| <p>© 2020 @Andrea Toledo</a></p> | ||
| </footer> | ||
| </div> | ||
| <div id="root"> | ||
| <script src="index.js"></script> | ||
| <script src="cipher.js"></script> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,26 @@ | ||
| import cipher from './cipher.js'; | ||
|
|
||
| console.log(cipher); | ||
|
|
||
| let containerResult = document.getElementById('container'); | ||
|
|
||
|
|
||
| document.getElementById("btncifrar").addEventListener("click", () => { | ||
|
|
||
| let toEncode= document.getElementById("message").value; | ||
| let offset = parseInt(document.getElementById("offset").value); | ||
| containerResult.innerHTML = cipher.encode(offset,toEncode); | ||
|
|
||
|
|
||
| document.getElementById("btndescifrar").addEventListener("click", () => { | ||
| let toDecode = document.getElementById("message").value; | ||
| let offset = parseInt(document.getElementById("offset").value); | ||
| containerResult.innerHTML = cipher.decode(offset,toDecode); | ||
|
|
||
|
|
||
| }); | ||
| document.getElementById("resetbtn").addEventListener("click", () => { | ||
| document.getElementById("message").value = ""; | ||
| document.getElementById("offset").value = ""; | ||
| document.getElementById("container").value = ""; | ||
|
|
||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
|
|
||
|
|
||
| <!DOCTYPE html> | ||
| <html lang="es"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Caesar Cipher</title> | ||
|
|
||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <header id="main-header"> | ||
|
|
||
|
|
||
| <MARQUEE> <big> <h1>P E R S O N A L 🔍 D A T A 🔍 P R O T E C T I O N</h1> </big> </MARQUEE> | ||
|
|
||
|
|
||
| </header> | ||
|
|
||
|
|
||
|
|
||
| <section id="main-content"> | ||
|
|
||
|
|
||
| <h1><center>Mantente protegido 🔐 </center> </h1> | ||
|
|
||
| <center><big> <big> <big> ¿QUÉ QUIERES HACER? </big> </big> </big> <p> | ||
| <a class="boton" href="index.html"> PULSE AQUÍ SI QUIERE CIFRAR Y DESCIFRAR🔒 </a> | ||
| </center> </p> | ||
| <p> | ||
| <center><img src="detective.jpg" align="center"> </p> </center> | ||
|
|
||
| </section> | ||
|
|
||
| <footer id="main-footer"> | ||
| <p>© 2020 @Andrea Toledo</h1></p> | ||
| </footer> | ||
| </body> | ||
| </html> | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| body { | ||
| margin: 20; | ||
| padding: 20; | ||
| font-family: Centhury Gothic; | ||
| color: grey; | ||
| background: #e2dbdb; | ||
| font-size: 1.5em; | ||
| line-height: 1.5em; | ||
|
|
||
| } | ||
|
|
||
| h1 { | ||
| font-size: 1.5em; | ||
| line-height: 1.5em; | ||
| margin: 10px 0; | ||
| text-align: left; | ||
| font-weight: 100; | ||
| } | ||
|
|
||
| p { | ||
| margin: 0 0 1em 0; | ||
| } | ||
|
|
||
| img { | ||
| max-width: 50%; | ||
| height: auto; | ||
| } | ||
|
|
||
| #main-header { | ||
|
|
||
| font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif; | ||
| background : rgb(255, 158, 174); | ||
| color: rgb(255, 255, 255); | ||
| height: 100px; | ||
| } | ||
| #main-header a { | ||
| color: white; | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| #main-content { | ||
| background:rgb(255, 248, 248); | ||
| width: 1000%; | ||
| max-width: 1000px; | ||
| margin: 10px auto; | ||
| box-shadow: 0 0 10px rgba(0,0,0,.1); | ||
| } | ||
|
|
||
| #main-content header, | ||
| #main-content .content { | ||
| padding: 30px; | ||
| } | ||
|
|
||
| #main-footer { | ||
| background: #333; | ||
| color: white; | ||
| text-align: center; | ||
| padding: 20px; | ||
| margin-top: 40px; | ||
| } | ||
| #main-footer p { | ||
| margin: 0; | ||
| } | ||
|
|
||
| #main-footer a { | ||
| color: white; | ||
| } | ||
| .boton { | ||
| padding: 10px 20px; | ||
| background-color: #00f396; | ||
| color: white | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Aunque no está mal, la definicion que estaba nates hacia lo mismo, al ser de tipo module puede utilizarse importándolo.