function get_hash()
    {
        $prefs = $this->get_prefs();

        // generate a random hash and store it in user prefs
        if (empty($prefs['client_hash'])) {
            $prefs['client_hash'] = rcube_utils::random_bytes(16);
            $this->save_prefs(array('client_hash' => $prefs['client_hash']));
        }

        return $prefs['client_hash'];
    }