Hashing Library for C

I try to find some Hashing libraries for C and find several good ones.

The hsearch function in the GNU C library.

There are other methods to organize information which later should be searched. The costs of insert, delete and search differ. One possible implementation is using hashing tables. The following functions are declared in the header file search.h.

CMPH – C Minimal Perfect Hashing Library.

The CMPH Library encapsulates the newest and more efficient algorithms in an easy-to-use, production-quality, fast API. The library was designed to work with big entries that cannot fit in the main memory. It has been used successfully for constructing minimal perfect hash functions for sets with more than 100 million of keys, and we intend to expand this number to the order of billion of keys.

libghthash.

libghthash is a Generic Hash Table which is meant to be easy to extend, portable, clear in its code and easy to use. You can store any kind of data in it, regardless of size etc. It should be fairly portable, and has been successfully tried on Linux/x86, Solaris/SPARC and Win2000/x86 so far.

Similar Posts

  • How to enable iptables on CentOS 7 / Fedora 20?

    iptables is plain old good. How to enable it after I disable firewalld? First, install the iptables-services package as root: # yum install iptables-services Then, start iptables service as root: # touch /etc/sysconfig/iptables # touch /etc/sysconfig/ip6tables # systemctl start iptables # systemctl start ip6tables # systemctl enable iptables # systemctl enable ip6tables Read more: How…

  • Fedora 中文字体设置

    Fedora 一直有中文字体难看的问题, 尤其是在英文环境中. 使用本文中的配置方法可以得到令人满意的中文效果. 此方案中使用字体都为开源且在Fedora源中自带. 此方案对 Fedora 9 – 20 有效. 对于后续版本支持我会确认并更新此文章. 此方案对Gnome, KDE都有效. Firefox 中也有中文难看的问题, 后面会提到. 快速配置方法 如果你想马上配置好,请使用如下命令。此方法测试使用效果良好。 # yum install cjkuni-ukai-fonts cjkuni-uming-fonts # wget https://raw.githubusercontent.com/zma/config_files/master/others/local.conf \ -O /etc/fonts/local.conf 相关英文字体配置可以参考:Improving Fedora Font Rendering with Open Software and Fonts Only. Fedora 系统中文字体的配置方案 使用uming和ukai字体,即AR PL UMing CN等. 中文字体和等宽字体效果如图所示(点击看大图, Firefox 中文字体设置在后面会提到). 方法如下: 安装字体 首先安装这两个字体: cjkuni-ukai-fonts cjkuni-uming-fonts (在Fedora…

  • How to resize a virtual disk of KVM

    I test it for qcow2 format. Other formats are TBA. qemu-img resize kvm1.qcow2 +20G cp kvm1.qcow2 kvm1-orig.qcow2 virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2 Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/ I test it for qcow2 format. Other formats are TBA. qemu-img resize kvm1.qcow2 +20G cp kvm1.qcow2 kvm1-orig.qcow2 virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2 Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/ Read more: How to resize a batch…

One Comment

  1. An example of a piece of code using libghthash:

        ght_hash_table_t *tx_table = NULL;
        ppm_tx_id_t txid;
    
        // prepare the hash table
        tx_table = ght_create(HASH_TABLE_SIZE);
    
        // allow rehash. Note: rehashing is costly.
        ght_set_rehash(tx_table, TRUE);
    
    
        ...
    
    
        // check the hash whether the txid key exists
        pdata = ght_get(tx_table,
                sizeof(ppm_tx_id_t), &(txid));
    
        if (pdata != NULL) {
            // replace the entry in the hash table
            ght_replace(tx_table,
                    &type_b,
                    sizeof(ppm_tx_id_t), &(txid));
        } else {
            // insert to the hash
            ght_insert(tx_table,
                    &type_b,
                    sizeof(ppm_tx_id_t), &(txid));
        }
    

Leave a Reply

Your email address will not be published. Required fields are marked *