public function value($key) {
        if (!isset($_COOKIE[$key])) {
            return null;
        }
        if ($this->hashed) {
            list($value, $hash) = unserialize($_COOKIE[$key]);
            if ($hash != hash('sha256', $value . $this->salt)) {
                return null;
            }
        } else {
            $value = $_COOKIE[$key];
        }
        return unserialize($value);
    }