protected function decrypt($data, $key)
    {
        $base64 = base64_decode($data, true);

        $keySize = openssl_cipher_iv_length(static::CRYPT_MODE);
        $key     = $this->generateKey($key);

        $iv      = substr($base64, 0, $keySize);
        $results = substr($base64, $keySize);

        $results = openssl_decrypt(
            $results, static::CRYPT_MODE, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv
        );

        return $results;
    }