{"id":31363854,"url":"https://github.com/gregorykogan/md5-lib","last_synced_at":"2025-09-27T05:26:28.840Z","repository":{"id":314597156,"uuid":"1056105332","full_name":"GregoryKogan/md5-lib","owner":"GregoryKogan","description":"A production-grade, high-performance, and self-contained C++17 library for RFC 1321 MD5 hashing, featuring a modern streaming API for large files.","archived":false,"fork":false,"pushed_at":"2025-09-24T13:47:05.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T15:27:16.006Z","etag":null,"topics":["cmake","cpp","cpp17","cross-platform","hashing","library","md5","rfc-1321","security","self-contained","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://gregorykogan.github.io/md5-lib/","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/GregoryKogan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-13T11:56:13.000Z","updated_at":"2025-09-24T13:47:09.000Z","dependencies_parsed_at":"2025-09-13T14:39:23.701Z","dependency_job_id":"3278fbd1-f22a-4f87-8d1c-b467400faaff","html_url":"https://github.com/GregoryKogan/md5-lib","commit_stats":null,"previous_names":["gregorykogan/md5-lib"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/GregoryKogan/md5-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fmd5-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fmd5-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fmd5-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fmd5-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GregoryKogan","download_url":"https://codeload.github.com/GregoryKogan/md5-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fmd5-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277184148,"owners_count":25775286,"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","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"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":["cmake","cpp","cpp17","cross-platform","hashing","library","md5","rfc-1321","security","self-contained","zero-dependencies"],"created_at":"2025-09-27T05:26:22.673Z","updated_at":"2025-09-27T05:26:28.833Z","avatar_url":"https://github.com/GregoryKogan.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# md5-lib\n\n[![C++ CI](https://github.com/GregoryKogan/md5-lib/actions/workflows/ci.yml/badge.svg)](https://github.com/GregoryKogan/md5-lib/actions/workflows/ci.yml)\n[![Coverage](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgist.githubusercontent.com%2FGregoryKogan%2Fe7f979d87a15bcaf7db7f64c68e09fb8%2Fraw%2Fmd5-lib-coverage.json\u0026query=message\u0026label=coverage\u0026logo=c%2B%2B\u0026color=4c1)](https://github.com/GregoryKogan/md5-lib/actions/workflows/ci.yml)\n[![Docs](https://img.shields.io/badge/Docs-latest-blue.svg)](https://gregorykogan.github.io/md5-lib/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA self-contained, high-performance C++17 library for calculating MD5 hashes, adhering strictly to RFC 1321.\n\nThis library is designed for production-grade applications, emphasizing performance, security, and ease of use. It is built with modern C++ best practices and is thoroughly tested across all major platforms.\n\n## Features\n\n- **RFC 1321 Compliant:** A faithful and strict implementation of the MD5 standard.\n- **Streaming Interface:** Capable of hashing large files and data streams without loading them entirely into memory.\n- **High Performance:** Optimized for speed by minimizing memory allocations, data copies, and using a high-performance hex formatter.\n- **Zero Dependencies:** Written in pure C++17. Requires only a standard C++ compiler and CMake.\n- **Cross-Platform:** Continuously built and tested on Windows, macOS, and Linux via GitHub Actions.\n- **Clean \u0026 Modern API:** Designed with modern C++ best practices, including `[[nodiscard]]` and a clear, stateless interface.\n- **Fully Documented:** Includes comprehensive API documentation generated by Doxygen and hosted on GitHub Pages.\n\n## Requirements\n\n- **CMake** (version 3.14 or higher)\n- **A C++17 compliant compiler** (e.g., GCC 9+, Clang 7+, MSVC 19.14+)\n\n## Building and Testing\n\nThe project uses a standard CMake workflow and is self-contained, fetching the Google Test dependency automatically.\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/GregoryKogan/md5-lib.git\ncd md5-lib\n\n# 2. Configure the project in a 'build' directory\ncmake -S . -B build\n\n# 3. Build the library and test executable\ncmake --build build\n\n# 4. Run the tests\ncd build\nctest --verbose\n```\n\n## Integrating md5-lib\n\nYou can integrate `md5-lib` into your own CMake project in several ways.\n\n### Method 1: CMake FetchContent (Recommended)\n\nThis is the recommended approach for modern CMake projects. `FetchContent` will download and configure `md5-lib` automatically at configure time. It requires no manual cloning.\n\nIn your `CMakeLists.txt`:\n\n```cmake\ncmake_minimum_required(VERSION 3.14)\nproject(MyApp)\n\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\n# --- Add md5-lib ---\ninclude(FetchContent)\nFetchContent_Declare(\n  md5-lib\n  GIT_REPOSITORY https://github.com/GregoryKogan/md5-lib.git\n  GIT_TAG        v1.1.0  # Use a specific version tag for stability\n)\nFetchContent_MakeAvailable(md5-lib)\n# --------------------\n\n# Define your application's executable\nadd_executable(my_app main.cpp)\n\n# Link against md5-lib\ntarget_link_libraries(my_app PRIVATE md5_lib)\n```\n\n### Method 2: Git Submodule and add_subdirectory()\n\nThis method is ideal if you need to work offline or want to lock the dependency to a specific commit in your own Git history.\n\n1. **Add `md5-lib` as a submodule to your project:**\n\n    ```bash\n    # Run this from the root of your repository\n    git submodule add https://github.com/GregoryKogan/md5-lib.git third_party/md5-lib\n    ```\n\n2. **In your `CMakeLists.txt`, add the subdirectory:**\n\n    ```cmake\n    cmake_minimum_required(VERSION 3.14)\n    project(MyApp)\n\n    set(CMAKE_CXX_STANDARD 17)\n    set(CMAKE_CXX_STANDARD_REQUIRED ON)\n\n    # --- Add md5-lib ---\n    # Assumes the submodule is in third_party/md5-lib\n    add_subdirectory(third_party/md5-lib)\n    # --------------------\n\n    add_executable(my_app main.cpp)\n\n    # Link against md5-lib\n    target_link_libraries(my_app PRIVATE md5_lib)\n    ```\n\n### Method 3: System-Wide Installation and find_package()\n\nThis is a more traditional approach. First, you build and install `md5-lib` on your system, and then your project finds it using `find_package`.\n\n1. **Build and install `md5-lib`:**\n\n    ```bash\n    git clone https://github.com/GregoryKogan/md5-lib.git\n    cd md5-lib\n    cmake -S . -B build\n    cmake --build build\n    sudo cmake --install build # May require sudo\n    ```\n\n2. **In your `CMakeLists.txt`, find and link the installed library:**\n\n    ```cmake\n    cmake_minimum_required(VERSION 3.14)\n    project(MyApp)\n\n    set(CMAKE_CXX_STANDARD 17)\n    set(CMAKE_CXX_STANDARD_REQUIRED ON)\n\n    # --- Find and link md5-lib ---\n    find_package(md5-lib REQUIRED)\n    # ---------------------------\n\n    add_executable(my_app main.cpp)\n\n    # Note the namespaced target, which is modern CMake best practice\n    target_link_libraries(my_app PRIVATE md5_lib::md5_lib)\n    ```\n\n### Simpler Alternative: Manual Copy\n\nFor very small projects, you can simply copy the `include/md5.h` and `src/md5.cpp` files directly into your source tree and add them to your `add_executable` or `add_library` command. This is less maintainable as you won't get updates automatically.\n\n## Example Usage\n\nThe library exposes its API through the `md5.h` header and the `md5_lib` namespace.\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003csstream\u003e\n\n#include \u003cmd5.h\u003e\n\nint main() {\n    // Example 1: Hashing from an in-memory string\n    const std::string text = \"message digest\";\n    const unsigned char* data = reinterpret_cast\u003cconst unsigned char*\u003e(text.data());\n    std::string hash_mem = md5_lib::CalculateMD5(data, text.size());\n\n    std::cout \u003c\u003c \"MD5 of \\\"\" \u003c\u003c text \u003c\u003c \"\\\": \" \u003c\u003c hash_mem \u003c\u003c std::endl;\n    // Expected output: MD5 of \"message digest\": f96b697d7cb7938d525a2f31aaf161d0\n\n    // Example 2: Hashing from a std::stringstream\n    std::stringstream ss(\"abcdefghijklmnopqrstuvwxyz\");\n    std::string hash_stream = md5_lib::CalculateMD5(ss);\n\n    std::cout \u003c\u003c \"MD5 of the alphabet: \" \u003c\u003c hash_stream \u003c\u003c std::endl;\n    // Expected output: MD5 of the alphabet: c3fcd3d76192e4007dfb496cca67e13b\n\n    return 0;\n}\n```\n\n## Documentation\n\nFor a comprehensive API reference and implementation details, please see the  \n**[Doxygen documentation hosted on GitHub Pages](https://GregoryKogan.github.io/md5-lib/)**.\n\nThe documentation is automatically generated and deployed from the `main` branch.\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorykogan%2Fmd5-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorykogan%2Fmd5-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorykogan%2Fmd5-lib/lists"}