{"id":17685876,"url":"https://github.com/sepandhaghighi/integer-squaring","last_synced_at":"2025-10-15T01:35:59.524Z","repository":{"id":66134948,"uuid":"115154604","full_name":"sepandhaghighi/Integer-Squaring","owner":"sepandhaghighi","description":"Integer Squaring Algorithm","archived":false,"fork":false,"pushed_at":"2018-01-01T17:08:56.000Z","size":1864,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T20:29:55.299Z","etag":null,"topics":["algorithm","cryptographic","cryptography","integer-arithmetic","integer-squaring","multiplication","product-scanning","squaring"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/sepandhaghighi.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":"2017-12-22T22:31:56.000Z","updated_at":"2018-07-16T20:24:17.000Z","dependencies_parsed_at":"2023-03-13T20:30:46.844Z","dependency_job_id":null,"html_url":"https://github.com/sepandhaghighi/Integer-Squaring","commit_stats":{"total_commits":33,"total_committers":1,"mean_commits":33.0,"dds":0.0,"last_synced_commit":"4ba8867906bbed645bbbb1bf6e6baaa456df8bd9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sepandhaghighi/Integer-Squaring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepandhaghighi%2FInteger-Squaring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepandhaghighi%2FInteger-Squaring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepandhaghighi%2FInteger-Squaring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepandhaghighi%2FInteger-Squaring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sepandhaghighi","download_url":"https://codeload.github.com/sepandhaghighi/Integer-Squaring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepandhaghighi%2FInteger-Squaring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279033061,"owners_count":26089392,"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-10-14T02:00:06.444Z","response_time":60,"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":["algorithm","cryptographic","cryptography","integer-arithmetic","integer-squaring","multiplication","product-scanning","squaring"],"created_at":"2024-10-24T10:29:22.075Z","updated_at":"2025-10-15T01:35:59.494Z","avatar_url":"https://github.com/sepandhaghighi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integer Squaring \u0026 Integer Multiplication (by product scanning) Algorithm #\n\n### Sepand Haghighi \u0026 Mohammad Abassi\n\n### Cryptographic Engineering Course Seminar At [Sharif University Of Technology](http://www.sharif.ir/ \"Sharif University Of Technology\") (Winter 2017)\n### Instructor : [Dr.Siavash Bayat-Sarmadi](http://sharif.edu/~sbayat/ \"http://sharif.edu/~sbayat/\")\n### Book : Cryptographic Engineering (Serdar S¨ uer Erdem, Tuˇ grul Yanık, and C ¸ etin Kaya Koc)\t \n[![Build Status](https://travis-ci.org/sepandhaghighi/Integer-Squaring.svg?branch=master)](https://travis-ci.org/sepandhaghighi/Integer-Squaring)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0f5fc6d4f3e84a06b004a716dc1ece6e)](https://www.codacy.com/app/sepand-haghighi/Integer-Squaring?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=sepandhaghighi/Integer-Squaring\u0026amp;utm_campaign=Badge_Grade)\n\n[Download Slides](files/Slides.pdf \"Slides\") (Format : PDF, Size : 1.1 MB)\n\n----------\n# Integer Multiplication\n\t\t\t\t\t\t\t\n### Chapter : 5\t\t\t\t\t\n\t\t\t\t\n### Page : 79\t\t\t\t\n\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"files/algorithm2.png\"\u003e\n\u003cp\u003eFig1.Algorithm-2 Pseudocode\u003c/p\u003e\n\u003cimg src=\"files/example3.png\"\u003e\n\u003cp\u003eFig2.Algorithm-2 Example\u003c/p\u003e\n\n\u003c/div\u003e \n\n```\n\u003e\u003e\u003e IntegerMultiplication(\"1 1\",\"1 1\",Base=2)\n\u003e\u003e\u003e 1 0 0 1 \n```\nComplexity : `3` additions, `2` data read (Inner Loop)\n\n\n\n# Integer Squaring\n### Book : Cryptographic Engineering (Serdar S¨ uer Erdem, Tuˇ grul Yanık, and C ¸ etin Kaya Koc)\t\t\t\t\n\t\t\t\t\n### Chapter : 5\t\t\t\t\t\n\t\t\t\t\n### Page : 80\t\t\t\t\n\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"files/algorithm3.png\"\u003e\n\u003cp\u003eFig3.Algorithm-3 Pseudocode\u003c/p\u003e\n\u003cimg src=\"files/example1.png\"\u003e\n\u003cp\u003eFig4.Algorithm-3 Example\u003c/p\u003e\n\u003c/div\u003e\n\n* It seems this algorithm is wrong and `(U,H,L)` should be set to zero after each iteration and add shifted `(U,H,L)` outside of the loop (modified in code)\n\t\t\t\t\t\t\t\t\t\n```\n\u003e\u003e\u003e IntegerSquaring(\"1 1\",\"1 1\",Base=2)\n\u003e\u003e\u003e 1 1 0 1 \n```\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"files/algorithm3_modified.png\"\u003e\n\u003cp\u003eFig5.Algorithm-3(Modified) Pseudocode\u003c/p\u003e\n\u003cimg src=\"files/example2.png\"\u003e\n\u003cp\u003eFig6.Algorithm-3(Modified) Example\u003c/p\u003e\n\n\n\u003c/div\u003e \n\n```\n\u003e\u003e\u003e IntegerSquaringModified(\"1 1\",Base=2)\n\u003e\u003e\u003e 1 0 0 1 \n```\nComplexity : `3` additions, `2` data read (Inner Loop)\n\n# Run\n\n1. Run `main.py` for automatic doctest --\u003e `python main.py` or `python3 main.py`\n2. Import `IntegerSquaring` and `IntegerMultiplication` and `IntegerSquaringModified` from `main.py` :\n```\n\u003e\u003e\u003e from main import IntegerSquaring,IntegerMultiplication,IntegerSquaringModified\n\u003e\u003e\u003e IntegerSquaring(\"1 6\",Base=10)\n'3 8 6'\n\u003e\u003e\u003e IntegerSquaringModified(\"1 6\",Base=10)\n'2 5 6'\n\u003e\u003e\u003e IntegerMultiplication(\"1 6\",\"1 6\",Base=10)\n'2 5 6'\n```\n\n* Enter digits with one space, for example : `\"31 12\"` in base `32`\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://asciinema.org/a/155064\" target=\"_blank\"\u003e\u003cimg src=\"https://asciinema.org/a/155064.png\" /\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepandhaghighi%2Finteger-squaring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsepandhaghighi%2Finteger-squaring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepandhaghighi%2Finteger-squaring/lists"}