Files
@ 20fa1614ab45
Branch filter:
Location: CryptoJS/dist/crypto.html - annotation
20fa1614ab45
1.4 KiB
text/html
FIX: unstretched password leaking through signature
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 5c8fceb4e291 5c8fceb4e291 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="! Nepodařilo se ověřit pravost zprávy. !";}
else if(res===2){res="! Nekompatibilní verze programu. !";}
output.value=res;
});
</script>
</body>
</html>
|