At present, the evolution cryptanalysis methods mainly adopt the basic genetic algorithm (literature [1] and [2]) which has "early" phenomenon, searching stagnation in the near optimal solution, and low calculation efficiency. This paper inspired by biological genetic evolution proposes a niche genetic algorithm based on the code analysis method. This algorithm can keep the population diversity and prevent premature convergence. In genetic operator operation, this algorithm uses (µ + λ ) selection strategy which has the strongest selection pressure. In order to achieve compensating the shortage of groups diversity easy loss, improve the searching efficiency of algorithm, speed up the convergence speed, this algorithm applies the multi-point crossover operation, at the same time adopts variation operation by introducing evolution mutation probability. This paper chooses examples to demonstrate the replace cryptogram. Experiments show that the algorithm can effectively reduce the complexity of the problem analysis, reduce the redundant computation, speed up the convergence. Therefore, in the limited time, it can effectively get an optimal solution or suboptimal solution of the analysis object.