i try change my code for now use openssl_encrypt because mcrypt_* is deprecated on PHP 7.1 and removed for PHP 7.2.
Here my present code with mcrypt and MCRYPT_RIJNDAEL_256:
<?php
class Encoder {
protected $_saltA; // 32 chars
protected $_saltB; // 32 chars
public function __construct($data = null){
$this->_saltA = _GLOBAL_ENCRYPT_SALTA;
$this->_saltB = _GLOBAL_ENCRYPT_SALTB;
}
public function passwordEncode($value){
if(!$value || $value == ""){
return "";
}else{
$rtn = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->_saltA, $value, MCRYPT_MODE_CBC, $this->_saltB);
return base64_encode($rtn);
}
}
public function passwordDecode($value){
if(!$value || $value == ""){
return "";
}else{
$value = base64_decode($value);
$rtn = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->_saltA, $value, MCRYPT_MODE_CBC, $this->_saltB);
return rtrim($rtn, "\0\4");
}
}
}
Thank you for help