Opened 5 years ago
Closed 4 years ago
#17406 closed defect (fixed)
sage.crypto.gen_lattice: quotient parameter should accept polynomials
Reported by:  jdemeyer  Owned by:  

Priority:  minor  Milestone:  sage6.10 
Component:  cryptography  Keywords:  
Cc:  vbraun  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  Vincent Delecroix 
Report Upstream:  N/A  Work issues:  
Branch:  80df39c (Commits)  Commit:  80df39cb2daf7d1de65153b85492268568dfa85c 
Dependencies:  Stopgaps: 
Description
This works:
sage: var('x') x sage: sage.crypto.gen_lattice(type='ideal', seed=42, quotient=x^41) [11 0 0 0 0 0 0 0] [ 0 11 0 0 0 0 0 0] [ 0 0 11 0 0 0 0 0] [ 0 0 0 11 0 0 0 0] [ 4 2 3 3 1 0 0 0] [3 4 2 3 0 1 0 0] [3 3 4 2 0 0 1 0] [2 3 3 4 0 0 0 1]
But this should also work:
sage: R.<x> = ZZ[] sage: sage.crypto.gen_lattice(type='ideal', seed=42, quotient=x^41)  AttributeError Traceback (most recent call last) <ipythoninput11387441ec01a8> in <module>() > 1 sage.crypto.gen_lattice(type='ideal', seed=Integer(42), quotient=x**Integer(4)Integer(1)) /usr/local/src/sageconfig/local/lib/python2.7/sitepackages/sage/crypto/lattice.pyc in gen_lattice(type, n, m, q, seed, quotient, dual, ntl, lattice) 215 if quotient is None: raise \ 216 ValueError('ideal bases require a quotient polynomial') > 217 x = quotient.default_variable() 218 if n != quotient.degree(x): raise \ 219 ValueError('ideal bases require n = quotient.degree()') /usr/local/src/sageconfig/local/lib/python2.7/sitepackages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4074)() /usr/local/src/sageconfig/local/lib/python2.7/sitepackages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (build/cythonized/sage/structure/misc.c:1631)() AttributeError: 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' object has no attribute 'default_variable'
Change History (12)
comment:1 Changed 5 years ago by
 Branch set to u/jdemeyer/ticket/17406
 Created changed from 11/27/14 10:08:11 to 11/27/14 10:08:11
 Modified changed from 11/27/14 10:08:11 to 11/27/14 10:08:11
comment:2 Changed 5 years ago by
 Commit set to e72814e87e10a8a0cf652d2e5adead44fcc6db83
 Status changed from new to needs_review
comment:3 Changed 5 years ago by
 Branch changed from u/jdemeyer/ticket/17406 to public/ticket/17406
 Commit changed from e72814e87e10a8a0cf652d2e5adead44fcc6db83 to 9696d984d060eff5b30e608bf00d60e3675e0368
comment:4 followup: ↓ 5 Changed 5 years ago by
In the patch you add
assert P.base_ring() is ZZ_q
I was under the impression we are encouraged to avoid assert
unless it's really a bug in the program we are checking for.
comment:5 in reply to: ↑ 4 Changed 5 years ago by
Replying to malb:
I was under the impression we are encouraged to avoid
assert
unless it's really a bug in the program we are checking for.
Absolutely! You must only use assert
to check for bugs, not for bad user input.
comment:6 Changed 4 years ago by
 Status changed from needs_review to needs_work
Does not merge on 6.10.beta6
comment:7 Changed 4 years ago by
 Commit changed from 9696d984d060eff5b30e608bf00d60e3675e0368 to 80df39cb2daf7d1de65153b85492268568dfa85c
Branch pushed to git repo; I updated commit sha1. New commits:
80df39c  Merge tag '6.10.beta6' into t/17406/public/ticket/17406

comment:8 Changed 4 years ago by
 Status changed from needs_work to positive_review
comment:9 Changed 4 years ago by
 Status changed from positive_review to needs_review
comment:10 Changed 4 years ago by
 Cc vbraun added
Accidentally set to "positive review", let's hope Volker didn't merge it in this 11second window :)
comment:11 Changed 4 years ago by
 Milestone changed from sage6.5 to sage6.10
 Reviewers set to Vincent Delecroix
 Status changed from needs_review to positive_review
comment:12 Changed 4 years ago by
 Branch changed from public/ticket/17406 to 80df39cb2daf7d1de65153b85492268568dfa85c
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
Trac #17406: quotient parameter should accept polynomials