{"id":26693831,"url":"https://github.com/satoshin-des/pythonlatticelibrary","last_synced_at":"2026-05-16T13:04:28.830Z","repository":{"id":251205887,"uuid":"824380446","full_name":"satoshin-des/PythonLatticeLibrary","owner":"satoshin-des","description":"Python Lattice Library","archived":false,"fork":false,"pushed_at":"2024-08-02T05:13:58.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T04:27:21.343Z","etag":null,"topics":["lattice","lattice-based-crypto","lattice-based-cryptography","lattice-basis-reduction","lattice-reduction","lll-reduction","numpy","python","python-library","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/satoshin-des.png","metadata":{"files":{"readme":"README-ja.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":"2024-07-05T02:36:23.000Z","updated_at":"2025-02-15T14:38:49.000Z","dependencies_parsed_at":"2025-03-26T18:43:47.362Z","dependency_job_id":null,"html_url":"https://github.com/satoshin-des/PythonLatticeLibrary","commit_stats":null,"previous_names":["satoshin-des/pythonlatticelibrary"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/satoshin-des/PythonLatticeLibrary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin-des%2FPythonLatticeLibrary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin-des%2FPythonLatticeLibrary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin-des%2FPythonLatticeLibrary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin-des%2FPythonLatticeLibrary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satoshin-des","download_url":"https://codeload.github.com/satoshin-des/PythonLatticeLibrary/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin-des%2FPythonLatticeLibrary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33103971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"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":["lattice","lattice-based-crypto","lattice-based-cryptography","lattice-basis-reduction","lattice-reduction","lll-reduction","numpy","python","python-library","python3"],"created_at":"2025-03-26T18:27:25.430Z","updated_at":"2026-05-16T13:04:28.802Z","avatar_url":"https://github.com/satoshin-des.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Lattice Library(abbr. PLL)\nこのPythonライブラリの中には主に格子基底簡約，最短ベクトル問題(SVP)や最近ベクトル問題(CVP)の求解，そして格子に関する演算などが備わっています．\n\n## 使い方\n### 初期化\nもし```A = numpy.array([[123, 0, 0], [234, 1, 0], [345, 0, 1]])``` を格子基底行列として使いたい場合には以下の様にします：\n\n```Python\nimport PythonLatticeLibrary as PLL\nimport numpy as np\n\nA = np.array([[123, 0, 0], [234, 1, 0], [345, 0, 1]])\nb = PLL.lattice(A)\nb.print()\n```\n出力は以下：\n\n```\nBasis =\n[[123   0   0]\n [234   1   0]\n [345   0   1]]\nRank = 3\nVolume = 122.99999999999994\n```\n\n``numpy.array``だけではなく，``list``でもできます:\n\n```Python\nimport PythonLatticeLibrary as PLL\nimport numpy as np\n\nA = [[123, 0, 0], [234, 1, 0], [345, 0, 1]]\nb = PLL.lattice(A)\nb.print()\n```\n出力は以下：\n\n```\nBasis =\n[[123   0   0]\n [234   1   0]\n [345   0   1]]\nRank = 3\nVolume = 122.99999999999994\n```\n\n乱数的に格子基底を生成することもできます：\n\n```Python\nimport PythonLatticeLibrary as PLL\n\nb = PLL.random_lattice(5) # Generates 5-dimensional lattice basis.\nb.print()\n```\n\n出力は以下：\n\n```\nBasis =\n[[875   0   0   0   0]\n [932   1   0   0   0]\n [951   0   1   0   0]\n [801   0   0   1   0]\n [754   0   0   0   1]]\nRank = 5\nVolume = 875.0000000044823\n```\n\n格子基底簡約(e.g. LLL簡約, DeepLLL簡約, etc.)をしたいときは，以下の様にしてできます：\n\n```Python\nimport PythonLatticeLibrary as PLL\n\nb = PLL.random_lattice(5)\nb.print()\nb.basis = b.LLL() # LLL-reduction\nb.print()\n```\n\n出力は以下：\n\n```\nBasis =\n[[711   0   0   0   0]\n [940   1   0   0   0]\n [500   0   1   0   0]\n [592   0   0   1   0]\n [555   0   0   0   1]]\nRank = 5\nVolume = 710.9999999597205\nBasis =\n[[ 0  1  2  1 -2]\n [-1  2  2 -1  1]\n [ 1 -3  2  0  2]\n [ 0  2 -1  3  2]\n [-4 -1  1  1  1]]\nRank = 5\nVolume = 710.9999999999999\n```\n\n簡約パラメタを指定するときは以下の様にできます．\n\n```Python\nimport PythonLatticeLibrary as PLL\n\nb = PLL.random_lattice(5)\nb.print()\nb.basis = b.LLL(delta=0.5) # 0.5-LLL簡約\nb.print()\n```\n\n出力は以下：\n\n```\nBasis =\n[[814   0   0   0   0]\n [659   1   0   0   0]\n [723   0   1   0   0]\n [912   0   0   1   0]\n [781   0   0   0   1]]\nRank = 5\nVolume = 813.9999999534335\nBasis =\n[[ 1  1 -1  1  1]\n [-2 -1  1  0  2]\n [ 2 -4  0  2  0]\n [-2 -2 -3  2 -1]\n [-1  2  2  4 -3]]\nRank = 5\nVolume = 813.9999999999997\n```\n\nLLL簡約以外の簡約も，LLLと同じような感じでできます．以下は一例：\n\n```Python\nimport PythonLatticeLibrary as PLL\n\nb = PLL.random_lattice(5)\nb.print()\nb.basis = b.DeepLLL() # DeepLLL簡約\nb.print()\n```\n\n出力は以下：\n\n```\nBasis =\n[[726   0   0   0   0]\n [952   1   0   0   0]\n [676   0   1   0   0]\n [655   0   0   1   0]\n [900   0   0   0   1]]\nRank = 5\nVolume = 726.0000000397084\nBasis =\n[[-2 -1 -1  0  1]\n [ 1 -1  1  1  2]\n [ 0 -2  2  0 -1]\n [-3  3  4 -1  1]\n [ 0 -1 -2  6 -1]]\nRank = 5\nVolume = 725.9999999999999\n```\n\n最短ベクトルを求めるときは``ENUM_SVP()``でできます：\n\n```Python\nimport PythonLatticeLibrary as PLL\n\nb = PLL.random_lattice(7)\nb.print()\nb.basis = b.LLL() # LLL-reduction\nv = b.ENUM_SVP()\nprint(v)\n```\n\n出力は以下：\n\n```\nBasis =\n[[924   0   0   0   0   0   0]\n [719   1   0   0   0   0   0]\n [552   0   1   0   0   0   0]\n [723   0   0   1   0   0   0]\n [608   0   0   0   1   0   0]\n [834   0   0   0   0   1   0]\n [995   0   0   0   0   0   1]]\nRank = 7\nVolume = 924.000000001688\n[ 0 -1  0 -1  1  1  0]\n```\n\ntを目標ベクトルとする最近ベクトルを求めるときも，最短ベクトルと同様に``ENUM_CVP(t)``でできます：\n\n```Python\nimport PythonLatticeLibrary as PLL\nimport numpy as np\n\nb = PLL.random_lattice(7)\nt = np.random.randint(1, 20, size=7)\nb.print()\nprint(t)\nb.basis = b.LLL() # LLL-reduction\nv = b.ENUM_CVP(t)\nprint(v)\n```\n\n出力は以下：\n\n```\nBasis =\n[[885   0   0   0   0   0   0]\n [799   1   0   0   0   0   0]\n [566   0   1   0   0   0   0]\n [766   0   0   1   0   0   0]\n [650   0   0   0   1   0   0]\n [654   0   0   0   0   1   0]\n [541   0   0   0   0   0   1]]\nRank = 7\nVolume = 884.9999999999998\n[18  1  4 17 18  9 15]\n[17  2  5 17 18  8 15]\n```\n\n## 使える関数\n使える関数は以下（ただし以下の表は使える関数の一覧ではなくいくつか主要な函数を抜萃したに過ぎないことには注意されたい）：\n- ```vol()```: 格子の体積を求める．\n- ```GSO()```: GS0情報を求める．\n- ```potential()```: 格子基底のpotentialを求める．\n- ```size()```: サイズ基底簡約．\n- ```Gauss()```: Gauss簡約．\n- ```LLL(delta)```: delta-LLL簡約．\n- ```DeepLLL(delta)```: delta-DeepLLL簡約．\n- ```ENUM_SVP()```: 最短ベクトルを数え上げ法で求める．\n- ````Babai(t)````: tを目標ベクトルとする近似最近ベクトルをBabaiの最近平面法で求める．\n- ```ENUM_CVP(t)```: tを目標ベクトルとする最近ベクトルを数え上げ法で求める．","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatoshin-des%2Fpythonlatticelibrary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatoshin-des%2Fpythonlatticelibrary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatoshin-des%2Fpythonlatticelibrary/lists"}