{"id":24334357,"url":"https://github.com/hubenchang0515/cryptography","last_synced_at":"2026-01-25T14:03:53.804Z","repository":{"id":65573648,"uuid":"105744372","full_name":"hubenchang0515/Cryptography","owner":"hubenchang0515","description":"Cryptography Hash Algorithm - 消息摘要算法库","archived":false,"fork":false,"pushed_at":"2024-06-04T14:41:22.000Z","size":98,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T21:32:58.956Z","etag":null,"topics":["cryptography","md5","sha","sha2"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hubenchang0515.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}},"created_at":"2017-10-04T07:59:52.000Z","updated_at":"2025-06-03T13:17:05.000Z","dependencies_parsed_at":"2024-06-04T16:22:02.023Z","dependency_job_id":"d1f15a64-72ac-47f9-9385-c61b143864fc","html_url":"https://github.com/hubenchang0515/Cryptography","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hubenchang0515/Cryptography","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubenchang0515%2FCryptography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubenchang0515%2FCryptography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubenchang0515%2FCryptography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubenchang0515%2FCryptography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hubenchang0515","download_url":"https://codeload.github.com/hubenchang0515/Cryptography/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubenchang0515%2FCryptography/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cryptography","md5","sha","sha2"],"created_at":"2025-01-18T04:15:47.797Z","updated_at":"2026-01-25T14:03:53.734Z","avatar_url":"https://github.com/hubenchang0515.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptography\nA simple cryptography hash functions library of C programming luanguage.\n\n## Note\n* Suggest using `-O3` compiler optimization. \n* It should support little-endian and big-endian BUT hasn't been tested in big-endian machine.\n\n## Build\n```bash\nmake\n```\n* then copy `crypto` to your PATH.\n\n## Usage\n```\nUsage   : crypto [md5|sha1|sha224|sha256|sha384|sha512] \u003cfile\u003e\nExample : crypto md5 text.txt\n          crypto sha256 text.txt\n```\n\n## API Index\n[MD5](doc/md5.md)  \n[SHA1](doc/sha1.md)  \n[SHA2](doc/sha2.md)  \n\n## Demo\n```C\n#include \u003cstdio.h\u003e\n#include \u003cstring.h\u003e\n#include \u003cerrno.h\u003e\n#include \"md5.h\"\n#include \"sha1.h\"\n#include \"sha2.h\"\n\nconst char* filename(const char* filepath)\n{\n\tconst char* p = filepath + strlen(filepath) - 1;\n\tfor(; p \u003e= filepath \u0026\u0026 *p != '/' \u0026\u0026 *p != '\\\\'; p--);\n\treturn p+1;\n}\n\ntypedef struct CallListNode{\n\tconst char* key;\n\tvoid (*initFunc)(void* state);\n\tvoid (*updateFunc)(void* state, const void* data, size_t length);\n\tconst char* (*hexFunc)(void* state);\n}CallListNode;\n\n\n/* Options List [gcc -Wno-incompatible-pointer-types] */\nCallListNode callList[] = \n{\n\t{\"md5\", md5Reset, md5Update, md5Hex},\n\t{\"sha1\", sha1Reset, sha1Update, sha1Hex},\n\t{\"sha224\", sha224Reset, sha224Update, sha224Hex},\n\t{\"sha256\", sha256Reset, sha256Update, sha256Hex},\n\t{\"sha384\", sha384Reset, sha384Update, sha384Hex},\n\t{\"sha512\", sha512Reset, sha512Update, sha512Hex},\n\t{NULL, NULL, NULL, NULL}\n};\n\nint main(int argc, char* argv[])\n{\t\n\n\tif(argc == 3)\n\t{\n\t\tCallListNode* node = callList;\n\t\tfor(; node-\u003ekey != NULL; node++)\n\t\t{\n\t\t\tif(!strcmp(argv[1],node-\u003ekey) )\n\t\t\t{\n\t\t\t\tFILE* fp = fopen(argv[2], \"rb\");\n\t\t\t\tif(fp == NULL)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%s\\n\",strerror(errno));\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tchar state[sizeof(Sha512)];\n\t\t\t\tchar buffer[1024];\n\t\t\t\tsize_t len;\n\t\t\t\tnode-\u003einitFunc(state);\n\n\t\t\t\twhile((len = fread(buffer, 1, 1024, fp)) \u003e 0)\n\t\t\t\t{\n\t\t\t\t\tnode-\u003eupdateFunc(state, buffer, len);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfclose(fp);\n\t\t\t\tprintf(\"%s\\n\", node-\u003ehexFunc(state));\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\n\tprintf(\"Usage   : %s [md5|sha1|sha224|sha256|sha384|sha512] \u003cfile\u003e\\n\", filename(argv[0]));\n\tprintf(\"Example : %s md5 text.txt\\n\", filename(argv[0]));\n\tprintf(\"          %s sha256 text.txt\\n\", filename(argv[0]));\n\t\t\n\treturn 1;\n\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubenchang0515%2Fcryptography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubenchang0515%2Fcryptography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubenchang0515%2Fcryptography/lists"}