{"id":23383356,"url":"https://github.com/blagojeblagojevic/sha256","last_synced_at":"2025-06-14T01:40:33.185Z","repository":{"id":252917772,"uuid":"841901804","full_name":"BlagojeBlagojevic/sha256","owner":"BlagojeBlagojevic","description":"SHA256 as a header library","archived":false,"fork":false,"pushed_at":"2024-08-13T13:57:32.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T09:48:24.679Z","etag":null,"topics":["c","cryptography","header-only","sha2","sha256","sha256-hash"],"latest_commit_sha":null,"homepage":"","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/BlagojeBlagojevic.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":"2024-08-13T09:18:57.000Z","updated_at":"2025-03-25T22:41:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"54c22338-f4c6-4ccd-8ae9-4febc3074084","html_url":"https://github.com/BlagojeBlagojevic/sha256","commit_stats":null,"previous_names":["blagojeblagojevic/sha256"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BlagojeBlagojevic/sha256","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2Fsha256","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2Fsha256/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2Fsha256/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2Fsha256/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlagojeBlagojevic","download_url":"https://codeload.github.com/BlagojeBlagojevic/sha256/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2Fsha256/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259746556,"owners_count":22905281,"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":["c","cryptography","header-only","sha2","sha256","sha256-hash"],"created_at":"2024-12-21T22:20:11.443Z","updated_at":"2025-06-14T01:40:33.165Z","avatar_url":"https://github.com/BlagojeBlagojevic.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n---\n\n# SHA-256 Hash Implementation\n\nThis project provides a C implementation of the SHA-256 hashing algorithm. SHA-256 is part of the SHA-2 family of cryptographic hash functions and is widely used for secure data hashing and digital signatures.\n\n## Features\n\n- **SHA-256 Algorithm**: Implements the SHA-256 hash function as defined by the [SHA-2 standard](https://en.wikipedia.org/wiki/SHA-2).\n- **Inline Functions**: Provides efficient hash computation using inline functions.\n- **Error Handling**: Includes basic error handling for memory allocation issues.\n\n## File Overview\n\n### `hash.h`\n\n- **Header File**: Contains definitions, macro functions, and function prototypes for the SHA-256 hash implementation.\n- **Macros**: Defines helper macros for bitwise operations, rotations, and bit manipulation.\n- **Types**: Defines the `HASH_CTX` structure for maintaining the state of the hash computation.\n\n\n\n- **SHA-256 Functions**:\n  - `HASH_Init()`: Initializes the hash context.\n  - `HASH_Transform()`: Processes a 512-bit block of data.\n  - `HASH_Update()`: Updates the hash context with new data.\n  - `HASH_Final()`: Finalizes the hash computation and produces the final hash value.\n  - `HASH()`: Convenience function to hash a string and return the hash as a hexadecimal string.\n\n## Usage\n\nTo use the SHA-256 hashing functions in your C project:\n\n1. **Include the Header File**:\n\n   ```c\n   #define HASH_IMPLEMENTATION\n   #include \"hash.h\"\n   ```\n\n2. **Hash a String**:\n\n   ```c\n   #include \u003cstdio.h\u003e\n   #include \u003cstdlib.h\u003e\n   #include \u003cstring.h\u003e\n   #include \"hash.h\"\n\n   int main() {\n       char *input = \"Hello, world!\";\n       char *hashStr = HASH(input);\n       printf(\"Hash: %s\\n\", hashStr);\n       free(hashStr);\n       return EXIT_SUCCESS;\n   }\n   ```\n\n## Compilation\n\nTo compile the code:\n\n```bash\ngcc -o hash_program hash.c -O2\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [Wikipedia - SHA-2](https://en.wikipedia.org/wiki/SHA-2): For the detailed explanation of SHA-256.\n  \n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblagojeblagojevic%2Fsha256","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblagojeblagojevic%2Fsha256","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblagojeblagojevic%2Fsha256/lists"}