{"id":28247730,"url":"https://github.com/lcsig/fermat-rsa","last_synced_at":"2026-01-24T05:33:51.339Z","repository":{"id":177198427,"uuid":"462597598","full_name":"lcsig/Fermat-RSA","owner":"lcsig","description":"Ahmed S. Shatnawi, Mahmoud M. Almazari, Zakarea AlShara, Eyad Taqieddin, Dheya Mustafa, RSA cryptanalysis - Fermat factorization exact bound and the role of integer sequences in factorization problem, Journal of Information Security and Applications, Volume 78, 2023, 103614, ISSN 2214-2126, https://doi.org/10.1016/j.jisa.2023.103614","archived":false,"fork":false,"pushed_at":"2025-01-18T13:28:59.000Z","size":1721,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T05:34:09.173Z","etag":null,"topics":["fermat-factorization","integer-sequences","number-theory","oeis","paper","rsa","rsa-cryptography"],"latest_commit_sha":null,"homepage":"","language":null,"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/lcsig.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":"2022-02-23T05:42:32.000Z","updated_at":"2025-03-04T17:02:25.000Z","dependencies_parsed_at":"2023-07-11T02:04:05.507Z","dependency_job_id":null,"html_url":"https://github.com/lcsig/Fermat-RSA","commit_stats":null,"previous_names":["lcsig/fermat-rsa"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lcsig/Fermat-RSA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsig%2FFermat-RSA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsig%2FFermat-RSA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsig%2FFermat-RSA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsig%2FFermat-RSA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lcsig","download_url":"https://codeload.github.com/lcsig/Fermat-RSA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsig%2FFermat-RSA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28713402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T05:28:26.568Z","status":"ssl_error","status_checked_at":"2026-01-24T05:28:10.840Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["fermat-factorization","integer-sequences","number-theory","oeis","paper","rsa","rsa-cryptography"],"created_at":"2025-05-19T11:11:14.623Z","updated_at":"2026-01-24T05:33:51.333Z","avatar_url":"https://github.com/lcsig.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fermat-RSA\nCode For Fermat Factorization Research\n\n\n## The closest value to 4 * 1303 * 197 at each row \n\n![M1](./plot1.svg)\n\n```matlab\np = 1303; q =  197;\nfourN = 4 * p * q;\nlist_Floor = zeros(1, floor(sqrt(fourN)));\nlist_Ceil = zeros(1, floor(sqrt(fourN)));\nfor r=1:floor(sqrt(fourN))\n    c_Floor = floor((fourN - r^2) / (2 * r) + 1); \n    c_Ceil = ceil((fourN - r^2) / (2 * r) + 1);\n    list_Floor(r) =  (r^2 + 2 * r *(c_Floor - 1));\n    list_Ceil(r) = (r^2 + 2 * r *(c_Ceil - 1));\nend\nplot(1:floor(sqrt(fourN)), list_Floor, 1:floor(sqrt(fourN)), list_Ceil);\nxlabel(\"Row Values\"); xlim([1, floor(sqrt(fourN))])\nylabel(\"The Closest Number To 4*N\");\nlegend(\"Floor(c)\", \"Ceil(c)\");\n```\n\n\n## The closest value to 4 * 1303 * 197 after eliminating the odd rows and the even columns\n\n![M1](./plot2.svg)\n\n```matlab\np = 1303; q = 197;\nfourN = 4 * p * q;\n\nlistR = [];\nlistValFloor = [];\nlistValCeil = [];\nfor r=1:floor(sqrt(fourN))\n    c_Floor = floor((fourN - r^2) / (2 * r) + 1);\n    c_Ceil = ceil((fourN - r^2) / (2 * r) + 1);\n    if mod(r, 2) == 1 || mod(c_Floor, 2) == 0\n        continue;\n    end\n    listR = [listR, r];\n    listValFloor = [listValFloor,  (r^2 + 2*r*(c_Floor - 1))];\n    listValCeil = [listValCeil,  (r^2 + 2*r*(c_Ceil - 1))];\nend\n\nplot(listR, listValFloor, listR, listValCeil);\nxlabel(\"Row Values\"); xlim([1, floor(sqrt(fourN))]);\nylabel(\"The Closest Number To 4*N\");\nlegend(\"Floor(c)\", \"Ceil(c)\");\n```\n\n\n## The closest value to 4 * 1303 * 197  after eliminating the odd rows and the even columns. Also, the row which is not equal to 2 times a prime number is removed\n\n![M1](./plot3.svg)\n\n```matlab\np = 1303; q = 197;\nfourN = 4 * p * q;\n\nlistR = [];\nlistValFloor = [];\nlistValCeil = [];\nprimeList = primes(floor(sqrt(fourN)));\nfor r=1:floor(sqrt(fourN))\n    c_Floor = floor((fourN - r^2) / (2 * r) + 1);\n    c_Ceil = ceil((fourN - r^2) / (2 * r) + 1);\n    if mod(r, 2) == 1 || mod(c_Floor, 2) == 0\n        continue;\n    end\n    if ismember(r / 2, primeList) == 0\n        continue;\n    end\n    listR = [listR, r];\n    listValFloor = [listValFloor,  (r^2 + 2*r*(c_Floor - 1))];\n    listValCeil = [listValCeil,  (r^2 + 2*r*(c_Ceil - 1))];\nend\n\nplot(listR, listValFloor, listR, listValCeil);\nxlabel(\"Row Values\"); xlim([1, floor(sqrt(fourN))]);\nylabel(\"The Closest Number To 4*N\");\nlegend(\"Floor(c)\", \"Ceil(c)\");\n```\n\n\n## The closest value to 4 * 1303 * 197 by column prespective\n\n![M1](./plot4.svg)\n\n```matlab\np = 1303; q =  197;\nfourN = 4 * p * q;\nlist_Floor = zeros(1, floor((fourN - 1) / 2 + 1));\nlist_Ceil = zeros(1, floor((fourN - 1) / 2 + 1));\nfor c=1:floor((fourN - 1) / 2 + 1)\n    r_Floor = floor(sqrt( (c-1)^2 + fourN ) - c + 1); \n    r_Ceil = ceil(sqrt( (c-1)^2 + fourN ) - c + 1);\n    list_Floor(c) =  (r_Floor^2 + 2 * r_Floor *(c - 1));\n    list_Ceil(c) = (r_Ceil ^2 + 2 * r_Ceil *(c - 1));\nend\nplot(1:floor((fourN - 1) / 2 + 1), list_Floor, 'o', ...\n    1:floor((fourN - 1) / 2 + 1), list_Ceil, 'o');\nxlabel(\"Columns Values\"); xlim([1, floor((fourN - 1) / 2 + 1)])\nylabel(\"The Closest Number To 4*N\");\nlegend(\"Floor(r)\", \"Ceil(r)\");\n```\n\n\n## The closest value to 4 * 1303 * 197 by column prespective after eliminating the odd rows and the even columns \n\n![M1](./plot5.svg)\n\n```matlab\np = 1303; q =  197;\nfourN = 4 * p * q;\nlistC = [];\nlistValFloor = [];\nlistValCeil = [];\nfor c=1:floor((fourN - 1) / 2 + 1)\n    r_Floor = floor(sqrt( (c-1)^2 + fourN ) - c + 1); \n    r_Ceil = ceil(sqrt( (c-1)^2 + fourN ) - c + 1);\n    if mod(r_Floor, 2) == 1 || mod(c, 2) == 0\n        continue;\n    end\n    listC = [listC, c];\n    listValFloor = [listValFloor, (r_Floor^2 + 2 * r_Floor *(c - 1))];\n    listValCeil = [listValCeil, (r_Ceil ^2 + 2 * r_Ceil *(c - 1))];\nend\nplot(listC, listValFloor, 'o', ...\n    listC, listValCeil, 'o');\nxlabel(\"Columns Values\"); xlim([1, floor((fourN - 1) / 2 + 1)])\nylabel(\"The Closest Number To 4*N\");\nlegend(\"Floor(r)\", \"Ceil(r)\");\n```\n\n\n## Factoring in O(1)\n```java\nBigInteger ONE = BigInteger.valueOf(1);\nBigInteger FOUR = BigInteger.valueOf(4);\nString N = \"734465642310298504833940186303906456\";\nN = N + \"22848602022499768136179936493297372335479\";\nBigInteger n = new BigInteger(N);\nBigInteger fourN = n.multiply(FOUR);\nBigInteger ceilSqrt = fourN.sqrt().add(ONE);\n\n// By The Quadratic Formula\nBigInteger qBySol = ceilSqrt.subtract(ceilSqrt.pow(2).subtract(fourN).sqrt());\nqBySol = qBySol.divide(TWO);\nSystem.out.println(\"The Smallest Prime Factor Is: \" + qBySol);\n```\n\n\n## Buy me a Coffee: \nBTC: bc1q2kqvggm552h0csyr0awa2zepdapxdqnacw0z5w\n\n![BTC](https://raw.githubusercontent.com/lcsig/API-Hooking/refs/heads/master/img/btc.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcsig%2Ffermat-rsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flcsig%2Ffermat-rsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcsig%2Ffermat-rsa/lists"}