Abstract:The algorithm of extracting quadratic expressions in the pre-processing phase of cube attack with quadratic test was enhanced to optimize the attack efficiency. The variation of secret keys was introduced into cube attack, which makes the model much more flexible. At the same time, with the help of the trade-off between time and space, the complexity of extracting quadratic terms was reduced by storing the results of the constant and linear terms. The improved method was applied to the simplified PRESENT and Trivium algorithms and it turns out that the attack efficiency is enhanced obviously.