bryc
2/10/2018 - 12:00 AM

simphash2.c

uint32_t simphash(const uint8_t *data, uint32_t len) {
    uint32_t tmp, hash = 0xbf3931a8;
    int i;
    for(i = 0; i < len; i++) {
        hash += (hash << 3) + data[i];
        hash ^= hash >> 1;
    }
    for(tmp = hash; tmp > 0; tmp >>= 3) {
        hash += (hash << 4) ^ tmp;
    }
    return hash;
}