Skip to content

Instantly share code, notes, and snippets.

@moo-im-a-cow
Created March 21, 2017 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moo-im-a-cow/d15649b49a68a825c6233d7c969c6cca to your computer and use it in GitHub Desktop.
Save moo-im-a-cow/d15649b49a68a825c6233d7c969c6cca to your computer and use it in GitHub Desktop.
<?php
//TESTING THE ENCRYPTION FROM https://gist.github.com/chrisns/3992815
/*
Just a quick warning:
THIS TEST IS INSECURE!
Even though the text is encrypted between the server and the client,
The password that an attacker would need access to in order for him to decrypt it
is hardcoded along side the encrypted text,
any attacker can visit this page, see that the password "i_love_passwords" is used to decrypt,
and now they can decrypt anything sent to or from the server.
*/
require("aes.class.php");
$var[0] = AesCtr::encrypt("very secret text", "i_love_passwords", 256);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<script src="aes.js"></script>
<script type="application/javascript">
var q = Aes.Ctr.decrypt("<?php echo $var[0];?>", "i_love_passwords", 256)
alert(q);
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment