Ejemplo n.º 1
0
static CFHashCode
_auth_item_hash(CFTypeRef value)
{
    auth_item_t item = (auth_item_t)value;
    uint64_t crc = crc64_init();
    crc = crc64_update(crc, item->data.name, strlen(item->data.name));
    if (item->data.value) {
        crc = crc64_update(crc, item->data.value, item->data.valueLength);
    }
    crc = crc64_update(crc, &item->data.flags, sizeof(item->data.flags));

    crc = crc64_final(crc);
    return crc;
}
static CFHashCode
_mechanism_hash(CFTypeRef value)
{
    uint64_t crc = crc64_init();
    mechanism_t mech = (mechanism_t)value;
    
    const char * str = mechanism_get_plugin(mech);
    crc = crc64_update(crc, str, strlen(str));
    str = mechanism_get_plugin(mech);
    crc = crc64_update(crc, str, strlen(str));
    bool priv = mechanism_is_privileged(mech);
    crc = crc64_update(crc, &priv, sizeof(priv));
    crc = crc64_final(crc);
    
    return crc;
}