script update + readme
This commit is contained in:
parent
477587aa68
commit
d858373b51
26
README.md
26
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 <path to input file>
|
||||||
|
```
|
||||||
|
|
||||||
|
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 of noise bits>] [--number <number of values to generate>]
|
||||||
|
```
|
||||||
|
|
||||||
|
the output can be directly written to a file
|
||||||
|
```
|
||||||
|
python gen_values.py [options] > input.txt
|
||||||
|
```
|
@ -4,9 +4,9 @@ import argparse
|
|||||||
|
|
||||||
def generate_test_file(noise_bits, number):
|
def generate_test_file(noise_bits, number):
|
||||||
|
|
||||||
p = random.randint(100, 1000)
|
p = random.randint(1000, 10000)
|
||||||
while p % 2 == 0:
|
while p % 2 == 0:
|
||||||
p = random.randint(100, 1000)
|
p = random.randint(1000, 10000)
|
||||||
|
|
||||||
max_noise = (1 << noise_bits) - 1 # 2^noise_bits - 1
|
max_noise = (1 << noise_bits) - 1 # 2^noise_bits - 1
|
||||||
|
|
||||||
|
@ -120,11 +120,11 @@ mod tests {
|
|||||||
int!(8),
|
int!(8),
|
||||||
int!(12),
|
int!(12),
|
||||||
int!(0),
|
int!(0),
|
||||||
int!(-5),
|
int!(5),
|
||||||
int!(0),
|
int!(0),
|
||||||
int!(0),
|
int!(0),
|
||||||
int!(0),
|
int!(0),
|
||||||
int!(-5),
|
int!(5),
|
||||||
];
|
];
|
||||||
|
|
||||||
let lattice = Matrix::new_lattice(noise_bits, ciphertexts).unwrap();
|
let lattice = Matrix::new_lattice(noise_bits, ciphertexts).unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user