main
Description of main.py-module. This is the main entry point to the application.
Usage:
usage: main.py [-h] [--lattice_dimension LATTICE_DIMENSION] [--entry_bound ENTRY_BOUND] [--bkz_version {1,2,3}] [--svp_solver {1,2,3}] [--block_size BLOCK_SIZE] [--precision PRECISION]
[--repetitions REPETITIONS]
Run lattice reduction algorithms.
options:
-h, --help show this help message and exit
--lattice_dimension LATTICE_DIMENSION
Desired lattice dimension. (default: 10)
--entry_bound ENTRY_BOUND
Bound for basis entry values (default: 73)
--bkz_version {1,2,3}
Specify the version of bkz implementation: 1: bkz_se, 2: bkz_se_bfp_track, 3: bkz_se_sum_track (default: 1)
--svp_solver {1,2,3} Specify the svp_solver utilized during bkz execution: 1: enum_se_og_solver, 2: enum_se_solver, 3: enum_sh_solver (default: 1)
--block_size BLOCK_SIZE
Desired block size for bkz. (default: 5)
--precision PRECISION
Precision of floating point arithmetic: high, default, low. (default: default)
--repetitions REPETITIONS
Number of random bases to operate on. (default: 5)
positive_integer(value)
Helper function to check if given integer is positive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
Integer to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if value is positive, otherwise False. |
run_bkz(basis, block_size, bkz_version, svp_solver)
Executes a BKZ (Block Korkine–Zolotarev) reduction on a given lattice basis. This function serves as a unified entry point for invoking one of the
available BKZ variants registered in BKZ_ALGORITHMS. The selected BKZ
routine will repeatedly call the provided SVP solver on local blocks,
update the basis, and maintain Gram–Schmidt data as required by the
algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
ndarray
|
A 2D NumPy array of shape (n, n) representing a lattice basis, where each column is a basis vector. |
required |
block_size
|
int
|
An integer specifying the block size in the BKZ algorithm, which determines the dimension of sublattice for the SVP solver calls. |
required |
bkz_version
|
str
|
A string key selecting the BKZ algorithm variant from |
required |
svp_solver
|
str
|
A string key referring to an entry in |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bkz_reduced_basis |
ndarray
|
A 2D NumPy array of shape (n, n) representing the BKZ-reduced lattice basis, where each column is a basis vector. |
run_lll(basis)
Calls the LLL-reduction algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
ndarray
|
A 2D NumPy array of shape (n, n) representing a lattice basis, where each column is a basis vector. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
lll_reduced_basis |
ndarray
|
A 2D NumPy array of shape (n, n) representing a LLL-reduced lattice basis, where each column is a basis vector. |