public function decrypt($data)
    {
        $json = base64_decode($data);
        $data = json_decode($json);

        // check mac
        if ($this->hashCheck($data->iv, $data->value, $data->mac)) {

            $iv = base64_decode($data->iv);

            $data = openssl_decrypt($data->value, $this->method, $this->key, 0, $iv);

            return unserialize($data);

        }

        throw new Exception('Mac not match.');
    }