Branch: Tag:

2016-07-03

2016-07-03 10:41:29 by Arne Goedeke <el@laramies.com>

Siphash24: added byte order independent versions for wide strings

This commits adds two versions of siphash for both 16 and 32 bit wide
strings. They are identical to the 8bit version on little endian
machines.
The different siphash versions are now also available dynamic modules.

44:   #include "stuff.h"   #include "pike_compiler.h"   #include "port.h" + #include "siphash24.h"      #include <errno.h>   
465:   static void f_hash( INT32 args )   {    size_t res; -  ptrdiff_t len = 0; +        if( TYPEOF(Pike_sp[-args]) != PIKE_T_STRING )    PIKE_ERROR("hash","Argument is not a string\n",Pike_sp,args);    -  len = Pike_sp[-args].u.string->len; +  res = pike_string_siphash24(Pike_sp[-args].u.string, 0) & 0x7fffffff;    -  res = hashmem_siphash24( Pike_sp[-args].u.string->str, -  len << Pike_sp[-args].u.string->size_shift) & -  0x7fffffff; -  +     if( args > 1 ) {    if(TYPEOF(Pike_sp[1-args]) != T_INT)    SIMPLE_ARG_TYPE_ERROR("hash",2,"int");