I unforesee the result.
This is my encryption method:
const METHOD = "AES-256-ECB";
public $key;
public function encrypt($string,$key){
return strtr(base64_encode(openssl_encrypt($string, $this::METHOD, hash('sha256', $key, true))), '+/=', '-_,');
}
This code generates the $key for encryption.
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$max = strlen($string) - 1;
$token = '';
for ($i = 0; $i < 32; $i++) {
$token .= $string[mt_rand(0, $max)];
}
$key = $token;
My question is: ? & these signs can the result in?
because I am using the $_GET parameters in.
mt_randis not cryptographically secure, also there's no reason to forces the key to be alphanumeric-only.