The slides of my Icebreak talk on Sage and algebraic techniques for (lazy) cryptographers are now available (LaTeX sources here).
Tag Archives: sage
BKW: Update
We have updated our pre-print titled “On the Complexity of the BKW Algorithm on LWE” on ePrint.
There are two main changes and the reasons why I am mentioning this update here.
- We included a more thorough comparison with other approaches, in particular, with lattice reduction (reducing LWE to SIS). To our surprise, BKW is quite competitive even in relatively modest dimensions. For Regev’s and Lindner-Peikert’s parameter sets (as interpreted here) we get that BKW is at least as fast as BKZ starting in dimension
, which I find very low (see Table 4 on page 19).
- We also provide an alternative approximating for the running time of BKZ. The standard estimate due to Lindner-Peikert is
where
is the targeted root hermit factor. Interpolating estimates from the BKZ 2.0 simulator and reflecting on the doubly exponential running time of BKZ in the blocksize
we found:
. However, since this might be controversial, we include estimates for both models.
Faugère-Lachartre implementation for linear algebra for Gröbner bases
Fayssal’s code which implements the Faugère-Lachartre approach to linear algebra for Gröbner bases is available on Github now. Fayssal did a Master’s project on linear algebra for Gröbner bases in the team of Jean-Charles Faugère.
A Generator for LWE and Ring-LWE Instances
We’re ready to announce our LWE/Ring-LWE generators for Sage:
We introduce software for the generation of instances of the LWE and Ring-LWE problems, allowing both the generation of generic instances and also particular instances closely-related to those arising from cryptomania proposals in the literature. Our goal is to allow researchers to attack different instances in order to assess the practical hardness of LWE and Ring-LWE. This will in turn give insight to the practical security of cryptographic systems based on both problems.
Sage and Lmonade Accepted for Google Summer of Code 2013
LPN and SVP
I am currently attending ESC 2013 in Mondorf, Luxembourg. Over dinner someone mentioned that there is no known reduction from LPN to lattice reduction, i.e., it is not known that you can solve LPN with LLL and friends. This seems rather strange to me, because the standard lattice attack on LWE seems to be carrying over as is:
n = 100 # number of variables m = 400 # number of samples A = random_matrix(GF(2), m, n) s = random_vector(GF(2), n) # our secret p = 0.25 # our error rate v = A*s + vector(GF(2),[1 if random() < p else 0 for _ in range(m)]) # we are searching for a short vector in the dual lattice B = A.kernel().matrix() L = B.change_ring(ZZ).LLL() # because a short vector there, means few additions which means a higher bias in the sum Av = A.augment(v) sum(map(lambda x: abs(x) % 2,L[0])), (L[0]*Av)[-1]
Of course, this means running lattice reduction many times, but still: what am I missing?
PS: Obligatory, Sage cell here.
Matrix Multiplication over GF(p^e)
After my talk at Sage Days 35 in Warwick (that was in winter 2011) David Harvey had an idea on how to speed up matrix multiplication over . We spend some time on this in Warwick and developed this idea further (adding fun stuff like Mixed Integer Programming in the process) but did not get around to do much on this project in the mean time (I have explained the idea at the end of my talk in Mykonos, though).
Just now, in a conversation with Richard Parker I was reminded of this dormant project, i.e., the question of how many multiplications i it takes to do a multiplication in
. In particular, I recalled to have written some code for Sage which gives some upper bound to this answer which is better than Karatsuba.
Well, here’s an interactive demo … gosh, I love the Sage cell server.
M4RI 20121224
I have just pushed the button to release M4RI 20121224. The main feature of this release is a considerable performance improvement. It all started with Fast matrix decomposition in F2 by Enrico Bertolazzi and Anna Rimoldi showing up on the arXiv. Here’s the abstract
In this work an efficient algorithm to perform a block decomposition (and so to compute the rank) of large dense rectangular matrices with entries in F2 is presented. Depending on the way the matrix is stored, the operations acting on rows or block of consecutive columns (stored as one integer) should be preferred. In this paper, an algorithm that completely avoids the column permutations is given. In particular, a block decomposition is presented and its running times are compared with the ones adopted into SAGE.
… and that comparison made M4RI (which realises this functionality in Sage) look pretty bad. I did’t (and still don’t) share the implicit assumption that avoiding column swaps was the key ingredient in making this code so much faster than ours. I assume the impressive timings are due to a very efficient base case implementation. Anyway, we sat down and looked for performance bottlenecks the result of which is 20121224. I actually have no idea whether we caught up to the code described in Enrico’s and Anna’s pre-print as they did not publish their sources.
Still, the performance improvements over 20120613 were worth the trouble. Below two plots of the (normalised) leading constants giving the leading constants for multiplication and elimination respectively (more plots on imgur) That is, it plots the running time divided by . In theory these plots should all have slope 0.

Multiplication on Intel Core i7

PLE on Intel Core i7
Finally, here’s the plot for Fast matrix decomposition in F2 which starts very small but has a rather large slope. That’s why I concluded that the performance stems from a very efficient base case. I should get in touch with Enrio and Anna about this.
BKW Complexity Estimations
Combining the code I wrote for our paper on BKW and the awesome, awesome Sage Single Cell server, here’s a complexity estimator for running BKW on LWE instances.
Linear Algebra for Gröbner Bases over GF(2): M4RI
Two days ago I wrote about LELA’s implementation of Gaussian elimination for Gröbner basis computations over . Yesterday, I implemented LELA’s algorithm (which is from Faugere & Lachartre paper) in M4RI. Continue reading
