Center binomial distribution random number sampling system and method
By designing the central binomial distribution random number sampling system for the accumulation module, expansion module and addition module, the problems of slow calculation speed, large power consumption and high delay of the general computing platform when generating the central binomial distribution are solved, and efficient and flexible random number generation is achieved to meet the needs of multiple grid cryptographic algorithms.
Patent Information
- Application Number
- CN202510426819.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-22
AI Technical Summary
In the prior art, the general computing platform has slow calculation speed, large power consumption, and high latency when generating random number sampling of central binomial distributions, and the existing hardware acceleration solutions are difficult to flexibly adapt to the needs of dynamic parameter changes.
A random number sampling system with a central binomial distribution is designed, including an accumulation module, an expansion module and an addition module. By accumulating random numbers in a binary sequence and sign-bit expansion and inversion operations, a random number that conforms to the central binomial distribution is generated.
It improves the efficiency of random number generation, reduces latency and power consumption, can flexibly adapt to the needs of different lattice cryptographic algorithms, and optimizes overall performance.
Smart Images

Figure CN120358019A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information and communication technologies, and particularly to a random number sampling system and method for central binomial distribution. Background Art
[0002] With the advancement of the NIST post-quantum cryptography standardization process, encryption schemes based on lattice theory (such as the CRYSTALS series of algorithms) have put forward new technical requirements for random number sampling. New generation standards such as FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), and the Aigis series of algorithms all require the implementation of a deterministic sampling mechanism based on the central binomial distribution (CBD). This requirement stems from the special requirements of the unique LWE (Learning With Errors) problem structure of lattice cryptography for the noise distribution. Compared with the traditional Gaussian distribution, CBD can achieve more efficient parameterized sampling through finite field operations while maintaining the same security strength, which is of fundamental significance for constructing a quantum-resistant cryptographic system.
[0003] As an important probability distribution, CBD has unique application value in cryptography due to its symmetry and bell-shaped distribution characteristics. However, the current implementation of CBD sampling faces an efficiency bottleneck. Existing solutions usually adopt software recursive algorithms, which lead to an exponential growth of the sampling period. Under the demand for large-scale sampling, the imbalance between system resource consumption and efficiency is particularly prominent. For example, when processing the coefficient sampling of a 1024-dimensional polynomial ring in FIPS 204, a general CPU solution will generate up to 10 6 orders of magnitude of conditional jump instructions, which in turn cause serious pipeline stalls and significantly reduce the sampling efficiency. Although general computing platforms have flexibility and generality, they still have significant performance bottlenecks when dealing with the demand for large-scale and high-frequency sampling. Especially in encryption protocols that require tens of thousands or even millions of samplings, the problems of computing speed, power consumption, and latency are becoming increasingly severe. In addition, traditional hardware acceleration solutions are usually based on fixed circuit structures and are difficult to flexibly adapt to dynamic parameter changes. For example, algorithms such as Aigis-enc and Aigis-sig require support for multi-mode switching of the random number range, while existing hardware acceleration solutions generally lack reconfigurability and cannot efficiently meet these dynamic demands. Summary of the Invention
[0004] This application provides a random number sampling system and method for central binomial distribution to solve the technical problems of slow computing speed, high power consumption, and high latency of existing general computing platforms for random number sampling of central binomial distribution.
[0005] The first aspect of the present application provides a random number sampling system for central binomial distribution, including:
[0006] An accumulation module, an expansion module, and an addition module;
[0007] The accumulation module is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result; the binary sequence is composed of the numerical value 0 and the numerical value 1;
[0008] The expansion module is configured to expand the first accumulation result by one sign bit 0 to obtain a first complement code; perform an operation of taking the inverse and adding 1 on the second accumulation result, and expand it by one sign bit 1 to obtain a second complement code;
[0009] The addition module is configured to obtain a target random number according to the first complement code and the second complement code; the target random number conforms to the central binomial distribution.
[0010] In some embodiments, the accumulation module includes:
[0011] A first accumulation unit, which is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result;
[0012] A second accumulation unit, which is configured to obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result.
[0013] In some embodiments, the expansion module includes:
[0014] A first expansion unit, which is configured to expand the first accumulation result by one sign bit 0 to obtain a first complement code;
[0015] A second expansion unit, which is configured to perform an operation of taking the inverse and adding 1 on the second accumulation result, and expand it by one sign bit 1 to obtain a second complement code.
[0016] In some embodiments, the accumulation module is further configured to:
[0017] Obtain a selection signal value;
[0018] Determine a configuration value according to the selection signal value;
[0019] Determine a preset number according to the configuration value.
[0020] In some embodiments, the accumulation module has a tree structure; if the encryption algorithm is the Scloud+ algorithm, the accumulation module is configured with a four-level structure; the first-level structure is configured with three adders, the second-level structure is configured with two adders, and the third-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result;
[0021] The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to:
[0022] Obtain a first selection signal value;
[0023] Determine a first configuration value according to the first selection signal value;
[0024] Based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the first configuration value;
[0025] Wherein, when the first selection signal value is 0, the first configuration value is 1; when the first selection signal value is 1, the first configuration value is 2; when the first selection signal value is 2, the first configuration value is 3; when the first selection signal value is 3, the first configuration value is 7.
[0026] In some embodiments, if the encryption algorithm is the FIPS 203 algorithm, the accumulation module is configured with a three-level structure; the first-level structure is configured with one adder, and the second-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result;
[0027] The third-level structure is configured with a multiplexer, and the multiplexer is configured to:
[0028] Obtain a second selection signal value;
[0029] Determine a second configuration value according to the second selection signal value;
[0030] Based on the intermediate accumulation result, generate a target accumulation result according to the second configuration value;
[0031] Wherein, when the second selection signal value is 0, the second configuration value is 2; when the second selection signal value is 1, the second configuration value is 3.
[0032] In some embodiments, if the encryption algorithm is the FIPS 204 algorithm, the accumulation module is configured with a three-level structure; the first-level structure is configured with two adders, the second-level structure is configured with one adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result;
[0033] The third-level structure is configured with a multiplexer, and the multiplexer is configured to:
[0034] Obtain a third selection signal value;
[0035] Determine a third configuration value according to the third selection signal value;
[0036] Based on the intermediate accumulation result, generate a target accumulation result according to the third configuration value;
[0037] Wherein, when the third selection signal value is 0, the third configuration value is 2; when the third selection signal value is 1, the third configuration value is 4.
[0038] In some embodiments, if the encryption algorithm is the Aigis-enc algorithm, the accumulation module is configured with a five-level structure; the first-level structure is configured with six adders, the second-level structure is configured with three adders, the third-level structure is configured with one adder, the fourth-level structure is configured with one adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result;
[0039] The fifth-level structure is configured with a multiplexer, and the multiplexer is configured to:
[0040] Obtain a fourth selection signal value;
[0041] Determine a fourth configuration value according to the fourth selection signal value;
[0042] Based on the preset number of binary parameters at the front end of the binary parameter sequence or the preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the fourth configuration value;
[0043] When the fourth selection signal value is 0, the fourth configuration value is 1; when the fourth selection signal value is 1, the fourth configuration value is 2; when the fourth selection signal value is 2, the fourth configuration value is 4; when the fourth selection signal value is 3, the fourth configuration value is 8; when the fourth selection signal value is 4, the fourth configuration value is 12.
[0044] In some embodiments, if the encryption algorithm is the Aigis-sig algorithm, the accumulation module is configured with a four-level structure; the first-level structure is configured with two adders, the second-level structure is configured with one adder, and the third-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result.
[0045] The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to:
[0046] Obtain a fifth selection signal value;
[0047] Determine a fifth configuration value according to the fifth selection signal value;
[0048] Based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the fifth configuration value;
[0049] Wherein, when the fifth selection signal value is 0, the fifth configuration value is 1; when the fifth selection signal value is 1, the fifth configuration value is 2; when the fifth selection signal value is 2, the fifth configuration value is 3; when the fifth selection signal value is 3, the fifth configuration value is 5.
[0050] The second aspect of the present application provides a method for sampling random numbers of a central binomial distribution, which is applied to a system for sampling random numbers of a central binomial distribution described in any one of the above first aspects, and includes:
[0051] Obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result; the binary sequence is composed of the numerical value 0 and the numerical value 1.
[0052] Extend the first accumulation result by one sign bit 0 to obtain a first complement code; perform an operation of taking the inverse and adding 1 to the second accumulation result, and extend one sign bit 1 to obtain a second complement code.
[0053] Based on the first complement code and the second complement code, a target random number is obtained; the target random number conforms to the central binomial distribution.
[0054] This application provides a random number sampling system and method for central binomial distribution. The system includes: an accumulation module, an extension module, and an addition module. The accumulation module is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result. The binary sequence is composed of the numerical value 0 and the numerical value 1. The extension module is configured to extend the first accumulation result by one sign bit 0 to obtain a first complement code; perform an operation of taking the inverse and adding 1 to the second accumulation result, and extend it by one sign bit 1 to obtain a second complement code. The addition module is configured to obtain a target random number based on the first complement code and the second complement code. The target random number conforms to the central binomial distribution, so as to solve the problems of slow calculation speed, high power consumption, and high latency in the current general computing platform for the random number sampling work of the central binomial distribution. Description of the Drawings
[0055] In order to more clearly illustrate the technical solutions of this application, the drawings required for implementation will be briefly introduced below. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0056] Figure 1 It is a schematic structural diagram of the random number sampling system for central binomial distribution in this application;
[0057] Figure 2 It is a first schematic structural diagram of the accumulation module in this application;
[0058] Figure 3 It is a second schematic structural diagram of the accumulation module in this application;
[0059] Figure 4 It is a third schematic structural diagram of the accumulation module in this application;
[0060] Figure 5 It is a fourth schematic structural diagram of the accumulation module in this application;
[0061] Figure 6 It is a fifth schematic structural diagram of the accumulation module in this application.
[0062] Description of the Reference Numerals:
[0063] 1 - Accumulation module; 11 - First accumulation unit; 12 - Second accumulation unit; 2 - Extension module; 21 - First extension unit; 22 - Second extension unit; 3 - Addition module. Detailed Embodiments
[0064] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.
[0065] Since in some technologies, the general computing platform has a slow calculation speed, high power consumption and high delay for random number sampling of central binomial distribution, in order to solve this technical problem, the present application provides a random number sampling system and method of central binomial distribution. The random number sampling system and method of central binomial distribution are described below:
[0066] For example, in modern cryptography, the statistical properties of random numbers directly affect the security of the encryption system. Central Binomial Distribution has become a core component of quantum-resistant cryptographic algorithms due to its unique probability distribution characteristics. This distribution can generate encryption parameters that meet security requirements and take into account computational efficiency by controlling the distribution range and central tendency of random numbers. For example, in standardized algorithms based on lattice cryptography (such as the CRYSTALS-Kyber key encapsulation mechanism), central binomial distribution is used to generate encryption noise. These noise parameters must ensure sufficient randomness to resist quantum attacks, and must strictly follow the preset distribution law to achieve algorithm security proof.
[0067] The remarkable characteristics of the central binomial distribution are reflected in its symmetry and probability decay characteristics. When the distribution parameter is set to η, the generated values are strictly limited to the integer range of [-η, +η], and are symmetrically distributed with 0 as the center. The farther away from the center, the lower the probability of occurrence, forming a typical bell-shaped probability curve. This controllable distribution characteristic enables it to generate the statistical randomness required for cryptography and avoid the accumulation of computational errors caused by extreme values. Therefore, it is designated as the core mathematical tool for noise generation by the NIST post-quantum cryptography standard.
[0068] The main challenge of the prior art lies in balancing security and execution efficiency. When traditional implementation schemes generate random numbers that meet the standards, a large number of probability comparisons and conditional branch operations need to be performed. Taking a typical quantum-resistant key exchange protocol as an example, tens of thousands of independent samplings need to be completed in a single operation, which causes serious instruction pipeline blocking problems for general-purpose processors, and the measured efficiency drops by more than 60% compared to the theoretical peak. At the same time, for the dynamic adjustment of parameters required by different cryptographic algorithm protocols (such as the η value switching between 2 and 6), it is difficult for existing hardware architectures to achieve flexible configuration while maintaining high throughput.
[0069] As Figure 1 shown, it is a schematic structural diagram of a random number sampling system with a central binomial distribution in this application.
[0070] In view of the above problems, a first aspect of this application provides a random number sampling system with a central binomial distribution, including:
[0071] An accumulation module 1, an extension module 2, and an addition module 3; the accumulation module 1 is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result x; obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result y; the binary sequence is composed of the numerical value 0 and the numerical value 1; the random numbers include several numerical values 0 and 1; wherein, the preset number is determined according to the configuration of the encryption algorithm used; the extension module 2 is configured to extend the first accumulation result x by one sign bit 0 to obtain a first complement code; perform an operation of taking the inverse and adding 1 on the second accumulation result y, and extend it by one sign bit 1 operation to obtain a second complement code; extend the first accumulation result x by one sign bit 0 to obtain a first complement code X representation; perform an operation of taking the inverse and adding 1 (the sign bit remains unchanged, take the inverse of the mantissa and then add 1) on the second accumulation result y, and extend it by one sign bit 1 to obtain a second complement code -Y representation.
[0072] The addition module 3 is configured to obtain a target random number X + (-Y) according to the first complement code X and the second complement code -Y; the target random number conforms to the central binomial distribution.
[0073] Specifically, the random number sampling algorithm with a central binomial distribution provided in this application is as follows:
[0074] Input: Random binary parameter sequence b
[0075] for(i = 0, i < n, i++) do
[0076] The first step: Accumulate the first η items of the binary parameter sequence
[0077] The second step: Accumulate the last η items of the binary parameter sequence
[0078] Step 3: f[i] ← x - y
[0079] end for
[0080] Output: n central binomial distribution data f within the range of [-η, η].
[0081] Among them, j represents accumulation, accumulating the first η terms of the binary parameter sequence or the last η terms of the binary parameter sequence.
[0082] The accumulation module 1 includes:
[0083] The first accumulation unit 11, which is configured to obtain and accumulate a preset number of random numbers at the front end of the binary sequence to generate a first accumulation result x; the second accumulation unit 12, which is configured to obtain and accumulate a preset number of random numbers at the back end of the binary sequence to generate a second accumulation result y.
[0084] The extension module 2 includes:
[0085] The first extension unit 21, which is configured to extend the first accumulation result x by one sign bit 0 to obtain a first complement code X; the second extension unit 22, which is configured to perform an operation of inverting and adding 1 to the second accumulation result y and extend it by one sign bit 1 to obtain a second complement code -Y.
[0086] The accumulation module 1 is further configured to:
[0087] Obtain a selection signal value; the selection signal value is the parameter configuration of the externally input encryption algorithm, that is, the configuration value η; determine the configuration value η according to the selection signal value; determine a preset number according to the configuration value η. The preset number is [-η, η].
[0088] Exemplarily, in different encryption algorithms, the required random number range [-η, η] will be different, specifically depending on the requirements of the algorithm. The following table lists the η values required for several common lattice cryptography algorithms:
[0089] Algorithm η Scloud+ 1 / 2 / 3 / 7 FIPS 203 2 / 3 FIPS 204 2 / 4 Aigis-enc 1 / 2 / 4 / 8 / 12 Aigis-sig 1 / 2 / 3 / 5
[0090] Among them, by configuring the corresponding η value according to the above algorithm requirements, it can flexibly adapt to different lattice cryptography algorithms in the random number sampling system of the central binomial distribution provided in this application and optimize the performance.
[0091] Such as Figure 2 shown, it is the first structural schematic diagram of the accumulation module in this application.
[0092] In this embodiment, the accumulation module 1 has a tree structure; if the encryption algorithm is the Scloud+ algorithm, the accumulation module 1 is configured with a four-level structure; the first-level structure is configured with three adders, the second-level structure is configured with two adders, and the third-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result.
[0093] The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to: obtain a first selection signal value; determine a first configuration value according to the first selection signal value; generate a target accumulation result based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result according to the first configuration value; where when the first selection signal value is 0, the first configuration value is 1; when the first selection signal value is 1, the first configuration value is 2; when the first selection signal value is 2, the first configuration value is 3; when the first selection signal value is 3, the first configuration value is 7.
[0094] Specifically, the accumulation module architecture applicable to the Scloud+ module is as Figure 2 shown. This architecture includes multiple adders. Each adder receives a certain number of input signals (such as in[0], in[1], in[2], etc.) and performs step-by-step summation at different levels. The output of each adder is connected to the adder at the next level or the final output multiplexer. Finally, by selecting an appropriate first configuration value (sel value), the range of the output target accumulation result can be controlled, thereby generating binomial distribution random numbers under different configurations. In the accumulation module applicable to the Scloud+ module, when the "sel" value is 0, the accumulation result with η = 1 is output; when the "sel" value is 1, the accumulation result with η = 2 is output; when the "sel" value is 2, the accumulation result with η = 3 is output; when the "sel" value is 3, the accumulation result with η = 7 is output. Through the hardware architecture design of the tree structure, it is possible to reduce latency and power consumption while ensuring efficient random number generation and improving overall performance. Through the accumulation module architecture provided by this application, the hardware can flexibly generate the required central binomial distribution random numbers within the range of 1 / 2 / 3 / 7 according to the needs of the Scloud+ algorithm, providing an efficient and reliable random number source for the subsequent encryption process.
[0095] As Figure 3 shown, it is the second structural schematic diagram of the accumulation module in this application.
[0096] In this embodiment, if the encryption algorithm is the FIPS 203 algorithm, the accumulation module 1 is configured with a three-level structure; the first-level structure is configured with an adder, and the second-level structure is configured with an adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the rear end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result.
[0097] The third-level structure is configured with a multiplexer, and the multiplexer is configured to: obtain a second selection signal value; determine a second configuration value according to the second selection signal value; generate a target accumulation result based on the intermediate accumulation result according to the second configuration value; wherein, when the second selection signal value is 0, the second configuration value is 2; when the second selection signal value is 1, the second configuration value is 3.
[0098] Specifically, the accumulation module architecture applicable to the FIPS 203 module is as Figure 3 shown. When the value of "sel" is 0, the accumulation result with η = 2 is output, and when the value of "sel" is 1, the accumulation result with η = 3 is output. Through this accumulation module architecture, the central binomial distribution random numbers within the range of 2 / 3 can be flexibly generated according to the requirements of the FIPS 203 algorithm.
[0099] As Figure 4 shown, it is the schematic diagram of the third structure of the accumulation module in this application.
[0100] In this embodiment, if the encryption algorithm is the FIPS 204 algorithm, the accumulation module 1 is configured with a three-level structure; the first-level structure is configured with two adders, and the second-level structure is configured with an adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the rear end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result.
[0101] The third-level structure is configured with a multiplexer, and the multiplexer is configured to: obtain a third selection signal value; determine a third configuration value according to the third selection signal value; generate a target accumulation result based on the intermediate accumulation result according to the third configuration value; wherein, when the third selection signal value is 0, the third configuration value is 2; when the third selection signal value is 1, the third configuration value is 4.
[0102] Specifically, the accumulation module architecture applicable to the FIPS 204 module is as Figure 4As shown, when the value of "sel" is 0, the accumulated result of η = 2 is output. When the value of "sel" is 1, the accumulated result of η = 4 is output. Through this accumulation module architecture, it is possible to flexibly generate the required central binomial distribution random numbers within the range of 2 / 4 according to the requirements of the FIPS204 algorithm.
[0103] As Figure 5 shown, it is the fourth structural schematic diagram of the accumulation module in this application.
[0104] In this embodiment, if the encryption algorithm is the Aigis-enc algorithm, the accumulation module 1 is configured with a five-level structure; the first-level structure is configured with six adders, the second-level structure is configured with three adders, the third-level structure is configured with one adder, and the fourth-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulated result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulated result.
[0105] The fifth-level structure is configured with a multiplexer. The multiplexer is configured to: obtain the fourth selection signal value; determine the fourth configuration value according to the fourth selection signal value; based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulated result, generate a target accumulated result according to the fourth configuration value; wherein, when the fourth selection signal value is 0, the fourth configuration value is 1; when the fourth selection signal value is 1, the fourth configuration value is 2; when the fourth selection signal value is 2, the fourth configuration value is 4; when the fourth selection signal value is 3, the fourth configuration value is 8; when the fourth selection signal value is 4, the fourth configuration value is 12.
[0106] Specifically, the accumulation module architecture applicable to the Aigis-enc module is as Figure 5 shown. When the value of "sel" is 0, the accumulated result of η = 1 is output. When the value of "sel" is 1, the accumulated result of η = 2 is output. When the value of "sel" is 2, the accumulated result of η = 4 is output. When the value of "sel" is 3, the accumulated result of η = 8 is output. When the value of "sel" is 4, the accumulated result of η = 12 is output. Through this accumulation module architecture, the hardware can flexibly generate the required central binomial distribution random numbers within the range of 1 / 2 / 4 / 8 / 12 according to the needs of the Aigis-enc algorithm.
[0107] As Figure 6 shown, it is the fifth structural schematic diagram of the accumulation module in this application.
[0108] In this embodiment, if the encryption algorithm is the Aigis-sig algorithm, the accumulation module 1 is configured with a four-level structure; the first-level structure is configured with two adders, the second-level structure is configured with one adder, and the third-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result.
[0109] The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to: obtain a fifth selection signal value; determine a fifth configuration value according to the fifth selection signal value; based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the fifth configuration value; wherein, when the fifth selection signal value is 0, the fifth configuration value is 1; when the fifth selection signal value is 1, the fifth configuration value is 2; when the fifth selection signal value is 2, the fifth configuration value is 3; when the fifth selection signal value is 3, the fifth configuration value is 5.
[0110] Specifically, the accumulation module architecture applicable to the Aigis-sig module is as Figure 6 shown. When the value of "sel" is 0, the accumulation result with η = 1 is output; when the value of "sel" is 1, the accumulation result with η = 2 is output; when the value of "sel" is 2, the accumulation result with η = 3 is output; when the value of "sel" is 3, the accumulation result with η = 5 is output. Through this accumulation module architecture, it is possible to flexibly generate the central binomial distribution random numbers within the range of 1 / 2 / 3 / 5 as required by the Aigis-enc algorithm.
[0111] The present application provides a random number sampling system for central binomial distribution, which has the following beneficial effects:
[0112] 1. Configurable random number sampling method: By adjusting the parameter η, the present application can flexibly generate the central binomial distribution random numbers within the required range in different lattice cryptography algorithms, meeting the requirements of different algorithms.
[0113] 2. Hardware architecture design: The present application provides a hardware architecture including the random number sampling system architecture for central binomial distribution and the accumulation module, which meets the requirements of various lattice cryptography algorithms (such as Scloud+, FIPS 203, FIPS 204, Aigis-enc, Aigis-sig).
[0114] 3. Flexible adaptation to different algorithm requirements: The hardware architecture of the accumulation module provided by this application enables it to adjust the hardware complexity of the tree structure in the accumulation module according to the η value configured by the algorithm, and realize the generation of binomial distribution random numbers.
[0115] 4. Performance optimization: The hardware architecture of the accumulation module provided by this application optimizes the problems of high latency and high power consumption through the tree structure design, improves the generation efficiency of random numbers, ensures efficient random number generation, and enhances the overall performance.
[0116] This application provides a random number sampling system for central binomial distribution, which can improve the sampling efficiency, reduce latency and energy consumption, and can be widely applied in various cryptographic application scenarios to meet the current requirements of cryptography for high performance, security and real-time performance.
[0117] The second aspect of this application provides a random number sampling method for central binomial distribution, which is applied to a random number sampling system for central binomial distribution described in any of the above embodiments, and includes:
[0118] Take a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result; the binary sequence is composed of the numerical value 0 and the numerical value 1;
[0119] Extend the first accumulation result by one sign bit 0 to obtain a first complement code; perform an operation of taking the inverse and adding 1 on the second accumulation result, and extend it by one sign bit 1 to obtain a second complement code;
[0120] According to the first complement code and the second complement code, obtain a target random number; the target random number conforms to the central binomial distribution.
[0121] It should be noted that the effects of the above method embodiments can be referred to the effects of the above system embodiments, and will not be elaborated here.
[0122] The above specific implementation manners further elaborate the purpose, technical solutions and beneficial effects of the embodiments of this application. It should be understood that the above are only the specific implementation manners of the embodiments of this application, and are not used to limit the protection scope of the embodiments of this application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the embodiments of this application shall be included in the protection scope of the embodiments of this application.
Claims
1. A random number sampling system for the central binomial distribution, characterized in that, Including: An accumulation module (1), an extension module (2), and an addition module (3); The accumulation module (1) is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; Obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result; The binary sequence is composed of the numerical value 0 and the numerical value 1; The extension module (2) is configured to extend the first accumulation result by one sign bit 0 to obtain a first complement code; perform an operation of inverting and adding 1 to the second accumulation result and extend it by one sign bit 1 to obtain a second complement code; The addition module (3) is configured to obtain a target random number according to the first complement code and the second complement code; the target random number conforms to the central binomial distribution.
2. The random number sampling system of a central binomial distribution according to claim 1, characterized in that, The accumulation module (1) includes: A first accumulation unit (11), which is configured to obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; A second accumulation unit (12), which is configured to obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result.
3. The random number sampling system of a central binomial distribution according to claim 1, characterized in that, The extension module (2) includes: A first extension unit (21), which is configured to extend the first accumulation result by one sign bit 0 to obtain a first complement code; A second extension unit (22), which is configured to perform an operation of inverting and adding 1 to the second accumulation result and extend it by one sign bit 1 to obtain a second complement code.
4. A random number sampling system for the central binomial distribution according to claim 1, characterized in that, The accumulation module (1) is further configured to: Obtain a selection signal value; Determine a configuration value according to the selection signal value; Determine a preset number according to the configuration value.
5. The random number sampling system of a central binomial distribution according to claim 4, characterized in that, The accumulation module (1) is of a tree structure; if the encryption algorithm is the Scloud+ algorithm, the accumulation module (1) is configured with a four-level structure; the first-level structure is configured with three adders, the second-level structure is configured with two adders, the third-level structure is configured with one adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result; The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to: Obtain a first selection signal value; Determine a first configuration value according to the first selection signal value; Based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the first configuration value; Wherein, when the first selection signal value is 0, the first configuration value is 1; when the first selection signal value is 1, the first configuration value is 2; when the first selection signal value is 2, the first configuration value is 3; when the first selection signal value is 3, the first configuration value is 7.
6. The random number sampling system of a central binomial distribution according to claim 4, characterized in that, If the encryption algorithm is the FIPS203 algorithm, the accumulation module (1) is configured with a three-level structure; the first-level structure is configured with an adder, the second-level structure is configured with an adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result; The third-level structure is configured with a multiplexer, and the multiplexer is configured to: Obtain a second selection signal value; Determine a second configuration value according to the second selection signal value; Generate a target accumulation result based on the intermediate accumulation result and according to the second configuration value; Wherein, when the second selection signal value is 0, the second configuration value is 2; When the second selection signal value is 1, the second configuration value is 3.
7. A random number sampling system for central binomial distribution according to claim 4, characterized in that, If the encryption algorithm is the FIPS204 algorithm, the accumulation module (1) is configured with a three-level structure; the first-level structure is configured with two adders, the second-level structure is configured with an adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result; The third-level structure is configured with a multiplexer, and the multiplexer is configured to: Obtain a third selection signal value; Determine a third configuration value according to the third selection signal value; Generate a target accumulation result based on the intermediate accumulation result and according to the third configuration value; Wherein, when the third selection signal value is 0, the third configuration value is 2; when the third selection signal value is 1, the third configuration value is 4.
8. A random number sampling system for central binomial distribution according to claim 4, characterized in that, If the encryption algorithm is the Aigis-enc algorithm, the accumulation module (1) is configured with a five-level structure; the first-level structure is configured with six adders, the second-level structure is configured with three adders, the third-level structure is configured with an adder, the fourth-level structure is configured with an adder, and the adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result; The fifth-level structure is configured with a multiplexer, and the multiplexer is configured to: Obtain a fourth selection signal value; Determine a fourth configuration value according to the fourth selection signal value; Generate a target accumulation result based on the preset number of binary parameters at the front end of the binary parameter sequence or the preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result and according to the fourth configuration value; When the fourth selection signal value is 0, the fourth configuration value is 1; when the fourth selection signal value is 1, the fourth configuration value is 2; when the fourth selection signal value is 2, the fourth configuration value is 4; when the fourth selection signal value is 3, the fourth configuration value is 8; when the fourth selection signal value is 4, the fourth configuration value is 12.
9. A random number sampling system for central binomial distribution according to claim 4, characterized in that, If the encryption algorithm is the Aigis-sig algorithm, the accumulation module (1) is configured with a four-level structure; the first-level structure is configured with two adders, the second-level structure is configured with one adder, and the third-level structure is configured with one adder. The adder is configured to receive a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the accumulation result generated by the previous-level adder, perform an accumulation operation, and generate an intermediate accumulation result. The fourth-level structure is configured with a multiplexer, and the multiplexer is configured to: Obtain a fifth selection signal value; Determine a fifth configuration value according to the fifth selection signal value; Based on a preset number of binary parameters at the front end of the binary parameter sequence or a preset number of binary parameters at the back end of the binary parameter sequence or the intermediate accumulation result, generate a target accumulation result according to the fifth configuration value; Wherein, when the fifth selection signal value is 0, the fifth configuration value is 1; when the fifth selection signal value is 1, the fifth configuration value is 2; when the fifth selection signal value is 2, the fifth configuration value is 3; when the fifth selection signal value is 3, the fifth configuration value is 5.
10. A random number sampling method for the central binomial distribution, applied to a random number sampling system for the central binomial distribution according to any one of the above claims 1 to 9, characterized in that, Including: Obtain a preset number of random numbers at the front end of the binary sequence and accumulate them to generate a first accumulation result; Obtain a preset number of random numbers at the back end of the binary sequence and accumulate them to generate a second accumulation result; The binary sequence is composed of the numerical value 0 and the numerical value 1; Extend the first accumulation result by one sign bit 0 to obtain a first complement code; Perform an operation of inverting and adding 1 to the second accumulation result and extend it by one sign bit 1 to obtain a second complement code; According to the first complement code and the second complement code, obtain a target random number; the target random number conforms to the central binomial distribution.