{"id":23129378,"url":"https://github.com/jmcph4/rfc1321","last_synced_at":"2025-06-25T06:03:37.291Z","repository":{"id":268300342,"uuid":"903615860","full_name":"jmcph4/rfc1321","owner":"jmcph4","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-11T08:56:24.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T06:31:15.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmcph4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["jmcph4"]}},"created_at":"2024-12-15T04:25:09.000Z","updated_at":"2025-01-11T08:56:27.000Z","dependencies_parsed_at":"2024-12-15T22:26:00.712Z","dependency_job_id":"719a1921-14f7-437c-beb7-b69aa35b5b1e","html_url":"https://github.com/jmcph4/rfc1321","commit_stats":null,"previous_names":["jmcph4/rfc1321"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmcph4/rfc1321","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Frfc1321","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Frfc1321/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Frfc1321/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Frfc1321/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmcph4","download_url":"https://codeload.github.com/jmcph4/rfc1321/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Frfc1321/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261816054,"owners_count":23213840,"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":[],"created_at":"2024-12-17T10:09:14.381Z","updated_at":"2025-06-25T06:03:37.263Z","avatar_url":"https://github.com/jmcph4.png","language":"C","funding_links":["https://github.com/sponsors/jmcph4"],"categories":[],"sub_categories":[],"readme":"# MD5 Reference Implementation in C as per RFC1321 #\n\nThe [MD5](https://en.wikipedia.org/wiki/MD5) cryptographic hash function is fully specified in [RFC 1321](https://www.ietf.org/rfc/rfc1321.txt)[1]. This document contains a reference implementation in the C programming language in its appendices (Appendix A, specifically). This repository contains what is largely a copy-paste of this implementation for both pedagogical and convenience purposes.\n\nQuoting Appendix A directly:\n\n \u003e  This appendix contains the following files taken from RSAREF: A\n \u003e  Cryptographic Toolkit for Privacy-Enhanced Mail:\n \u003e \n \u003e    global.h -- global header file\n \u003e\n \u003e    md5.h -- header file for MD5\n \u003e \n \u003e    md5c.c -- source code for MD5\n \u003e \n \u003e  For more information on RSAREF, send email to \u003crsaref@rsa.com\u003e.\n \u003e \n \u003e  The appendix also includes the following file:\n \u003e \n \u003e    mddriver.c -- test driver for MD2, MD4 and MD5\n \u003e \n \u003e  The driver compiles for MD5 by default but can compile for MD2 or MD4\n \u003e  if the symbol MD is defined on the C compiler command line as 2 or 4.\n \u003e \n \u003e  The implementation is portable and should work on many different\n \u003e  plaforms. However, it is not difficult to optimize the implementation\n \u003e  on particular platforms, an exercise left to the reader. For example,\n \u003e  on \"little-endian\" platforms where the lowest-addressed byte in a 32-\n \u003e  bit word is the least significant and there are no alignment\n \u003e  restrictions, the call to Decode in MD5Transform can be replaced with\n \u003e  a typecast.\n\nAny file within this repository that is not on this list is not part of the original RFC.\n\nAdditionally, Ronald Rivest's contact information is listed as:\n\n \u003e Ronald L. Rivest\n \u003e\n \u003e Massachusetts Institute of Technology\n \u003e\n \u003e Laboratory for Computer Science\n \u003e\n \u003e NE43-324\n \u003e\n \u003e 545 Technology Square\n \u003e\n \u003e Cambridge, MA  02139-1986\n \u003e \n \u003e\n \u003e Phone: (617) 253-5880\n \u003e\n \u003e EMail: rivest@theory.lcs.mit.edu\n\n## Modifications ##\n\nThe original reference implementation in the RFC is intended for 32-bit machines. Due to the lack of standard integer types (a la `stdint.h`) at the time, `unsigned long int` was typecast to `UINT4` (and similarly for `UINT2`). When compiling on modern 64-bit machines these invariants of course break. As such, I have modified these type aliases accordingly. The Git-flavoured diff for this change is as follows:\n\n```diff\ndiff --git a/global.h b/global.h\nindex 2ed41be..bc5029d 100644\n--- a/global.h\n+++ b/global.h\n@@ -1,5 +1,6 @@\n /* GLOBAL.H - RSAREF types and constants\n  */\n+#include \u003cstdint.h\u003e\n \n /* PROTOTYPES should be set to one if and only if the compiler supports\n   function argument prototyping.\n@@ -14,10 +15,10 @@ The following makes PROTOTYPES default to 0 if it has not already\n typedef unsigned char *POINTER;\n \n /* UINT2 defines a two byte word */\n-typedef unsigned short int UINT2;\n+typedef uint16_t UINT2;\n \n /* UINT4 defines a four byte word */\n-typedef unsigned long int UINT4;\n+typedef uint32_t UINT4;\n \n /* PROTO_LIST is defined depending on how PROTOTYPES is defined above.\n If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it\n```\n\n## Security ##\n\nAs of the time of writing, MD5 has long been known to be cryptographically broken. Please consult RFC 6151[2] for technical guidance on its use.\n\n## Bibliography ##\n\n 1. R. Rivest, \"The MD5 Message-Digest Algorithm,\" RFC 1321, Internet Engineering Task Force (IETF), Apr. 1992. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1321. [Accessed: Dec. 15, 2024].\n 2. L. Turner and S. Chen, \"Updated Security Considerations for the MD5 Message-Digest and the HMAC-MD5 Algorithms,\" RFC 6151, Internet Engineering Task Force (IETF), Mar. 2011. [Online]. Available: https://www.rfc-editor.org/rfc/rfc6151. [Accessed: Dec. 15, 2024].\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcph4%2Frfc1321","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmcph4%2Frfc1321","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcph4%2Frfc1321/lists"}