The invention discloses a block chain anti-
quantum hash calculation method and
system based on modulo 30 shrinkage residual coefficient prime numbers, and belongs to the technical field of block chain security. The method comprises the steps of obtaining to-be-processed block chain data; constructing a prime number replacement function P30 and a modulo 30
confusion function M30 based on a modulo 30 simplified residual
system Z30 * = {1, 7, 11, 13, 17, 19, 23, 29}, and performing modulo 30 congruence replacement on a special number 1 in Z30 by adopting a prime number 31 to form a modulo 30 congruence prime number set of Z30; the method comprises the following steps: embedding an M30 function into a core compression
round function of an SHA256
algorithm, and constructing an improved Hash
algorithm Mod30SHA256; and performing hash operation on the block chain data by using a Mod30SHA256
algorithm to generate a 256-bit hash value, and writing the 256-bit hash value into the block chain. According to the method, a number-theory
confusion layer of a modular 30 shrinkage residual
system is introduced, and a
double diffusion mechanism of number-theory
confusion and bit operation confusion is constructed, so that the
quantum attack resistance of the Hash algorithm is effectively improved, the operation efficiency basically equivalent to that of SHA256 is kept, the method is seamlessly compatible with an existing block chain architecture, a core structure and a
consensus mechanism of a block chain do not need to be modified, and the method is easy to implement. And smooth upgrading can be realized through direct deployment, and a lightweight anti-
quantum hash solution is provided for the block
chain system.