A Python wrapper for the flatter LLL-reduction library.
Project description
Flatn - Python Wrapper for Flatter
Flatn is a Python wrapper around the execellent flatter lattice reduction library, providing a simple and convenient way to perform lattice reduction operations from Python code.
Lattice reduction is an important technique in computational number theory and cryptanalysis that transforms a given set of basis vectors into a "nicer" (shorter) basis for the same lattice. If you found this package, you probably know why you want to do this...
Installation
You can install Flatn using pip:
pip install flatn
Currently, only darwin/aarch64, linux/x86_64, and linux/arm64 are supported. No dependencies are required: all the flatter dependencies are statically linked into the binary.
Usage Example
The library provides two main functions:
reduce(): The main function for lattice reductionrun_flatter_raw(): Lowest-level function for debugging: simply calls theflatterbinary.
Here is a simple example:
import flatn
# define a lattice as a list of basis vectors
lattice = [
[1, 0, 331, 303],
[0, 1, 456, 225],
[0, 0, 628, 0],
[0, 0, 0, 628]
]
# derform lattice reduction
reduced_basis = flatn.reduce(lattice)
print(reduced_basis)
# output:
# [[-9, 1, -11, 10],
# [16, -2, -12, 2],
# [12, 23, 16, 19],
# [3, 35, -3, -8]]
# You can also control the reduction quality with parameters:
# - alpha: higher means more reduced
# - rhf: target root Hermite factor
# - delta: LLL parameter (between 0.25 and 1.0)
# - logcond: maximum allowed log of condition number
# For example, specifying delta:
reduced_basis = flatn.reduce(lattice, delta=0.99)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flatn-0.3.4-py3-none-manylinux1_x86_64.whl.
File metadata
- Download URL: flatn-0.3.4-py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 16.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232f79c6a42e3f35a6c370c7ce2b37deadcc453470627499b403954a40828464
|
|
| MD5 |
56d69f5c1865368708f470d56f8bc939
|
|
| BLAKE2b-256 |
fed4834cb43dde972b15bd0dee42fb1c340e7bb17cb6e57098da0474bb89bcf1
|
Provenance
The following attestation bundles were made for flatn-0.3.4-py3-none-manylinux1_x86_64.whl:
Publisher:
build.yaml on zksecurity/flatn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flatn-0.3.4-py3-none-manylinux1_x86_64.whl -
Subject digest:
232f79c6a42e3f35a6c370c7ce2b37deadcc453470627499b403954a40828464 - Sigstore transparency entry: 1009723773
- Sigstore integration time:
-
Permalink:
zksecurity/flatn@6d8ef80326e13d72c31305b69902a9775d8cb665 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/zksecurity
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yaml@6d8ef80326e13d72c31305b69902a9775d8cb665 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flatn-0.3.4-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: flatn-0.3.4-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 12.6 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64355a0dbf483edc211c73a82f4bb7e87db909c4ed01fd929c8d2327749f0d69
|
|
| MD5 |
43c12ff443f1aebc74da14ef90dbc749
|
|
| BLAKE2b-256 |
c3c03887223a4178ed07a7d12e35a75d21cfb2d28fa657f5eceeab8944e60f39
|
Provenance
The following attestation bundles were made for flatn-0.3.4-py3-none-macosx_11_0_arm64.whl:
Publisher:
build.yaml on zksecurity/flatn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flatn-0.3.4-py3-none-macosx_11_0_arm64.whl -
Subject digest:
64355a0dbf483edc211c73a82f4bb7e87db909c4ed01fd929c8d2327749f0d69 - Sigstore transparency entry: 1009723839
- Sigstore integration time:
-
Permalink:
zksecurity/flatn@6d8ef80326e13d72c31305b69902a9775d8cb665 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/zksecurity
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yaml@6d8ef80326e13d72c31305b69902a9775d8cb665 -
Trigger Event:
push
-
Statement type: