summaryrefslogtreecommitdiff
path: root/hash.c
blob: 6201275aa75bfeb6b4107ef8da8b76344c93c5e7 (plain)
1
2
3
4
5
6
7
8
9
10
#include "hash.h"

size_t hash_bytes(const void* start, size_t size) {
    size_t hash = 0;
    const char* raw_data = start;
    for (size_t i = 0; i < size; i++) {
        hash = (hash << 5) - hash + raw_data[i];
    }
    return hash;
}