{"id":22551101,"url":"https://github.com/michel-leonard/c-rho","last_synced_at":"2025-09-20T23:46:15.088Z","repository":{"id":112809948,"uuid":"479995000","full_name":"michel-leonard/C-RHO","owner":"michel-leonard","description":"The Pollard's Rho algorithm for 64/128 bits Integer Factorization in pure C.","archived":false,"fork":false,"pushed_at":"2025-02-07T23:14:37.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T10:11:45.696Z","etag":null,"topics":["128-bit","algorithm","c","cryptography","education","example","factorization","linux","math","pollard-rho-algorithm","simple","tool","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michel-leonard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-04-10T11:20:06.000Z","updated_at":"2025-02-07T23:14:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"c34a02fe-482d-42e7-9276-84bc6ca196a5","html_url":"https://github.com/michel-leonard/C-RHO","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michel-leonard/C-RHO","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2FC-RHO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2FC-RHO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2FC-RHO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2FC-RHO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michel-leonard","download_url":"https://codeload.github.com/michel-leonard/C-RHO/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2FC-RHO/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274581213,"owners_count":25311331,"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-11T02:00:13.660Z","response_time":74,"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":["128-bit","algorithm","c","cryptography","education","example","factorization","linux","math","pollard-rho-algorithm","simple","tool","windows"],"created_at":"2024-12-07T17:09:48.755Z","updated_at":"2025-09-20T23:46:15.050Z","avatar_url":"https://github.com/michel-leonard.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Factor integers in C\nBasic C99 **factorization** software. There is also a [Quadratic Sieve](https://github.com/michel-leonard/C-Quadratic-Sieve) for larger numbers.\n\nThis ~100 lines C software :\n* uses a **Miller–Rabin** primality test\n* uses a **Pollard's rho** algorithm\n\n# Example output\n\n```c\n  358205873110913227 =    380003149 * 942639223    took 0.01s\n  195482582293315223 =    242470939 * 806210357    took 0.0021s\n  107179818338278057 =    139812461 * 766597037    took 0.0023s\n   44636597321924407 =    182540669 * 244529603    took 0s\n  747503348409771887 =    865588487 * 863578201    took 0.016s\n\n// GCC 128-bit extension available output :\n170141183460469231731687303715506697937 =\n13602473 * 230287853 * 54315095311400476747373 took 0.137699s\n\n2139508543525359760856377898747 = 18122728927937 * 118056643236947131 took 17.2946s\n2080913777018885818418638213057 = 283954641807703 * 7328331608778919 took 40.8842s\n```\n\nfactor(n, array)\n------------\n\n**parameter 1:** *positive_number* N\\\n**parameter 2:** *positive_number\\** array\n\nFill the second parameter array with the prime factors of N.\n\n```c\n// 64-bit source code is here.\n\n#include \u003cstdio.h\u003e\n\nint main(void) {\n    // allocate memory for 64 factors.\n    positive_number *array = calloc(64, sizeof(positive_number));\n\n    positive_number n = 7806418495977353572 ;\n\n    size_t n_factors = factor(n, array) - array ;\n    printf(\"There are %zu factors of %llu : \\n\", n_factors, n);\n    for(int i = 0; array[i]; ++i)\n        printf(\"- %llu\\n\", array[i]);\n    free(array);\n}\n```\nSo you displayed the factors of `n` :\n```\nThere are 4 factors of 7806418495977353572 : \n- 2\n- 2\n- 120317621\n- 16220438933\n```\nCompilation\n--\nThe software should be executable on many platforms like Windows, Debian, Ubuntu, Linux, ...\\\nYou can rename `main-64-bits.c` or `main-128-bits.c` to `primes.c` then compile + execute :\n```sh\ngcc -O3 -std=c99 -Wall -pedantic primes.c ;\n./a.out ;\n```\nYou can normally [try it online](https://tio.run/##rVlbc6M6En7Pr9DJVmZMbCdICBDLJFP7A/Zla9@yUy6McUyNDSnAkzOX/PbZlsD050tqz8O6ZmxF6m715etuIfL5c57//v23ssq3@1UhPrXdalsu7zaPVzjXlNWznbvqvr8Uq2ItFot9WXVSmUUnXuq27MpvxaLa75ZFk15dtV3Wlfnpgtjtt135si1zWq2rxa5e7bf15JQqm50xLmcir6u2O5dYrzzx80rQ53SpKVrxIPyZ6HYvqaNY142YLMXNg2VLRUb/xAchxWexFI9uUswd22f3Pe@n/m5l2L@nD0Tn/srEI9HLmZiQbNpk6TH/krjtLHIvLS9Ner0eTdHtm8rJvHGqXL2NLiOnirJdvDTlrjjzTDVz61/fMznrDbbemonVTBQzsZ6J59RxbYi5379ci8mkEg9kgme/aUxu8LyDYm5JMW0lPgkdRUmiiP7@XqwzioSLR/HnS@Pc2u6y7VY4rVvyyqZsxbasCjKFh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kB2SS5Z2nhUp7u6zLGlqXfYciYGf8yHoKRn5Ltil798n/TLU9EOLDOSc/tecfYuyBkEPBDfdPQtfk7c14PMOfHcBmvl@P6BXK@N5@78hzgSjv5J6Cma@b@yZVkRetquvTuT8j9DeBTKnxf5s9Gbh8JV9f3naFLkWfWxs2jOM9Jr1YM/6@F/WbHeX2OoskOo0ovUBAhCyPna29Xlv3rPniPS9uxq6NngGjVzOOUMH5K/gt53e9DYF0dV4AAsKgVH7@/K@vj1Xda2RdO513fkvpem/lauyFNWLeoFVDfKosqpuHbZ14Jc17/to5q6Gjeyj8bzZdmJfdWWzxUxl1VXPNv2jy8C1029W/TsCztDHO3QbuyJQtzS2iFxkG94VXd0erG06bBiv2@F9AnfdpocNxcf/Y9nr9MOVXE0sastEKruXf0Ju8OLt17Brj7THxWlLBjbJLC1T9r/kp6Ztcvar66LpkeNtX9BJ1wbWg1LXWNLAZWAa/8aT3FOhH2VaH/vhUrdqP8eYHN6wnOljBQlrFkqzzYlv@/j1HmW6Wnlsp1xMmmf5vPll8GvtrOS4Okp7tunpT0MXvtSBZoekE1y/bRy91Jfjgkz1/vvaeFSix0inKXC9U6qg7v6WzGx5YtcQk7I6SBx257ulPU72WJNKSl978L5p4eAjfguK6vJt7oc3w8TLqhC1NTTC7tl3Xx3ikT60CTvLnauMflyxz2J9Ozd4pxeXRRha9/F1LhO/sJHJte26iOEqsWhr49VrHqn4Tj4ryfX/7bnJ1qhw8aPPR4Lblo6lvynup6xVKoE52lQwVPJxL2l7p8k3GZP5RcbzJKb@GHfOW3gpF8QeWAdJTdFMTnU4rer37//Cw) with [DigitalOcean](https://www.digitalocean.com/) 128-bits, Thank You.\n\nShortest link to this page : [bit.ly/C-RHO](http://bit.ly/C-RHO)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichel-leonard%2Fc-rho","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichel-leonard%2Fc-rho","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichel-leonard%2Fc-rho/lists"}