{"id":15550174,"url":"https://github.com/ggerganov/ggint","last_synced_at":"2026-03-09T17:44:13.853Z","repository":{"id":116327399,"uuid":"163311909","full_name":"ggerganov/ggint","owner":"ggerganov","description":"Poor man's big integer arithmetic operations","archived":false,"fork":false,"pushed_at":"2019-01-06T08:44:54.000Z","size":29,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-29T08:56:13.055Z","etag":null,"topics":["bignum","miller-rabin","primality-test","prime-numbers","safe-prime"],"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/ggerganov.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":"2018-12-27T15:50:04.000Z","updated_at":"2025-02-21T15:51:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"17681081-1236-4758-869a-58b1dd945676","html_url":"https://github.com/ggerganov/ggint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ggerganov/ggint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggerganov%2Fggint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggerganov%2Fggint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggerganov%2Fggint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggerganov%2Fggint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ggerganov","download_url":"https://codeload.github.com/ggerganov/ggint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggerganov%2Fggint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30305234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T17:35:44.120Z","status":"ssl_error","status_checked_at":"2026-03-09T17:35:43.707Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["bignum","miller-rabin","primality-test","prime-numbers","safe-prime"],"created_at":"2024-10-02T13:52:11.605Z","updated_at":"2026-03-09T17:44:13.821Z","avatar_url":"https://github.com/ggerganov.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ggint\nPoor man's long integer arithmetic operations.\n\n- Header-only\n- No 3rd party libraries\n\nNumbers are represented as array of bytes:\n\n`N = a[0] + a[1]*256 + a[2]*256^2 + a[3]*256^3 + ...`\n\nThe main goal was to learn how [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller–Rabin_primality_test)\nworks and try to generate some big prime numbers from scratch.  The code is not optimized and probably has bugs and most\nlikely this is not the correct way to implement efficient long integer arithmetic. Nevertheless, it manages to find\nrandom prime and [safe prime](https://en.wikipedia.org/wiki/Safe_prime) numbers in reasonable time (although much slower\nthan openssl):\n\n    $ ./find_prime 256\n\n        Usage: ./find_prime nbits\n        Generating small primes for fast sieve check\n        Max prime in sieve = 4093\n        Searching for 256-bit prime ...\n        .........\n        Found prime p:\n         -                p : 131 180  43 109 186 157  78  54 244  74  36  37  75 253  52 172 251  61  58 217 167  74 241 118  74  65  52   3 103 110 254 224\n                    Decimal : 101767619206415467646517001340499112030636580664836015053725702323129188856963\n\n    $  openssl prime 101767619206415467646517001340499112030636580664836015053725702323129188856963\n\n        101767619206415467646517001340499112030636580664836015053725702323129188856963 is prime\n\n    $ ./find_safe_prime 192\n\n        Usage: ./find_safe_prime nbits\n        Generating small primes for fast sieve check\n        Max prime in sieve = 4093\n        Searching for 192-bit safe prime ...\n        ......\n        Found safe prime p:\n         -                p :  67 150 125  76 190  74 243 119 255  95 250 199  86 185 239 251 115 251  15 193 148 232  55 211\n                    Decimal : 5179059918294645595326237229226656885717064063222063928899\n         -          (p-1)/2 :  33 203  62  38  95 165 249 187 255  47 253  99 171 220 247 253 185 253 135  96  74 244 155 105\n                    Decimal : 2589529959147322797663118614613328442858532031611031964449\n\n    $ openssl prime 5179059918294645595326237229226656885717064063222063928899\n\n        5179059918294645595326237229226656885717064063222063928899 is prime\n\n    $ openssl prime 2589529959147322797663118614613328442858532031611031964449\n\n        2589529959147322797663118614613328442858532031611031964449 is prime\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggerganov%2Fggint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fggerganov%2Fggint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggerganov%2Fggint/lists"}