Files
@ abd03aa8b163
Branch filter:
Location: CryptoJS/dist/crypto.html - annotation
abd03aa8b163
1.6 KiB
text/html
added readme
f425e00a94c6 f425e00a94c6 f425e00a94c6 f425e00a94c6 7eec13103f80 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 f425e00a94c6 f425e00a94c6 f425e00a94c6 7eec13103f80 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 7eec13103f80 5c8fceb4e291 f425e00a94c6 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 7eec13103f80 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 5c8fceb4e291 40f2dda94216 40f2dda94216 40f2dda94216 40f2dda94216 5c8fceb4e291 5c8fceb4e291 f425e00a94c6 f425e00a94c6 f425e00a94c6 | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Chacha20</title>
<style type="text/css">
textarea{width:400px;height:160px;}
form[name="chacha"] > *, form[name="chacha"] label > * {display:block;margin-bottom:8px;}
</style>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<form name="chacha">
<label>Vstup:
<textarea name="input"></textarea>
</label>
<label>Heslo:
<input type="password" name="password" />
</label>
<div>
<button type="button" name="encrypt">zašifrovat</button>
<button type="button" name="decrypt">dešifrovat</button>
</div>
<label>Výstup:
<textarea name="output" readonly></textarea>
</label>
</form>
<script type="text/javascript">
let form=document.querySelector("form[name='chacha']");
let input=form.querySelector("textarea[name='input']");
let output=form.querySelector("textarea[name='output']");
let password=form.querySelector("input[name='password']");
form.querySelector("button[name='encrypt']").addEventListener("click",function(){
output.value=cryptoJS.encrypt(input.value,password.value);
});
form.querySelector("button[name='decrypt']").addEventListener("click",function(){
let res=cryptoJS.decrypt(input.value,password.value);
if(res===1){res="! Neplatný podpis. Nepodařilo se ověřit pravost zprávy. !";}
else if(res===2){res="! Neplatný formát zprávy. Nekompatibilní verze programu. !";}
else if(res===3){res="! Neplatný formát zprávy. Počet iterací mimo povolený rozsah. !";}
else if(res===4){res="! Neplatný formát zprávy. Příliš krátká zpráva. !";}
output.value=res;
});
</script>
</body>
</html>
|