Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bece716
ignore
LauraJimenezB Jul 14, 2020
89cd72c
agrega babel y eslint
LauraJimenezB Jul 14, 2020
ede0692
agregar package-lock.json
LauraJimenezB Jul 14, 2020
1b996e4
actualizar gitignore
LauraJimenezB Jul 14, 2020
aee94dd
Rename README.md to READ.md
LauraJimenezB Jul 14, 2020
acb3d16
Create README.md
LauraJimenezB Jul 14, 2020
390ba7d
Update README.md
LauraJimenezB Jul 14, 2020
8fcf852
Update README.md
LauraJimenezB Jul 14, 2020
6740e57
Update README.md
LauraJimenezB Jul 14, 2020
99e726d
Update README.md
LauraJimenezB Jul 15, 2020
d1e0e55
Add files via upload
LauraJimenezB Jul 15, 2020
9d50c4f
Add files via upload
LauraJimenezB Jul 15, 2020
b1c624f
Add files via upload
LauraJimenezB Jul 15, 2020
dceb639
Add files via upload
LauraJimenezB Jul 15, 2020
a1e1ff1
actualizar
LauraJimenezB Jul 16, 2020
6139b68
Update README.md
LauraJimenezB Jul 20, 2020
36c90ed
Delete prototipo final.jpg
LauraJimenezB Jul 20, 2020
a998279
Add files via upload
LauraJimenezB Jul 20, 2020
4a869aa
Update README.md
LauraJimenezB Jul 20, 2020
285ff53
Delete protfin.png
LauraJimenezB Jul 20, 2020
5123470
Add files via upload
LauraJimenezB Jul 20, 2020
cb2b3d1
Delete protfin.png
LauraJimenezB Jul 20, 2020
2c72540
Add files via upload
LauraJimenezB Jul 20, 2020
381eb8a
Delete protfin.png
LauraJimenezB Jul 20, 2020
08568dd
Add files via upload
LauraJimenezB Jul 20, 2020
74e9c6d
Update README.md
LauraJimenezB Jul 20, 2020
50b3a8c
Update README.md
LauraJimenezB Jul 20, 2020
2b92d2e
actualizar
LauraJimenezB Jul 30, 2020
b665e33
Merge branch 'master' of https://github.com/LauraJimenezB/LIM013-cipher
LauraJimenezB Jul 30, 2020
426488f
Rename README.md to research
LauraJimenezB Jul 30, 2020
2a222dd
cambios
LauraJimenezB Jul 30, 2020
9f0c7f3
Merge branch 'master' of https://github.com/LauraJimenezB/LIM013-cipher
LauraJimenezB Jul 30, 2020
3c30da1
Rename research to readme.md
LauraJimenezB Jul 31, 2020
7093ab7
actualizar
LauraJimenezB Jul 31, 2020
9825238
Merge branch 'master' of https://github.com/LauraJimenezB/LIM013-cipher
LauraJimenezB Jul 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "plugins": ["@babel/plugin-transform-modules-commonjs"]}
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"no-console": "warn"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
coverage/
Binary file added 2020-07-15 (2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
5,219 changes: 5,219 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

Binary file added protfinal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added protini.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# GENERADOR DE CONTRASEÑAS

### PLAN DE ACCIÓN
* Objetivo principal: Manipulación dinámica del DOM. Para ello,
* Escuchar eventos del DOM en Index.js que invoque cipher.encode() y cipher.decode() desde cipher.js

## ¿DE QUÉ TRATA EL PROYECTO?

El proyecto "Generador de contraseñas" consiste en una aplicación interactiva y amigable con el usuario que permita generar contraseñas seguras siguiendo el mecanismo del Caesar Cipher o “Cifrado Caesar”.

## DESCARGAR

## INSTALACIÓN

## EJECUTAR

## VISTA PREVIA

## INVESTIGACIÓN UX

### ¿Quiénes son los principales usuarios de producto?

Público general con cuentas personales en distintas redes sociales.

### ¿Cuáles son los objetivos de estos usuarios en relación con tu producto?

Público de distintas edades poseen cuentas que necesitan contraseñas más complicadas y seguras.

### ¿Cómo crees que el producto que estás creando está resolviendo sus problemas?
El Cipher permite que las contraseñas sean difíciles de hackear, es decir, contribuye a la seguridad de las cuentas del usuario.

### Prototipo inicial

![](/protini.jpg)

### Feedback

Luego de presentar mi prototipo inicial (en papel) a m familia y compañeras de Laboratoria, reuní las siguientes observaciones:

* La caja de "resultado" no es necesaria, pues ocupa espacio y no se usará todo su espacio para la palabra codifica o decodificada.

* El ingreso del offset era confuso para las personas no familiarizadas con el código César, quienes no veían la utilidad de ese número.

Por ello, para el prototipo final se decidió no dejar un espacio determinado para el resultado, sino que éste aparezca luego de presionar el botón cuando ya se realice la conversión. Además, se podrá un **label** para explicar el offset y su uso.

### Prototipo final

![](/protfinal.jpg)
Binary file added src/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/bgFooter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 29 additions & 1 deletion src/cipher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
const cipher = {
// ...
encode : function (offset, str) {
let x = [];
for (let i=0; i<str.length; i++) {
if(str.charCodeAt(i)>=65 && str.charCodeAt(i)<=90){
x [i] = ((str.charCodeAt (i))-65+ offset)%26 +65
} else {
x[i]= str.charCodeAt (i);
}
}
return x;
},

decode : function (offset, str) {
let x = [];
for (let i=0; i<str.length; i++) {
if(str.charCodeAt(i)>=65 && str.charCodeAt(i)<=90){
if ((str.charCodeAt(i)-65)>=offset) {
x [i] = ((str.charCodeAt (i))-65- offset)%26 +65
}
else {
x [i] = (((str.charCodeAt (i))-65- offset)%26+26)%26+65
}
}
else {
x[i]= str.charCodeAt (i);
}
}
return x;
}
};

export default cipher;
43 changes: 41 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,50 @@
<head>
<meta charset="utf-8">
<title>Caesar Cipher</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="root">
<h1>Hello world!</h1>
<header>
<h1> GENERADOR DE CONTRASEÑAS</h1>
<p><i>Crea mejores contraseñas, mantén tus cuentas seguras</i></p>
</header>
<section>
<form>
<input type="text" id="txt" placeholder="Ingrese texto aquí..."></input>
<label for="num"><strong>OFFSET </strong><input type="number" id="num" min="0" step="1"></input></label>
<button type="button" class="encode" id="encode">CODIFICAR</button>
<button type="button" class="decode" id="decode">DECODIFICAR</button>
</form>
<div class="bigQuestion">
<div class="icon">
<p class="questionIcon">?</p>
</div>
<div class="question">
<div>
<p><strong>¿Qué es el offset? </strong>Cada letra se desplaza "x" espacios hacia la derecha en el alfabeto.</p>
</div>
<div>
<p><i><strong>Por ejemplo.</strong> Con un offset de 3, la letra "A" avanza 3 espacios y se convierte en "D".</i></p>
</div>
</div>
</div>
</section>
<footer>
<div class="flex">
<div class="lock">
<img src="resultado.svg" width="75px" height="75px"/>
</div>
<div class="resulText">
<div>
<h2>TEXTO CODIFICADO / DECODIFICADO </h2>
</div>
<div class="resultado">
<h3 id="resultado"></h3>
</div>
</div>
</div>
</footer>
</div>
<script src="index.js" type="module"></script>
</body>
Expand Down
24 changes: 23 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
import cipher from './cipher.js';

console.log(cipher);
document.getElementById("txt").addEventListener ("keyup", function () {
this.value=this.value.toUpperCase ();
});

document.getElementById("encode").addEventListener("click", onEncode);
function onEncode () {
let offset = parseInt(document.getElementById('num').value);
let str = document.getElementById('txt').value;

const x = cipher.encode(offset,str);
const resultado = String.fromCharCode.apply (null, x)
document.getElementById('resultado').innerHTML = resultado;
}

document.getElementById("decode").addEventListener("click", onDecode);
function onDecode () {
let offset = parseInt(document.getElementById('num').value);
let str = document.getElementById('txt').value;

const x = cipher.decode(offset,str);
const resultado = String.fromCharCode.apply (null, x)
document.getElementById('resultado').innerHTML = resultado;
}
1 change: 1 addition & 0 deletions src/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/resultado.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
* {
font-family:sans-serif;
}

body {
margin: 0;
padding: 0;
height: 100%;
max-width: 1280px;
background-image: url("background.jpg");
background-size: cover;
}

header {
font-size: 35px;
width: 100%;
margin: 0;
padding: 10px;
text-align: center;
color: #394648;
font-weight: bolder;
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
line-height: 25px;
}

img {
border-radius: 4px;
}

input[type=text], select {
width: 75%;
height: 30px;
padding: 12px 20px;
margin-left:auto;
margin-right: auto;
margin-top: 35px;
margin-bottom: 20px;
display:block;
border: 1px solid #ccc;
border-radius: 4px;
}

label {
margin-left: 145px;
}

input[type=number], select {
width: 80px;
padding: 6px 10px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 10px;
}

.bigQuestion {
display: flex;
justify-content: center;
}

.icon {
background: #394648;
border-radius: 70px;
width: 70px;
height: 70px;
text-align: center;
margin-top: 35px;
color: #FFFFFF;
font-weight: bold;
font-size: 28px;
}

.questionIcon {
margin-top: 18px;
}

.question {
text-align: left;
margin-left: 20px;
margin-top: 30px;
}

button {
width:220px;
color: white;
padding: 14px 20px;
margin: 4px 0;
margin-top: 7px;
margin-bottom: 0;
margin-left: 8px;
border: none;
border-radius: 4px;
cursor: pointer;
display:inline-block;
justify-content: center;
font-weight: bolder;
font-size: 15px;
}

.encode {
background-color: #F05D5E;
margin-left: 370px;
}

.decode{
background-color: #99D17B;
}

footer {
margin-top: 20px;
margin-left: 0;
height: 165px;
width: 1304px;
background-image: url("bgFooter.svg");
background-position:top;
}

.lock {
margin-left: 370px;
margin-top: 75px;
margin-right: 1px;
}

.resulText {
margin-top: 65px;
width: 400px;
color: white;
}

h3 {
background-color: #6C6C6E;
border-radius: 8px;
height: 30px;
width: 385px;
margin-left: 10px;
margin-top: 0px;
margin-bottom: 0;
padding-top: 7px;
}

h2 {
margin-bottom: 7px;
}

h2, h3 {
text-align: center;
font-size: 20px;
color: #FFFFFF;
}

.flex {
display: flex;
}