Crates.io | svp |
lib.rs | svp |
version | 0.2.0 |
source | src |
created_at | 2022-10-12 13:46:49.378527 |
updated_at | 2022-10-13 03:24:47.281127 |
description | Lattice sieving over the integers with arbitrary precision. |
homepage | |
repository | https://github.com/tacotaha/svp |
max_upload_size | |
id | 686322 |
size | 127,808 |
Lattice sieving over the integers with arbitrary precision.
Includes the sampling algorithm described by [GPV08] and the Gauss Sieve described in [MV10].
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();