Template attack is divided into two stages:template description and key recovery.For AES-128 algorithm
when the attacker only got 1000 energy traces
he would face two problems:one was that the template description would not be applicable
the other was that the correct key would not be recovered.To solve these problems
this paper constructed 9 templates for Hamming weight of S-box output value in the template description stage
and used 600 energy traces provided by panda 2018 data set to build the model;in the key recovery stage
this paper proposed the method of key advantage superposition
which only needed about 10 energy traces encrypted to distinguish the correct key.This method reduces the number of energy traces required in the template description stage and key recovery stage