fplll / fpylll

A Python interface for https://github.com/fplll/fplll
GNU General Public License v2.0
122 stars 62 forks source link

CVP.closest_vector returns a zero vector #131

Closed ZiqiangMa closed 5 years ago

ZiqiangMa commented 5 years ago

Hello, Firstly, thank you so much for your help. I choose the float_type of "dd", and the BKZ goes successfully.

But when I run the closest_vector funcition, i.e. the following code:

cvp_vector = CVP.closest_vector(A2, u_target)

it returns a zero vector.

Could you give me some suggestions? Should I need to compute the pruning parameters?

malb commented 5 years ago

Maybe it is the closest vector? Hard to tell from the information you've given.

ZiqiangMa commented 5 years ago

I don't think it is the closest vector. I refer to the tutorial of fpylll, and use Enumeration to implement the CVP. the code is:

M = GSO.Mat(copy(CVPlattice), float_type='dd')
M.update_gso()
E = Enumeration(M)
_, v1 = E.enumerate(0, A2.nrows, 2, 40, M.from_canonical(u_target))[0]
v1 = IntegerMatrix.from_iterable(1, A2.nrows, map(lambda x: int(round(x)), v1))
v1 = tuple((v1*A2)[0])

and the result is:

_End of BKZ: success Traceback (most recent call last):

File "", line 1, in runfile('/home/mzq/.config/spyder-py3/attack_ecdsa.py', wdir='/home/mzq/.config/spyder-py3')

File "/home/mzq/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 704, in runfile execfile(filename, namespace)

File "/home/mzq/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 108, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "/home/mzq/.config/spyder-py3/attackecdsa.py", line 258, in , v1 = E.enumerate(0, A2.nrows, 2, 40, M.from_canonical(u_target))[0]

File "src/fpylll/fplll/enumeration.pyx", line 385, in fpylll.fplll.enumeration.Enumeration.enumerate

EnumerationError: No solution found._

So what should be done to this case. Thank you very much.