#lattice #sampling #integer #precision #integers

svp

Lattice sieving over the integers with arbitrary precision

2 unstable releases

Uses new Rust 2021

0.2.0 Oct 13, 2022
0.1.0 Oct 12, 2022

#681 in Cryptography

MIT and LGPL-3.0+

35KB
758 lines

SVP

Lattice sieving over the integers with arbitrary precision.

Includes the sampling algorithm described by [GPV08] and the Gauss Sieve described in [MV10].

Example

use svp::*;

// LLL/BKZ reduced basis
let mut b = vec![
    nvec![
        Integer::new(),
        Integer::new(),
        Integer::new(),
        Integer::from(-1),
        Integer::from(-1)
    ],
    nvec![
        Integer::from(-1),
        Integer::from(-2),
        Integer::from(-2),
        Integer::from(-1),
        Integer::from(1)
    ],
    nvec![
        Integer::from(3),
        Integer::new(),
        Integer::from(-1),
        Integer::from(-1),
        Integer::from(1)
    ],
    nvec![
        Integer::from(-1),
        Integer::from(3),
        Integer::from(-2),
        Integer::from(2),
        Integer::from(-2)
    ],
    nvec![
        Integer::from(2),
        Integer::from(-3),
        Integer::from(1),
        Integer::from(2),
        Integer::from(-2)
    ],
];

// Compute squared norms
for i in 0..b.len() {
    b[i].norm = Some(&b[i] * &b[i]);
}

// Init lattice
let l = Lattice { basis: b.clone() };

// Rejection sampling parameter
let t = Float::with_val(53, b.len()).ln();

// Init Gasuss Sieve
let mut gs = gsieve![l, t];

// Short vectors sorted in ascending order
let short_vecs = gs.sieve();

Dependencies

~2.5MB
~40K SLoC