CN-122027122-A - Block chain anti-quantum hash calculation method and system based on modular 30 reduced residual coefficient number
Abstract
The invention discloses a block chain anti-quantum hash calculation method and a system based on modular 30 shrinkage residual coefficient numbers, and belongs to the technical field of block chain safety; the method comprises the steps of obtaining block chain data to be processed, 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}, performing modulo 30 congruence substitution on a special number 1 in Z30 by adopting prime numbers 31 to form a modulo 30 congruence prime number set of Z30, embedding the M30 function into a core compression wheel function of an SHA256 algorithm to construct an improved hash algorithm Mod30SHA256, performing hash operation on the block chain data by utilizing the Mod30SHA256 algorithm, generating a 256-bit hash value and writing the 256-bit hash value into the block chain. According to the invention, by introducing the number theory confusion layer of the modular 30 reduction residual coefficient, a double diffusion mechanism of 'number theory confusion and bit operation confusion' is constructed, the quantum attack resistance of the hash algorithm is effectively improved, meanwhile, the operation efficiency basically equivalent to that of SHA256 is maintained, the hash algorithm is seamlessly compatible with the existing block chain architecture, the core structure and consensus mechanism of the block chain are not required to be modified, smooth upgrading can be directly deployed and realized, and a lightweight quantum hash resistance solution is provided for the block chain system.
Inventors
- LIU SHIZHANG
- CHEN YUSHENG
Assignees
- 刘诗章
- 陈豫生
Dates
- Publication Date
- 20260512
- Application Date
- 20260225
Claims (9)
- 1. The block chain anti-quantum hash calculation method based on the modular 30 reduced residual coefficient number is characterized by comprising the following steps of: step S1, obtaining block chain data to be processed; step S2, constructing a prime number permutation function P30 and a modulo 30 confusion function M30 based on the modulo 30 reduced residual system Z30 * = {1,7,11,13,17,19,23,29 }; the P30 function maps inputs to prime elements in a modulo 30 congruence prime set of Z30 * , the modulo 30 congruence prime set being {31,7,11,13,17,19,23,29},31≡1mod30, for implementing number theory confusion; The M30 function carries out exclusive OR fusion on an output result of the P30 function and an original input, and then obtains a 32-bit confusion value through modulo 2-to-32 operation, so that the hash diffusivity is enhanced; Step S3, embedding the module 30 confusion function M30 into a core compression round function of the SHA256 algorithm to construct an improved hash algorithm Mod30SHA256; S4, carrying out hash operation on the block chain data to be processed by utilizing the Mod30SHA256 algorithm to generate 256-bit hash values; And S5, writing the 256-bit hash value into a designated position of the blockchain.
- 2. The method according to claim 1, wherein the prime number replacement function P30 implements a table look-up mapping by a pre-calculation table, the pre-calculation table is a modulo 30 congruential prime number set {31,7,11,13,17,19,23,29} of Z30, and the input of the P30 function is an integer from 0 to 29 obtained by modulo 30 operation of the 32-bit original input.
- 3. The method of claim 1, wherein the calculating logic of the modulo 30 confusion function M30 is: where x is a 32-bit unsigned integer, Is an exclusive or operation.
- 4. The method according to claim 1, wherein in the step S3, the modulo-30 confusion function M30 is embedded into a core compression wheel function of the SHA256 algorithm, specifically, the output results of M30 (x) and the SHA256 primary core wheel function are fused in a linear or nonlinear combination mode, including respectively enhancing the primary sigma 0 function, the sigma 1 function, the Ch function and the Maj function as follows
- 5. The method of claim 1, wherein in step S1, the blockchain data to be processed includes at least one of block header data, transaction data, and smart contract code.
- 6. The method according to claim 1, wherein in the step S4, the hashing operation is performed on the blockchain data to be processed by using the Mod30SHA256 algorithm, including calculating the blockhead data in a double hash manner, i.e., h=mod 30SHA256 (Mod 30SHA256 (blockhead)).
- 7. A modular 30-reduction remainder-coefficient-based blockchain anti-quantum hash computing system, deployed in blockchain nodes, seamlessly compatible with existing blockchain architectures, comprising: The data acquisition module is used for acquiring the block chain data to be processed; A function construction module, configured to construct a prime number replacement function P30 and a modulo 30 confusion function M30 based on a modulo 30 reduced residual system Z30 * = {1,7,11,13,17,19,23,29}, where the P30 function is mapped to a modulo 30 congruence prime set {31,7,11,13,17,19,23,29} of Z30 * ; the algorithm construction module is used for embedding the modulo-30 confusion function M30 into a core compression round function of the SHA256 algorithm to construct an improved hash algorithm Mod30SHA256; the hash calculation module is used for carrying out hash operation on the block chain data to be processed by utilizing the Mod30SHA256 algorithm to generate a 256-bit hash value; And the data writing module is used for writing the 256-bit hash value into a designated position of the blockchain.
- 8. The system of claim 7, wherein the hash computation module is configured to compute a hash value of a block header, compute a merck root of transaction data, compute a transaction digest of transaction data, compute a code hash of a smart contract.
- 9. The system of claim 7, wherein the blockchain node is deployed with a Mod30SHA256 algorithm module and an original SHA256 algorithm module at the same time, supports smooth upgrade of the blockchain system, and realizes full network switching of the Mod30SHA256 algorithm by setting a blockheight transition period.
Description
Block chain anti-quantum hash calculation method and system based on modular 30 reduced residual coefficient number Technical Field The invention belongs to the technical field of block chain security, and particularly relates to a quantum attack resistance hash calculation method and system suitable for a block chain system. Background The blockchain technology realizes the non-falsification and chained association of data through a hash algorithm. Currently, mainstream blockchain systems (such as ethernet and the like) all adopt SHA256 as a core hash function for the links [1] of block head hash computation, merck tree root generation, transaction summary generation, intelligent contract code hash and the like. However, the prior art has the following problems: 1. Traditional hash algorithm has insufficient quantum resistance The security of the SHA256 and other homonymous operation hash algorithms is based on classical computation complexity, the quantum search algorithm can greatly reduce collision search complexity, and along with development of quantum computation technology, the potential safety hazard of the traditional hash algorithm is increasingly prominent, so that quantum attack threats cannot be met. 2. The existing post-quantum hash scheme has low efficiency and poor compatibility In order to cope with quantum threat, various post quantum hash related schemes proposed by academia generally have the problems of high calculation cost and high storage cost, and most schemes are incompatible with the architecture and consensus mechanism of the existing blockchain, so that a great deal of modification is required to be carried out on the blockchain system, and the blockchain system cannot be directly deployed. 3. There is a need in the blockchain industry for a 'lightweight' anti-quantum scheme In typical blockchain application scenes such as the blockchain of the Internet of things and the alliance chain, the terminal equipment has limited computing power and higher requirements on real-time performance and high concurrency of transaction processing, the existing post-quantum scheme cannot meet the use requirements of the scenes, and the iteration times of the SHA256 algorithm are simply increased, so that the security can only be improved in a classical computing system, the threat of quantum attack cannot be fundamentally solved, and the operation efficiency is easily reduced greatly. Citation literature: [1]Nakamoto S.Bitcoin:A Peer-to-Peer Electronic Cash System.2008. [2]Grover LK.A Fast Quantum Mechanical Algorithm for Database Search.STOC 1996. [3]Bernstein D J,et al.SPHINCS+:Stateless Hash-Based Signatures.PKC 2019. Disclosure of Invention 1. Object of the invention The invention aims to solve the problems of insufficient quantum resistance of a block chain hash algorithm, low efficiency of the existing post-quantum hash scheme and poor compatibility with a block chain architecture in the prior art, and provides a lightweight quantum hash resistance calculation method and system based on a modular 30-reduction residual coefficient number. 2. Technical proposal The method has the core thought that the number theory structure of the modular 30 reduced residual coefficient is embedded into the core compression round function of the SHA256, a double diffusion hash algorithm Mod30SHA256 of 'number theory confusion + bit operation confusion' is constructed, the quantum resistance characteristic of the algorithm is enhanced through confusion of a number theory layer, meanwhile, the original bit operation logic of the SHA256 is reserved, and the high efficiency and compatibility of the algorithm are ensured. 2.1 Core math foundation Define the simplified remainder of the model 30 (i.e., the positive remainder class with 30 texels): z30= {1,7,11,13,17,19,23,29}. The set has the following core characteristics: closure, namely, elements in the set still belong to the set after modulo 30 operation, and continuity of number theory confusion is ensured; Gao Hunxiao, the elements in the set are uniformly distributed, no obvious numerical rule exists, and a good number theory confusion effect can be realized; the lightweight performance is that only 8 elements are contained, the operation based on the set is a basic instruction, the operation cost is low, and the lightweight design requirement is met. Through routine analysis and comparison in the field, when the modulus is smaller than 30, the number of elements of the simplified residual system is too small to realize effective number theory confusion, and when the modulus is larger than 30, the operation cost is obviously increased, and the improvement of the confusion effect is not proportional to the increase of the operation cost, so that the modulus 30 is the optimal choice between the lightweight design and the high confusion. The invention strengthens the number theory confusion characteristic of prime number replacement function, adopts 31 which