Arduino/Control Code/Lighting_2019/NetworkUtilities.cpp
// A simple hash function from Robert Sedgwick's "Algorithms in C" book.
// Code taken from http://www.partow.net/programming/hashfunctions/
A simple hash function from Robert Sedgwick's "Algorithms in C" book.
A simple hash function from Robert Sedgwick ' s " Algorithms in C " book .
unsigned long int RSHash(const char* str)
{
   unsigned long int b    = 378551;
   unsigned long int a    = 63689;
   unsigned long int hash = 0;
   unsigned long int i    = 0;
   for (; *str != 0; ++str, ++i) {
      hash = hash * a + (*str);
      a    = a * b;
   }
   return hash;
}
unsigned long int RSHash ( const char * str ) { unsigned long int b = 378551 ; unsigned long int a = 63689 ; unsigned long int hash = 0 ; unsigned long int i = 0 ; for ( ; * str != 0 ; ++ str , ++ i ) { hash = hash * a + ( * str ) ; a = a * b ; } return hash ; }
A simple hash function from Robert Sedgwick's "Algorithms in C" book.
A simple hash function from Robert Sedgwick ' s " Algorithms in C " book .