public function decryptBinary(string $value, string $key): string
    {
        $iv = substr($value, 0, $this->ivLength);
        $encrypted = substr($value, $this->ivLength);
        $key = $this->hashKey($key);
        $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
        $ret = openssl_decrypt($encrypted, $this->cipher, $key, $opts, $iv);
        if ($ret === false) {
            throw new \Exception("decryption failed; ".openssl_error_string());
        }
        return $ret;
    }
public function decryptBinary(string $value, string $key): string
    {
        $iv = substr($value, 0, $this->ivLength);
        $encrypted = substr($value, $this->ivLength);
        $key = $this->hashKey($key);
        $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
        $ret = openssl_decrypt($encrypted, $this->cipher, $key, $opts, $iv);
        if ($ret === false) {
            throw new \Exception("decryption failed; ".openssl_error_string());
        }
        return $ret;
    }
public function decryptBinary ( string $ value , string $ key ) : string { $ iv = substr ( $ value , 0 , $ this -> ivLength ) ; $ encrypted = substr ( $ value , $ this -> ivLength ) ; $ key = $ this -> hashKey ( $ key ) ; $ opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING ; $ ret = openssl_decrypt ( $ encrypted , $ this -> cipher , $ key , $ opts , $ iv ) ; if ( $ ret === false ) { throw new \ Exception ( "decryption failed; " . openssl_error_string ( ) ) ; } return $ ret ; }
Decrypt a value

@param string $value The encrypted value
@param string $key The encryption key
@return string The decrypted value
@throws \Exception If the decryption fails
Decrypt a value