From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml defaut hash ?
Date: Sat, 23 Apr 2016 13:21:40 +0200 [thread overview]
Message-ID: <1461410500.26469.167.camel@e130.lan.sumadev.de> (raw)
In-Reply-To: <20160423091630.GA25686@delli7.univ-savoie.fr>
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
Am Samstag, den 23.04.2016, 11:16 +0200 schrieb Christophe Raffalli:
> By the way what I really need is a hash function for arrays that I can
> update when I update one entry in the array. Does anyone known of
> such a hash function ?
It would have to be commutative then (you need to remove the old version
and add the new one, for any element for the array). You could use XOR
or + of the hashes of the individual elements.
If this doesn't work good enough, I'd try to define larger hash blocks.
E.g. consider 4 consecutive elements as a block, and compute the hash of
the block, and take the XOR of all blocks you have. Quality depends a
little bit on what is in the elements.
Gerd
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-04-23 11:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-23 9:16 Christophe Raffalli
2016-04-23 11:21 ` Gerd Stolpmann [this message]
2016-04-23 15:41 ` Christophe Raffalli
2016-04-23 17:22 ` Gerd Stolpmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461410500.26469.167.camel@e130.lan.sumadev.de \
--to=info@gerd-stolpmann.de \
--cc=Christophe.Raffalli@univ-savoie.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).