I'm trying to encrypt/decrypt data from a form.I took the class that helps me to do that from:
https://github.com/o/crypt-php
The encrypt works but when I try to decrypt it gives me an error saying that:
Uncaught exception 'Exception' with message 'The given data does not appear to be encrypted with Crypt'
My code:
//for encrypt(this works)
require_once("Crypt.php");
$crypt = new Crypt;
$crypt->setKey('keykeykeyy');
$password = $_POST['password'];
$crypt->setData($password);
$encrypted = $crypt->encrypt();
//for decrypt almost the same thing
$password = $_POST['password'];
$crypt->setData($password);
$decrypted = $crypt->decrypt();
What's the problem?