diff --git a/README.md b/README.md index e69de29..5993c28 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,26 @@ +Rust implementation for the approximate greatest common divisor (AGCD) problem using LLL algorithm. + +## commands + +*use the provided Makefile to compile the release version* + +``` +approximate-gcd agcd +``` + +Input file must have the following format: ++ first non-comment line: number of noise bits (written in decimal) ++ all the other lines, one per line: the numbers Xi (written in decimal) to find the approximate GCD of ++ ```//``` can be used to comment a line, MUST be used at the begining of a new line and not at the end of a line containing a number + +### generating values +The script gen_values can be used to generate test values + +``` +python gen_values.py [--noise-bits ] [--number ] +``` + +the output can be directly written to a file +``` +python gen_values.py [options] > input.txt +``` diff --git a/gen_values.py b/gen_values.py index f73c9a2..1fa4602 100644 --- a/gen_values.py +++ b/gen_values.py @@ -4,9 +4,9 @@ import argparse def generate_test_file(noise_bits, number): - p = random.randint(100, 1000) + p = random.randint(1000, 10000) while p % 2 == 0: - p = random.randint(100, 1000) + p = random.randint(1000, 10000) max_noise = (1 << noise_bits) - 1 # 2^noise_bits - 1 diff --git a/src/matrix.rs b/src/matrix.rs index 7b4224f..91b207a 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -120,11 +120,11 @@ mod tests { int!(8), int!(12), int!(0), - int!(-5), + int!(5), int!(0), int!(0), int!(0), - int!(-5), + int!(5), ]; let lattice = Matrix::new_lattice(noise_bits, ciphertexts).unwrap();