Skip to main content

BLASter: A proof of concept of an LLL-like lattice reduction algorithm with parallelization and segmentation

Project description

BLASter

BLASter is a proof of concept of an LLL-like lattice reduction algorithm that uses:

  • parallelization,
  • segmentation,
  • Seysen's reduction instead of size reduction, and
  • a linear algebra library.

Disclaimer

The goal of this software is to showcase speed ups that are possible in lattice reduction software. This software is a proof of concept!

In particular, we do not:

  • guarantee the algorithm terminates, nor claim its output is correct on all lattices,
  • support lattices with large entries,
  • consider issues / PRs that improve efficiency or robustness,
  • actively maintain this software.

We do:

  • happily answer any questions to explain design choices phrased as: "Why is X done in Y way?". The answer may, in many cases, be: "because it is faster in practice".
  • encourage the cryptographic community to build a new robust lattice reduction library incorporating the ideas in this proof of concept.

Requirements

  • python3 (3.10 or later)
  • Cython version 3.0 or later (installed automatically)
  • Python modules: cysignals numpy setuptools matplotlib (installed automatically)
  • Eigen3 headers (downloaded automatically during installation)
  • OpenMP library (for parallel processing)
    • Linux: Usually available by default with GCC
    • macOS: Install with brew install llvm libomp (recommended) or just brew install libomp for system clang
    • Windows: Included with MSVC

Optional:

  • Python module: virtualenv (for creating a local virtual environment to install python3 modules)
  • fplll (for generating q-ary lattices with the latticegen command)

Installation

Modern PEP 517 Installation (Recommended)

BLASter now supports modern Python packaging with automatic dependency management:

# Install from source (automatically downloads Eigen3)
pip install -e .

# Or build wheel for distribution
python -m build

macOS Setup (Optional)

For optimal performance on macOS, you can use Homebrew LLVM instead of system clang:

# Install Homebrew LLVM and OpenMP
brew install llvm libomp

# Set environment variables for compilation
export CC=$(brew --prefix llvm)/bin/clang
export CXX=$(brew --prefix llvm)/bin/clang++

# Then install BLASter
pip install -e .

Legacy Building

  • Optional: Run make eigen3 to install libeigen3 library in a subdirectory.
  • Optional: Run make venv to create a local virtual environment and install the required python3 modules.
  • Run make to compile all the Cython files in core/.

Debugging

  • Debug the C++/Cython code with the libasan and libubsan sanitizers by running make cython-gdb. These sanitizers check for memory leaks, out of bounds accesses, and undefined behaviour.
  • When executing the src/app.py, preload libasan like this: LD_PRELOAD=$(gcc -print-file-name=libasan.so) src/app.py -pvi INPUTFILE
  • If you want to run the program with the gdb debugger, read the Cython documentation, for more info.

Running

Note: you first need to build the software, see above.

Run the command by e.g. typing ./python3 src/app.py -pvi INPUTFILE. Add -h for seeing all available command line arguments.

Example

Command: time latticegen q 128 64 20 p | src/app.py -pq.

Expected output:

Profile: [9.38 9.39 9.30 9.28 9.18 ... 4.27 4.33 4.31 4.29 4.35]
Root Hermite factor: 1.020447, ∥b_1∥ = 11906.636

real	0m0,754s
user	0m2,271s
sys	0m0,105s

To run deep-LLL with depth 4, run src/app.py -pq -i {lattice} -d4.

To run progressive BKZ-60 (with 4-deep-LLL) with 1 tours and block size increments of 2, run src/app.py -pq -i {lattice} -b60 -t1 -P2.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blaster_python-0.1.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distributions

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

blaster_python-0.1.1-cp313-cp313-win_amd64.whl (156.4 kB view details)

Uploaded CPython 3.13Windows x86-64

blaster_python-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

blaster_python-0.1.1-cp313-cp313-macosx_15_0_arm64.whl (412.8 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

blaster_python-0.1.1-cp312-cp312-win_amd64.whl (156.7 kB view details)

Uploaded CPython 3.12Windows x86-64

blaster_python-0.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

blaster_python-0.1.1-cp312-cp312-macosx_15_0_arm64.whl (413.7 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

blaster_python-0.1.1-cp311-cp311-win_amd64.whl (157.3 kB view details)

Uploaded CPython 3.11Windows x86-64

blaster_python-0.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

blaster_python-0.1.1-cp311-cp311-macosx_15_0_arm64.whl (413.5 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file blaster_python-0.1.1.tar.gz.

File metadata

  • Download URL: blaster_python-0.1.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blaster_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7dd0151549ef6e4e7c93a6eb9c29808cec7ce7cb7ec8ba1196f9ecab936ef213
MD5 c4438c54424956577b301fbe97225f26
BLAKE2b-256 db54b12d97d393421f39e699d9f062a462492e5846e50ca2ff1b66f58557f99f

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f0c3091f5c6e50a8962a98d5f6351ed8e02eb0274962c39f7c254b0dc5bcc174
MD5 0efd6e45a820a63da55c6865869ffcb2
BLAKE2b-256 112ff5d36d670330a0e9476faaf489c91af8da169d32af1588eddb78dd3afbbf

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f96ddee501e9b1ccf3abca251eb4098f3190f5dc65cacef4eec7a7e0244eee55
MD5 2ab5e8fc0662033144043370f6de93a1
BLAKE2b-256 c2edabbeea9f3659938c7e442e04f87a9395c42f6606d9373371bc5be91a8fe7

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1f332b611eb2cfaba5af00f2ce90c42632f790b689c26b02dd478e4afa495fe8
MD5 ba931e482ae4675e4c953571f98cf2a4
BLAKE2b-256 138e0cf2648914b60a11edb32e9f0c4b923dd7ec67c57a6b70fbfa21488198d2

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0b82eb2bf2f2f4d6320d8d3137fb6d5707e757413e50e5bb1d76701168c41fb5
MD5 4b2c1b219fef557e9120bb03b04872b0
BLAKE2b-256 613e5ec92fa8b557bc43482d9538e6d4c5cbbdde552d19f9c482ab51aa2a3ae1

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca27eb7fcdc645ad46f0f9cc5bc3216000c1c3f6357262aafd0b361c570db26e
MD5 e40371b96f0bc9ee48bef62873b32b54
BLAKE2b-256 f96de9b68a2413e61cbe5af98cec9e92be968f1aae6c8d5ce0176f0a3ae30cac

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e1c6ef0cd1a1820759dc78773224ef8751b85d2e377ab13669b33cc3d3f88f87
MD5 ebff1c338cfac403a5aa21327f8bede1
BLAKE2b-256 bdd596d6b545de7f8a34c2d3e887dc0ea178d5321df1e5cc902e40671fc3ead5

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b03e202f4e5d51ba0d503e7efe428b6835d82335767aae3c44eff9b11f471ddf
MD5 acca1bbf03340adeac8f7cb76dbce17f
BLAKE2b-256 dc3fecc8848163a07cbfc09cc950439f2c407c88662396a15ce2c479051ee8c4

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a8ecd86a7b6eee18014d42e9c0ee942a08f55da47b60f04485b2efea9499773c
MD5 09ecab5963ddca6642b2a6aee43f8d16
BLAKE2b-256 8b7f40a6332521561cebca762b0898b5f7125201b3bfc3a8c6f6fbf3c67a3ed7

See more details on using hashes here.

File details

Details for the file blaster_python-0.1.1-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for blaster_python-0.1.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2651af65825a43e426f5bd549b409c4a7bde08aa01f4bd488ac4f9bdc1bee5fb
MD5 e2a19dff9e7323bbda54836be56290c3
BLAKE2b-256 49a80f1a86476e29ab1c872507f645936e140803e478ecb66cea6b72e7d0ad8f

See more details on using hashes here.

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