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.5-py3-none-manylinux1_x86_64.whl (16.8 MB view details)

Uploaded Python 3

flatn-0.3.5-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.5-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for flatn-0.3.5-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 61c1da06a51342d3e42fa83185b7459be2a885c696d377acecd70a1a5f9ad380
MD5 2afe0f3ae1230c303a73f6ffd6565d75
BLAKE2b-256 b0c5d0a76fc673f0b1e02a23322350a61e8ee09e5daf2022bd3fc6da729b46cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for flatn-0.3.5-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.5-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: flatn-0.3.5-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.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94a708322883a37db3f50599813b08f70143fb25c67c46627d5833b5fdfc350c
MD5 818f945e0776a7b7eb4883e1f45a83e6
BLAKE2b-256 11b8b1da779e3880bc8ebbf8d12ea43eb0f1610cec026209c5b4b09f86221e4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for flatn-0.3.5-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