{"id":20381718,"url":"https://github.com/jacob-c-smith/dict","last_synced_at":"2026-06-05T08:31:20.985Z","repository":{"id":65699636,"uuid":"493784633","full_name":"Jacob-C-Smith/dict","owner":"Jacob-C-Smith","description":"Tested, thread safe, mutable, iterable, string indexed collection.","archived":false,"fork":false,"pushed_at":"2025-03-14T19:13:04.000Z","size":95,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T20:24:53.077Z","etag":null,"topics":["c","dictionary","tested","thread-safe"],"latest_commit_sha":null,"homepage":"https://g10.app/status/#abstract_data_i","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jacob-C-Smith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-18T18:39:08.000Z","updated_at":"2025-03-14T19:13:08.000Z","dependencies_parsed_at":"2023-11-06T02:25:36.045Z","dependency_job_id":"6e804f94-0aad-4059-8751-5c7c68b304e6","html_url":"https://github.com/Jacob-C-Smith/dict","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Jacob-C-Smith/dict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fdict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fdict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fdict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fdict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jacob-C-Smith","download_url":"https://codeload.github.com/Jacob-C-Smith/dict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacob-C-Smith%2Fdict/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33937661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dictionary","tested","thread-safe"],"created_at":"2024-11-15T02:15:05.180Z","updated_at":"2026-06-05T08:31:20.969Z","avatar_url":"https://github.com/Jacob-C-Smith.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dict\n[![CMake](https://github.com/Jacob-C-Smith/dict/actions/workflows/cmake.yml/badge.svg)](https://github.com/Jacob-C-Smith/dict/actions/workflows/cmake.yml)\n\n**Dependencies:**\\\n[![hash-cache](https://github.com/Jacob-C-Smith/hash-cache/actions/workflows/cmake.yml/badge.svg)](https://github.com/Jacob-C-Smith/hash-cache/actions/workflows/cmake.yml)\n[![sync](https://github.com/Jacob-C-Smith/sync/actions/workflows/cmake.yml/badge.svg)](https://github.com/Jacob-C-Smith/sync/actions/workflows/cmake.yml)\n[![log](https://github.com/Jacob-C-Smith/log/actions/workflows/cmake.yml/badge.svg)](https://github.com/Jacob-C-Smith/log/actions/workflows/cmake.yml)\n\n A minimal, thread-safe dictionary implementation written in C. \n\n \u003e 0 [Try it](#try-it)\n \u003e\n \u003e 1 [Commentary](#commentary)\n \u003e \n \u003e 2 [Download](#download)\n \u003e\n \u003e 3 [Build](#build)\n \u003e\n \u003e 4 [Example](#example)\n \u003e\n \u003e\u003e 4.1 [Example output](#example-output)\n \u003e\n \u003e 5 [Tester](#tester)\n \u003e\n \u003e 6 [Definitions](#definitions)\n \u003e\n \u003e\u003e 6.1 [Type definitions](#type-definitions)\n \u003e\u003e\n \u003e\u003e 6.2 [Function definitions](#function-definitions)\n\n## Try it\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Jacob-C-Smith/dict?quickstart=1)\n\nWait for a few moments, then click the play button on the bottom of the window. This will run the example program.\n\n ## Commentary\n - I implemented the dictionary using a hash table.\n - I opted to use chaining over open addressing.\n - I opted to use xxHash after evaluating a few hashing functions.\n - I evaluated the hashing functions by running the tester 1024 times, and averaging the run times.\n \n | Hash function           | Time (μs) |\n |-------------------------|-----------|\n | xxHash                  | 193.247   |\n | Cyclic redundancy check | 197.451   |\n | Fowler–Noll–Vo Hash     | 216.446   |\n | MurMur Hash             | 241.187   |\n\n ## Download\n To download dict, execute the following command\n ```bash\n $ git clone https://github.com/Jacob-C-Smith/dict\n ```\n ## Build\n To build on UNIX like machines, execute the following commands in the same directory\n ```bash\n $ cd dict\n $ cmake .\n $ make\n ```\n  This will build the example program, the tester program, and dynamic / shared libraries\n\n  To build dict for Windows machines, open the base directory in Visual Studio, and build your desired target(s)\n ## Example\n To run the example program, execute this command\n ```\n $ ./dict_example\n ```\n ### Example output\n ```\nRed\nGreen\nBlue\n\nDogs\nCats\nBrown Bear\nFish\nCapybara\n\nDogs\nCats\nBirds\nFish\n ```\n [Source](main.c)\n## Tester\n To run the tester program, execute this command after building\n ```\n $ ./dict_test\n ```\n [Source](dict_test.c)\n \n [Tester output](test_output.txt)\n ## Definitions\n ### Type definitions\n ```c\n typedef struct dict_s dict;\n ```\n ### Function definitions\n ```c \n // Allocaters\n int dict_create ( dict **pp_dict );\n \n // Constructors\n int dict_construct ( dict **pp_dict, size_t   size, crypto_hash_function_64_t pfn_hash_function );\n int dict_from_keys ( dict **pp_dict, char   **keys, size_t keys_length );\n \n // Accessors\n void   *dict_get    ( dict *p_dict, char  *key );\n size_t  dict_values ( dict *p_dict, char **values );\n size_t  dict_keys   ( dict *p_dict, char **keys );\n \n // Mutators\n int dict_add ( dict *p_dict, const char *key, void  *p_value );\n int dict_pop ( dict *p_dict, char       *key, void **pp_value );\n \n // Shallow copy\n int dict_copy ( dict *p_dict, dict **pp_dict );\n \n // Clear all items\n int dict_clear      ( dict *p_dict );\n int dict_free_clear ( dict *p_dict, void (*free_func) (void *) );\n\n // Destructors\n int dict_destroy ( dict **pp_dict );\n ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-c-smith%2Fdict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacob-c-smith%2Fdict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-c-smith%2Fdict/lists"}