diff --git a/cv6/a_station.c b/cv6/a_station.c index 6339ef3..4223919 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -27,13 +27,14 @@ void destroy_station(struct station* station){ } int select_track(struct station* station, const char* target){ - unsigned char *str; + unsigned long + hash(unsigned char *str) { - unsigned long hash = 0; + unsigned long hash = 5381; int c; while (c = *str++) - hash = c + (hash << 6) + (hash << 16) - hash; + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; }