Entropy source storage method and device, equipment and medium

By integrating the first entropy source and the newly generated entropy source in the entropy pool, the problem of insufficient security and reliability of entropy source storage in the existing technology is solved, and the complexity and security of the entropy source are improved.

CN118626053APending Publication Date: 2024-09-10BEIJING PASSWORD CLOUD CORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410615182.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

There are design loopholes in the existing entropy source storage algorithm, resulting in poor security and reliability of the entropy source. Especially when the entropy pool is full, directly storing the newly generated entropy source may be used to crack the generation algorithm.

Method used

When there is no free storage space in the entropy pool, the first entropy source with the earliest storage order is merged with the newly generated original entropy source to obtain the target entropy source and store it in the entropy pool, while updating the storage order of the entropy source. .

Benefits of technology

Through the fusion operation, the complexity of the entropy source is increased, thereby enhancing its security and reliability and preventing the decrease in security caused by the increase in the number of entropy sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626053A
    Figure CN118626053A
Patent Text Reader

Abstract

The invention discloses an entropy source storage method and device, equipment and a medium, and relates to the technical field of random number generation, and the method comprises the steps: obtaining a newly generated original entropy source; when the free storage space does not exist in the entropy pool, the first entropy source with the earliest storage sequence is taken out from the entropy pool; fusing the first entropy source and the original entropy source to obtain a target entropy source; and storing the target entropy source into the entropy pool, and updating the storage sequence of the entropy sources in the entropy pool. According to the invention, the safety and reliability of the entropy source are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of random number generation, and in particular to a storage method, device, equipment and medium for an entropy source. Background Art

[0002] As a source of random numbers, entropy sources can be used to generate random numbers. Random number generation is extremely important for cryptography. For example, key distribution and mutual authentication in network security algorithms, session keys used for short-term sessions, and keys for RSA public key encryption algorithms all require the participation of random numbers.

[0003] In the prior art, entropy sources are usually generated by a set algorithm, and the generated entropy sources are directly stored in an entropy pool; if the entropy pool is full, a new entropy pool is created to store the newly generated entropy source. If there are design loopholes or design defects in the storage algorithm of the entropy source, as the number of entropy sources continues to increase, a large number of entropy sources can be used to crack the entropy source generation algorithm, resulting in poor security and reliability of the entropy source. Summary of the invention

[0004] The present invention provides a storage method, device, equipment and medium for an entropy source to improve the security and reliability of the entropy source.

[0005] In a first aspect, the present invention provides a method for storing an entropy source, comprising:

[0006] Get the newly generated raw entropy source;

[0007] When there is no free storage space in the entropy pool, the first entropy source with the earliest storage order is taken out from the entropy pool;

[0008] The first entropy source and the original entropy source are merged to obtain the target entropy source;

[0009] Store the target entropy source into the entropy pool and update the storage order of the entropy sources in the entropy pool.

[0010] In a second aspect, the present invention further provides a storage device for an entropy source, comprising:

[0011] An entropy source acquisition module is used to obtain a newly generated original entropy source;

[0012] An entropy source extraction module is used to extract the first entropy source with the earliest storage order from the entropy pool when there is no free storage space in the entropy pool;

[0013] An entropy source fusion module is used to fuse the first entropy source and the original entropy source to obtain the target entropy source;

[0014] The entropy source storage module is used to store the target entropy source in the entropy pool and update the storage order of the entropy sources in the entropy pool.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, including:

[0016] at least one processor; and

[0017] a memory communicatively coupled to at least one processor; wherein

[0018] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute the entropy source storage method provided by any embodiment of the present invention.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the method for storing an entropy source of any embodiment of the present invention when executed by a processor.

[0020] The embodiment of the present invention obtains a newly generated original entropy source; when there is no free storage space in the entropy pool, takes out the first entropy source with the earliest storage order from the entropy pool; fuses the first entropy source and the original entropy source to obtain a target entropy source; stores the target entropy source in the entropy pool, and updates the storage order of the entropy sources in the entropy pool. In the case where there is no free storage space in the entropy pool, the embodiment of the present invention fuses the first entropy source and the original entropy source to obtain the target entropy source. Compared with the technical solution of directly storing the generated entropy source directly in the entropy pool in the prior art, the complexity of the entropy source can be further improved on the basis of ensuring that the number of entropy sources remains unchanged, thereby improving the security and reliability of the entropy source.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 is a flow chart of a method for storing an entropy source provided according to Embodiment 1 of the present invention;

[0024] Figure 2A is a flow chart of a method for storing an entropy source provided according to Embodiment 2 of the present invention;

[0025] Figure 2Bis a schematic diagram of an entropy source storage process provided according to Embodiment 2 of the present invention;

[0026] Figure 3 is a structural schematic diagram of a storage device for an entropy source provided according to Embodiment 3 of the present invention;

[0027] Figure 4 It is a structural schematic diagram of an electronic device for implementing the method for storing an entropy source according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first" and "second" and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] In the technical solution of the embodiment of the present invention, the acquisition, storage and application of the original entropy source, etc. involved all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0031] Embodiment 1

[0032] Figure 1 A flowchart of a method for storing an entropy source provided in Embodiment 1 of the present invention is provided. This embodiment is applicable to the case where a generated entropy source is stored. The method can be executed by a storage device for an entropy source. The storage device for the entropy source can be implemented in the form of hardware and / or software and is specifically configured in an electronic device, such as a server.

[0033] See also Figure 1 The storage method of the entropy source shown includes:

[0034] S101. Obtain a newly generated original entropy source.

[0035] In this embodiment, the original entropy source is a newly generated entropy source that has not been stored. Specifically, a certain algorithm can be used to obtain the newly generated original entropy source.

[0036] S102: When there is no free storage space in the entropy pool, take out the first entropy source with the earliest storage order from the entropy pool.

[0037] In this embodiment, the entropy pool can be used to store entropy sources. The entropy pool can have a certain amount of storage space for storing a corresponding number of entropy sources. It should be noted that the amount of storage space can be independently set by the technician according to actual needs or practical experience, and the present invention does not limit this. Free storage space may refer to storage space that has not yet stored an entropy source. The storage order may refer to the order in which the entropy sources are stored in the entropy pool. The first entropy source is the entropy source with the earliest storage order in the entropy pool.

[0038] S103: Fusing the first entropy source and the original entropy source to obtain a target entropy source.

[0039] In this embodiment, the target entropy source is the result of fusing the first entropy source and the original entropy source. Specifically, a certain algorithm is used to fuse the first entropy source and the original entropy source to obtain the target entropy source.

[0040] S104: Store the target entropy source in the entropy pool, and update the storage order of the entropy sources in the entropy pool.

[0041] In an optional embodiment, after taking out the first entropy source with the earliest storage order from the entropy pool, the auxiliary storage space is in an idle state, wherein the auxiliary storage space may be the storage space for storing the first entropy source taken out; the target entropy source is stored in the auxiliary storage space; for each entropy source in the entropy pool, the storage order of the entropy source is reduced by one to update the storage order of the entropy source. For example, if the entropy pool has 4 storage spaces, and all of them store entropy sources, the entropy sources are entropy source A, entropy source B, entropy source C and entropy source D, wherein the storage order of entropy source A is 0, the storage order of entropy source B is 1; the storage order of entropy source C is 2; the storage order of entropy source D is 3. The entropy source A with the earliest storage order is taken out from the entropy pool. The storage space originally used to store entropy source A is in an idle state. The target entropy source is stored in the idle storage space, and the storage order of the target entropy source is determined to be 4; the storage order of entropy source B is updated to 0, the storage order of entropy source C is updated to 1, the storage order of entropy source D is updated to 2, and the storage order of the target entropy source is updated to 3.

[0042] Optionally, after taking out the first entropy source with the earliest storage order from the entropy pool, the storage order of the remaining entropy sources in the entropy pool can be updated first; after completing the storage order update of the remaining entropy sources, the target entropy source is stored in the auxiliary storage space, and the storage order of the target entropy source is determined. For example, if the entropy pool has 4 storage spaces, and all of them store entropy sources, the entropy sources are entropy source A, entropy source B, entropy source C and entropy source D, wherein the storage order of entropy source A is 0, the storage order of entropy source B is 1; the storage order of entropy source C is 2; and the storage order of entropy source D is 3. The entropy source A with the earliest storage order is taken out from the entropy pool, and the storage space originally used to store entropy source A is in an idle state; the storage order of entropy source B is updated to 0, the storage order of entropy source C is updated to 1, and the storage order of entropy source D is updated to 2; the target entropy source is stored in the idle storage space, and the storage order of the target entropy source is determined to be 3.

[0043] In an optional embodiment, in response to a request for generating a random number, the number of characters of the random number to be generated is obtained; at least one entropy source is taken out from the entropy pool according to the number of characters and the storage order of each entropy source in the entropy pool; and a random number is generated according to each entropy source taken out from the entropy pool.

[0044] The number of characters in the random number may refer to the number of characters in the random number. Specifically, if the number of characters in the random number to be generated is less than the number of entropy sources in the entropy pool, entropy sources with the same number as the number of characters in the random number to be generated are selected from the entropy pool in the order of storage from small to large. A preset random number generation algorithm is used to generate a random number according to each entropy source taken out from an entropy pool; if the number of characters of the random number to be generated is greater than the number of entropy sources in the entropy pool, all entropy sources in the entropy pool are taken out; an initial random number is generated according to all the entropy sources taken out by the set random number generation algorithm, and the initial random number is determined as the random number to be updated; a reference random number is generated according to the set multiplication constant, addition constant, modulus and random number to be updated; it is checked whether the number of characters of the reference random number is equal to the number of characters of the random number to be generated; if the number of characters of the reference random number is equal to the number of characters of the random number to be generated, the reference random number is determined to be the final generated random number; if the number of characters of the reference random number is not equal to the number of characters of the random number to be generated, the random number to be updated is updated to the reference random number, and the step of generating the reference random number according to the set multiplication constant, addition constant, modulus and random number to be updated is returned until the number of characters of the reference random number is equal to the number of characters of the random number to be generated, and the reference random number at this time is used as the final generated random number. It should be noted that the random number generation algorithm can adopt at least one of the existing technologies; the addition constant, multiplication constant and modulus can be independently set by the technician according to actual needs or practical experience, and the present invention does not limit this. For example, the following formula can be used to determine the reference random number:

[0045] C = (a*D+b)modm;

[0046] Among them, C represents the reference random number; a represents the multiplication constant; D represents the random number to be updated; b represents the addition constant; and m represents the modulus.

[0047] For example, if the number of random number characters is 2, the entropy sources in the entropy pool are entropy source A, entropy source B, entropy source C and entropy source D, where the storage order of entropy source A is 0, the storage order of entropy source B is 1; the storage order of entropy source C is 2; the storage order of entropy source D is 3, then entropy source A and entropy source B are taken out from the entropy pool; the set algorithm is used to generate a random number based on entropy source A and entropy source B.

[0048] Furthermore, after taking out at least one entropy source from the entropy pool, the method further includes: updating the storage order of the remaining entropy sources in the entropy pool according to the number of the entropy sources taken out.

[0049] It can be understood that by adopting the above technical solution, collecting at least one entropy source from the entropy pool according to the number of characters of the random number to be generated, the efficiency of generating random numbers can be improved; on the basis of improving the security and reliability of the entropy source in the entropy pool, generating random numbers according to the entropy source in the entropy pool can improve the security and reliability of the random numbers.

[0050] In an optional embodiment, if there is at least one free storage space in the entropy pool, the original entropy source can be stored in any free storage space, and the storage order of the original entropy source is determined according to the number of entropy sources in the entropy pool.

[0051] The embodiment of the present invention obtains a newly generated original entropy source; when there is no free storage space in the entropy pool, takes out the first entropy source with the earliest storage order from the entropy pool; fuses the first entropy source and the original entropy source to obtain a target entropy source; stores the target entropy source in the entropy pool, and updates the storage order of the entropy sources in the entropy pool. In the case where there is no free storage space in the entropy pool, the embodiment of the present invention fuses the first entropy source and the original entropy source to obtain the target entropy source. Compared with the technical solution of directly storing the generated entropy source directly in the entropy pool in the prior art, the complexity of the entropy source can be further improved on the basis of ensuring that the number of entropy sources remains unchanged, thereby improving the security and reliability of the entropy source.

[0052] Embodiment 2

[0053] Figure 2A A flowchart of a method for storing an entropy source provided in Embodiment 2 of the present invention is provided. Based on the technical solutions of the above embodiments, the embodiment of the present invention optimizes and improves the operation of obtaining the original entropy source.

[0054] Furthermore, "obtaining a newly generated original entropy source" is refined into "selecting data in the operating system running time as the first entropy source factor; selecting data in the number of CPU (Central Processing Unit) running cycles as the second entropy source factor; fusing the first entropy source factor and the second entropy source factor to obtain a fusion result; and determining the fusion result as the original entropy source" to improve the operation of obtaining the original entropy source.

[0055] It should be noted that, for the parts not described in detail in the embodiments of the present invention, reference may be made to the descriptions in the aforementioned embodiments.

[0056] See also Figure 2A The storage method of the entropy source shown includes:

[0057] S201, selecting data in the operating system running time as the first entropy source factor.

[0058] In this embodiment, the operating system running time may be the time elapsed since the operating system was started. The operating system may be an operating system of an electronic device that is deployed with the entropy source storage method provided in an embodiment of the present invention. Specifically, a certain algorithm may be adopted to select data from the operating system running time as the first entropy source factor.

[0059] S202: Select data in the number of CPU operation cycles as a second entropy source factor.

[0060] In this embodiment, the number of CPU operation cycles may refer to the number of clock cycles that the CPU has passed since it was powered on. The CPU may be a CPU in an electronic device that is equipped with the entropy source storage method provided by an embodiment of the present invention. Specifically, a certain algorithm may be used to select data from the number of CPU operation cycles as the first entropy source factor.

[0061] Optionally, selecting data in the operating system running time as the first entropy source factor includes: determining the data corresponding to the least significant bit of the operating system running time as the first entropy source factor; correspondingly, selecting data in the number of CPU operating cycles as the second entropy source factor includes: determining the data corresponding to the least significant bit of the number of CPU operating cycles as the first entropy source factor.

[0062] It can be understood that by adopting the above technical solution, the data that changes most frequently in the operating system running time and the data that changes most frequently in the number of CPU running cycles can be used as the first entropy source factor and the second entropy source factor, respectively, to improve the randomness and reliability of the first entropy source factor and the second entropy source factor, thereby improving the security and reliability of the original entropy source determined according to the first entropy source factor and the second entropy source factor.

[0063] S203: Fuse the first entropy source factor and the second entropy source factor to obtain a fusion result.

[0064] Specifically, a certain algorithm is used to fuse the first entropy source factor and the second entropy source factor to obtain a fusion result. Optionally, the first entropy source factor and the second entropy source factor are fused to obtain a fusion result, including: converting the first entropy source factor into a binary format to obtain a first conversion factor; converting the second entropy source factor into a binary format to obtain a second conversion factor; performing an XOR operation on the first conversion factor and the second conversion factor to obtain a fusion result.

[0065] It can be understood that by adopting the above technical solution, the first entropy source factor and the second entropy source factor are respectively converted into binary format for XOR operation to obtain a fusion result, which improves the security of the fusion result and further improves the security of the original entropy source.

[0066] S204: Determine the fusion result as the original entropy source.

[0067] S205: When there is no free storage space in the entropy pool, take out the first entropy source with the earliest storage order from the entropy pool.

[0068] S206: Fusing the first entropy source and the original entropy source to obtain a target entropy source.

[0069] Optionally, the first entropy source and the original entropy source are merged to obtain a target entropy source, including: converting the first entropy source into a binary format to obtain a first converted entropy source; converting the original entropy source into a binary format to obtain a second converted entropy source; performing an XOR operation on the first converted entropy source and the second converted entropy source to obtain the target entropy source.

[0070] It can be understood that by adopting the above technical solution, the first entropy source and the original entropy source are converted into binary format for XOR operation to obtain the target entropy source, which can increase the complexity of the target entropy source, thereby improving the reliability and security of the target entropy source, and then improving the security and reliability of the random numbers generated according to the entropy source.

[0071] S207: Store the target entropy source in the entropy pool, and update the storage order of the entropy sources in the entropy pool.

[0072] Optional, Figure 2B It is a schematic diagram of the entropy source storage process. The entropy pool includes entropy source a, entropy source b, entropy source c, ..., entropy source n; the storage order of entropy source a is 0, the storage order of entropy source b is 1, the storage order of entropy source c is 2, ..., and the storage order of entropy source x is n. Figure 2BAs shown, the first entropy source factor and the second entropy source factor are XORed to obtain the original entropy source. If there is no free storage space in the entropy pool, the first entropy source, i.e., entropy source a, is taken out from the entropy pool; entropy source a is merged with the original entropy source to obtain the target entropy source; the target entropy source is stored in the entropy pool; the storage order of entropy source b in the entropy pool is updated to 0, the storage order of entropy source c is updated to 1, ..., the storage order of entropy source x is updated to n-1, and the storage order of the target entropy source is determined to be n.

[0073] In an optional embodiment, the number of entropy sources in the entropy pool can also be counted at set intervals; if the number of entropy sources in the entropy pool is greater than or equal to the set number, a set randomness detection algorithm, such as a binary sequence randomness detection algorithm, is used to perform randomness detection on each entropy source in the entropy pool; and entropy sources in the entropy pool that do not meet randomness are discarded. It should be noted that the set number can be set independently by technicians according to actual needs or practical experience, and the present invention is not limited to this.

[0074] The embodiment of the present invention selects data in the operating system running time as the first entropy source factor, and selects data in the number of CPU running cycles as the second entropy source factor; fuses the first entropy source factor and the second entropy source factor to obtain a fusion result; and determines the fusion result as the original entropy source. The technical solution of the embodiment of the present invention uses the data in the operating system running time and the data in the number of CPU running cycles that change continuously over time as the first entropy source factor and the second entropy source factor, respectively, and then fuses the two entropy source factors to obtain the original entropy source, thereby improving the complexity and randomness of the original entropy source, and thus ensuring the reliability of the original entropy source.

[0075] Embodiment 3

[0076] Figure 3 A schematic diagram of the structure of a storage device for an entropy source provided in Embodiment 3 of the present invention. This embodiment is applicable to the case where a generated entropy source is stored, the device can execute the storage method of the entropy source, the storage device for the entropy source can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device, such as a server.

[0077] See also Figure 3 The entropy source storage device shown includes an entropy source acquisition module 301, an entropy source extraction module 302, an entropy source fusion module 303 and an entropy source storage module 304, wherein:

[0078] An entropy source acquisition module 301 is used to acquire a newly generated original entropy source;

[0079] The entropy source extraction module 302 is used to extract the first entropy source with the earliest storage order from the entropy pool when there is no free storage space in the entropy pool;

[0080] An entropy source fusion module 303 is used to fuse the first entropy source and the original entropy source to obtain a target entropy source;

[0081] The entropy source storage module 304 is used to store the target entropy source in the entropy pool and update the storage order of the entropy sources in the entropy pool.

[0082] The embodiment of the present invention obtains a newly generated original entropy source through an entropy source acquisition module; when there is no free storage space in the entropy pool, the first entropy source with the earliest storage order is taken out from the entropy pool through the entropy source extraction module; the first entropy source and the original entropy source are fused through the entropy source fusion module to obtain a target entropy source; the target entropy source is stored in the entropy pool through the entropy source storage module, and the storage order of the entropy source in the entropy pool is updated. In the case where there is no free storage space in the entropy pool, the embodiment of the present invention fuses the first entropy source and the original entropy source to obtain the target entropy source. Compared with the technical solution of directly storing the generated entropy source directly in the entropy pool in the prior art, the complexity of the entropy source can be further improved on the basis of ensuring that the number of entropy sources remains unchanged, thereby improving the security and reliability of the entropy source.

[0083] Optionally, the entropy source acquisition module 301 includes:

[0084] A factor determination unit, used to select data in the operating system running time as a first entropy source factor, and select data in the CPU running cycle number as a second entropy source factor;

[0085] A factor fusion unit, used for fusing the first entropy source factor and the second entropy source factor to obtain a fusion result;

[0086] The original entropy source determining unit is used to determine the fusion result as the original entropy source.

[0087] Optional, factor fusion unit, including:

[0088] A first factor determination subunit, configured to convert the first entropy source factor into a binary format to obtain a first conversion factor;

[0089] A second factor determination subunit, used to convert the second entropy source factor into a binary format to obtain a second conversion factor;

[0090] The operator unit is used to perform an XOR operation on the first conversion factor and the second conversion factor to obtain a fusion result.

[0091] Optionally, the first factor determination unit includes:

[0092] A first factor determination subunit, used to determine the data corresponding to the least significant bit of the operating system running time as a first entropy source factor;

[0093] Accordingly, the second factor determines the subunit, including:

[0094] The second factor determination subunit is used to determine the data corresponding to the least significant bit of the number of CPU operation cycles as the first entropy source factor.

[0095] Optionally, a factor determination unit includes:

[0096] The factor determination subunit is used to select data in the operating system running time as the first entropy source factor and select data in the CPU running cycle number as the second entropy source factor if an interrupt event of the operating system is monitored.

[0097] Optionally, the entropy source fusion module 303 includes:

[0098] A first conversion unit, used for converting the first entropy source into a binary format to obtain a first converted entropy source;

[0099] A second conversion unit, configured to convert the original entropy source into a binary format to obtain a second converted entropy source;

[0100] The entropy source fusion unit is used to perform an XOR operation on the first conversion entropy source and the second conversion entropy source to obtain a target entropy source.

[0101] Optionally, the device further comprises:

[0102] A character number acquisition module, used to obtain the number of characters of the random number to be generated in response to a request for generating a random number;

[0103] An entropy source extraction module, used for extracting at least one entropy source from the entropy pool according to the number of characters and the storage order of the entropy sources in the entropy pool;

[0104] The random number generation module is used to generate random numbers according to various entropy sources taken from the entropy pool.

[0105] The storage device of the entropy source provided in the embodiment of the present invention can execute the storage method of the entropy source provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the storage method of the entropy source.

[0106] Embodiment 4

[0107] Figure 4A schematic diagram of the structure of an electronic device 400 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0108] like Figure 4 As shown, the electronic device 400 includes at least one processor 401, and a memory connected to the at least one processor 401 in communication, such as a read-only memory (ROM) 402, a random access memory (RAM) 403, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 401 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 402 or the computer program loaded from the storage unit 408 to the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0109] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0110] Processor 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 401 performs the various methods and processes described above, such as a storage method of an entropy source.

[0111] In some embodiments, the storage method of the entropy source may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the processor 401, one or more steps of the storage method of the entropy source described above may be performed. Alternatively, in other embodiments, the processor 401 may be configured to perform the storage method of the entropy source in any other appropriate manner (e.g., by means of firmware).

[0112] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0113] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or a storage device of other programmable entropy sources, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0114] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0115] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0116] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0117] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS (Virtual Private Server) services.

[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for storing an entropy source, It is characterized in that The method comprises: Get the newly generated raw entropy source; When there is no free storage space in the entropy pool, taking out the first entropy source with the earliest storage order from the entropy pool; The first entropy source and the original entropy source are merged to obtain a target entropy source; The target entropy source is stored in the entropy pool, and the storage order of the entropy sources in the entropy pool is updated.

2. The method according to claim 1, It is characterized in that The obtaining of the newly generated original entropy source comprises: Selecting data in the operating system running time as the first entropy source factor, and selecting data in the number of CPU running cycles as the second entropy source factor; Fusing the first entropy source factor and the second entropy source factor to obtain a fusion result; The fusion result is determined as the original entropy source.

3. The method according to claim 2, It is characterized in that The fusing the first entropy source factor and the second entropy source factor to obtain a fusion result includes: Converting the first entropy source factor into a binary format to obtain a first conversion factor; Converting the second entropy source factor into a binary format to obtain a second conversion factor; An XOR operation is performed on the first conversion factor and the second conversion factor to obtain a fusion result.

4. The method according to claim 2, It is characterized in that The step of selecting data in the operating system running time as the first entropy source factor includes: Determine the data corresponding to the least significant bit of the operating system running time as a first entropy source factor; Correspondingly, the selecting of data in the number of CPU operation cycles as the second entropy source factor includes: The data corresponding to the least significant bit of the number of CPU operation cycles is determined as the first entropy source factor.

5. The method according to claim 2, It is characterized in that The step of selecting data in the operating system running time as the first entropy source factor and selecting data in the number of CPU running cycles as the second entropy source factor includes: If an interrupt event of the operating system is monitored, data in the operating system running time is selected as the first entropy source factor, and data in the number of CPU running cycles is selected as the second entropy source factor.

6. The method according to any one of claims 1 to 5, It is characterized in that The step of fusing the first entropy source and the original entropy source to obtain a target entropy source includes: Converting the first entropy source into a binary format to obtain a first converted entropy source; Converting the original entropy source into a binary format to obtain a second converted entropy source; An XOR operation is performed on the first conversion entropy source and the second conversion entropy source to obtain a target entropy source.

7. The method according to claim 1, It is characterized in that The method further comprises: In response to a request for generating a random number, obtaining the number of characters of the random number to be generated; Taking out at least one entropy source from the entropy pool according to the number of characters and the storage order of the entropy sources in the entropy pool; A random number is generated according to each entropy source taken from the entropy pool.

8. A method for storing an entropy source, It is characterized in that The method comprises: An entropy source acquisition module is used to obtain a newly generated original entropy source; An entropy source extraction module, used for extracting the first entropy source with the earliest storage order from the entropy pool when there is no free storage space in the entropy pool; An entropy source fusion module, used for fusing the first entropy source and the original entropy source to obtain a target entropy source; The entropy source storage module is used to store the target entropy source in the entropy pool and update the storage order of the entropy sources in the entropy pool.

9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method for storing an entropy source according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the storage method of the entropy source according to any one of claims 1 to 7 when executed.