{"id":13494907,"url":"https://github.com/stbrumme/hash-library","last_synced_at":"2025-03-28T15:32:07.441Z","repository":{"id":41308828,"uuid":"144171000","full_name":"stbrumme/hash-library","owner":"stbrumme","description":"Portable C++ hashing library","archived":false,"fork":false,"pushed_at":"2023-10-10T19:12:58.000Z","size":13,"stargazers_count":490,"open_issues_count":9,"forks_count":140,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-31T09:37:20.387Z","etag":null,"topics":["crc32","endian-independent","hmac","keccak","md5","portable","sha1","sha256","sha3"],"latest_commit_sha":null,"homepage":"https://create.stephan-brumme.com/hash-library/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stbrumme.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":"2018-08-09T15:25:02.000Z","updated_at":"2024-10-31T03:11:36.000Z","dependencies_parsed_at":"2024-10-31T09:41:42.400Z","dependency_job_id":null,"html_url":"https://github.com/stbrumme/hash-library","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stbrumme%2Fhash-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stbrumme%2Fhash-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stbrumme%2Fhash-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stbrumme%2Fhash-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stbrumme","download_url":"https://codeload.github.com/stbrumme/hash-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246053839,"owners_count":20716267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["crc32","endian-independent","hmac","keccak","md5","portable","sha1","sha256","sha3"],"created_at":"2024-07-31T19:01:29.321Z","updated_at":"2025-03-28T15:32:07.141Z","avatar_url":"https://github.com/stbrumme.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Portable C++ Hashing Library\n\nThis is a mirror of my library hosted at https://create.stephan-brumme.com/hash-library/\n\nIn a nutshell:\n\n- computes CRC32, MD5, SHA1 and SHA256 (most common member of the SHA2 functions), Keccak and its SHA3 sibling\n- optional HMAC (keyed-hash message authentication code)\n- no external dependencies, small code size\n- can work chunk-wise (for example when reading streams block-by-block)\n- portable: supports Windows and Linux, tested on Little Endian and Big Endian CPUs\n- roughly as fast as Linux core hashing functions\n- open source, zlib license\n\nYou can find code examples, benchmarks and much more on my website https://create.stephan-brumme.com/hash-library/\n\n# How to use\n\nThis example computes SHA256 hashes but the API is more or less identical for all hash algorithms:\n\n``` cpp\n// SHA2 test program\n#include \"sha256.h\"\n#include \u003ciostream\u003e // for std::cout only, not needed for hashing library\n\nint main(int, char**)\n{\n  // create a new hashing object\n  SHA256 sha256;\n\n  // hashing an std::string\n  std::cout \u003c\u003c sha256(\"Hello World\") \u003c\u003c std::endl;\n  // =\u003e a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e\n\n  // hashing a buffer of bytes\n  const char* buffer = \"How are you\";\n  std::cout \u003c\u003c sha256(buffer, 11) \u003c\u003c std::endl;\n  // =\u003e 9c7d5b046878838da72e40ceb3179580958df544b240869b80d0275cc07209cc\n\n  // or in a streaming fashion (re-use \"How are you\")\n  SHA256 sha256stream;\n  const char* url = \"create.stephan-brumme.com\"; // 25 bytes\n  int step = 5;\n  for (int i = 0; i \u003c 25; i += step)\n    sha256stream.add(url + i, step); // add five bytes at a time\n  std::cout \u003c\u003c sha256stream.getHash() \u003c\u003c std::endl;\n  // =\u003e 82aa771f1183c52f973c798c9243a1c73833ea40961c73e55e12430ec77b69f6\n\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstbrumme%2Fhash-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstbrumme%2Fhash-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstbrumme%2Fhash-library/lists"}