tsoding

tsoding / ht.h

Public

Hash Table in C but with a nice Generic API

79
0
100% credibility
Found Apr 06, 2026 at 79 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
C++
AI Summary

A single-header C library that provides a generic hash table for storing and retrieving key-value pairs efficiently.

How It Works

1
👀 Discover the tool

You hear about a handy single-file tool that helps your program remember and quickly find information by name, like a super-fast notebook.

2
📥 Grab the file

Download the one simple file and drop it right into your project's folder.

3
🛠️ Set it up

Tell the tool what kind of names (like words) and values (like numbers) you want to store, so it's ready for your needs.

4
Store your first item

Add a name and its matching value, and feel the magic as it remembers it instantly.

5
🔍 Find and update

Ask for a name anytime, get its value right away, or add a new one if it's missing.

6
📋 Review everything

Take a quick look through all your stored items to see what's there.

🎉 All done!

Your program now finds and manages information lightning-fast, making everything run smoothly.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 79 to 79 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is ht.h?

ht.h is a single-header hash table library for C that delivers a generic API via macros, letting you define tables like Ht(const char*, int) for any key-value pair. It handles core operations—put, find, find-or-put, delete, foreach iteration—with O(1) amortized time complexity via open addressing, solving the pain of rolling your own hash table data structure in pure C without dependencies. Drop it in with #define HT_IMPLEMENTATION before including, and you're hashing strings or structs with custom github hash algorithms like FNV-1a.

Why is it gaining traction?

Its STB-style single-header design means zero build hassle, unlike bulkier alternatives or language-specific options like hash table python or hash table java. Developers dig the clean API with ht_foreach for iteration, ht_find_or_put for upsert, and pluggable hash/eq functions to dodge hash collision issues or tune hash table load factor. It beats scripting hash table powershell or hash table c# wrappers for C projects needing fast hash lookup and hash search.

Who should use this?

Systems programmers building low-level tools, game engines, or embedded apps where you need a lightweight hash table lookup without libc bloat. C devs parsing config files, caching github hash files, or implementing github hash checker for file integrity. Avoid if you're in C++ land—stick to std::unordered_map—or need production-scale perf beyond basic hash generator tasks.

Verdict

Grab it for quick prototypes or personal projects; 79 stars and 1.0% credibility score signal it's fresh (v1.0.0) with solid docs but unproven at scale—no tests visible. Fine for hash table explained in practice, but monitor for hash url edge cases before prime time.

(198 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.