Skip to main content

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 reduction
  • run_flatter_raw(): Lowest-level function for debugging: simply calls the flatter binary.

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

flatn-0.3.4-py3-none-manylinux1_x86_64.whl (16.8 MB view details)

Uploaded Python 3

flatn-0.3.4-py3-none-macosx_11_0_arm64.whl (12.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file flatn-0.3.4-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flatn-0.3.4-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 232f79c6a42e3f35a6c370c7ce2b37deadcc453470627499b403954a40828464
MD5 56d69f5c1865368708f470d56f8bc939
BLAKE2b-256 fed4834cb43dde972b15bd0dee42fb1c340e7bb17cb6e57098da0474bb89bcf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for flatn-0.3.4-py3-none-manylinux1_x86_64.whl:

Publisher: build.yaml on zksecurity/flatn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for flatn-0.3.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 64355a0dbf483edc211c73a82f4bb7e87db909c4ed01fd929c8d2327749f0d69
MD5 43c12ff443f1aebc74da14ef90dbc749
BLAKE2b-256 c3c03887223a4178ed07a7d12e35a75d21cfb2d28fa657f5eceeab8944e60f39

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page