[riot-users] Simple hashing function

Joakim Gebart joakim.gebart at eistec.se
Thu Jan 29 07:38:36 CET 2015


Good idea about splitting the CPUID into two halves. I'll try that, thank you!
Joakim Gebart
Managing Director
Eistec AB

Aurorum 1C
977 75 Luleå
Tel: +46(0)730-65 13 83
joakim.gebart at eistec.se
www.eistec.se


On Tue, Jan 27, 2015 at 12:50 PM, Martine Lenders
<authmillenon at gmail.com> wrote:
> Hey Joakim,
> There is already a collection of hashing implementations in
> sys/include/hashes.h.
> Unfortunally all of them yield 32 bit integers. I did however also used the
> CPU ID and djb2_hash() in [1] to initialize an IEEE 802.15.4 device's EUI-64
> - which is the link-layer pendent to the IPv6 host suffix [2] - by spliting
> the CPU ID in half, generating a 32-bit hash from each half and splicing
> them together again as a 64-bit number.
>
> Best regards,
> Martine
>
> [1]
> https://github.com/RIOT-OS/RIOT/blob/master/sys/auto_init/auto_init.c#L136
> [2] https://tools.ietf.org/html/rfc4291#page-20
>
> 2015-01-27 12:39 GMT+01:00 Joakim Gebart <joakim.gebart at eistec.se>:
>>
>> Hello,
>> I am looking for a simple (few lines to implement) hashing function to
>> reduce a 128 bit integer to 64 bits.
>>
>> I want to use the hash to derive a 64 bit IPv6 host address from a 128
>> bit CPU ID.
>>
>> I want all of the bits of the CPUID to affect the result, instead of
>> just grabbing the top/bottom 8 bytes of the ID. I'm guessing there are
>> lots of options for hashes, but many are made to generate hashes from
>> much longer messages than 128 bit.
>>
>> Any suggestions?
>>
>> Best regards,
>> Joakim Gebart
>> Eistec AB
>> www.eistec.se
>> _______________________________________________
>> users mailing list
>> users at riot-os.org
>> http://lists.riot-os.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/users
>


More information about the users mailing list