Random number generator, encryption/decryption secret key generator and method based on characteristics of memory cells

A method for generating a random number, applied in a random number generator coupled to a flash memory is disclosed. the method comprises: selecting a plurality of cells from the flash memory; initializing the selecting cells of the flash memory; programming the selecting cells to obtain a plurality of first potential values of the selecting cells; re-initializing the selecting cells of the flash memory; re-programming the selecting cells to obtain a plurality of second potential values of the selecting cells; and processing the first potential values and the second potential values according to a predetermined algorithm to generating the random number.

BACKGROUND

Technical Field

The present invention relates to a data storage device, and in particular, to an access method of a flash memory.

The present invention relates to a random number generator, and in particular, to the random number generator based on characteristics of memory cells.

Related Art

Data digitization is the current trend, and digital data can be permanently stored. Once digitalized, an important issue that has been identified is “data security.” Conventional data encryption methods, such as HASH, SHA (Secure Hash Algorithm), SSL (Secure Socket Layer), WPA (Wi-Fi Protected Access), etc., are widely used in different fields. In the standard encryption program, the encryption and decryption method is easier to crack. Therefore, it is necessary to cooperate with the random number to increase the complexity and improve the security of the data.

As mentioned above, in order to provide a random number to improve data security, a True Random Number Generator (e.g., pseudo-random number generator) is required, which uses a constantly changing environment to generate different environmental variables. However, the complexity of the random number generated by the existing real random number generator is insufficient, and even if the above random number is used, the digitalized data is still cracked.

SUMMARY

In an embodiment, a method for generating a random number, applied in a random number generator coupled to a flash memory is disclosed. the method comprises: selecting a plurality of cells from the flash memory; initializing the selecting cells of the flash memory; programming the selecting cells to obtain a plurality of first potential values of the selecting cells; re-initializing the selecting cells of the flash memory; re-programing the selecting cells to obtain a plurality of second potential values of the selecting cells; and processing the first potential values and the second potential values according to a predetermined algorithm to generating the random number.

In an embodiment, an apparatus for generating a random number is disclosed. The apparatus includes: a circuit coupled to a flash memory and configured to select a plurality of cells from the flash memory; initialize the selecting cells of the flash memory; program the selecting cells to obtain a plurality of first potential values of the selecting cells; re-initialize the selecting cells of the flash memory; re-program the selecting cells to obtain a plurality of second potential values of the selecting cells; and process the first potential values and the second potential values according to a predetermined algorithm to generating the random number, wherein at least one of the first and the second potential values is different, and each of the first and the second potential values corresponds to a characteristic of each selected cell in the flash memory.

After referring to the following embodiments, those having ordinary knowledge in the technical field of the present invention can easily understand the basic spirit and other object of the present invention, as well as the technical means and implementation manners used in the present invention.

The various features and elements in the figures are not drawn to scale, and are in the form of the preferred embodiments. In addition, similar elements/components are referred to by the same or similar element symbols throughout the different drawings.

DETAILED DESCRIPTION

The term “couple” or “connect” used in this specification may mean that two or more components are mutually directly used as entities or in electrical contact, or are mutually indirectly used as entities or in electrical contact. The term “couple” or “connect” may also mean that two or more components mutually operate or act.

Unless otherwise defined in this specification, the meaning of the scientific and technical terms used herein is the same as that of ordinary skill in the art to which the invention pertains. In addition, the singular noun used in this specification covers the plural of the noun in the case of no conflict with the context; the plural noun of the noun is also included in the plural noun used.

FIG. 1is a schematic diagram showing an array of Flash memory according to an embodiment of the present invention. As shown, the flash memory100(e.g., NAND Memory) includes a plurality of memory cells M11˜Mxy, both of which are positive integers. To illustrate how to use the physical characteristics of the flash memory100to generate a random number, please refer toFIG. 2, which is a flowchart of a random number generation method200according to an embodiment of the present invention.

First, please refer toFIG. 2, the random number generation method200includes the following steps:

STEP210: selecting at least one of a plurality of blocks in the flash memory;

STEP220: Initializing the at least one block110of the flash memory;

STEP230: programming the block of the flash memory to obtain a plurality of first potential values of the plurality of cells in the block; wherein the first potential values are temporarily stored in a first table;

STEP240: Re-initializing the block of the flash memory;

STEP250: re-programming the blocks of the flash memory to obtain a plurality of second potential values of the same cells in the block; lock; wherein the second potential values are temporarily stored in a second table;

STEP260: calculating (e.g., subtracting, adding . . . etc.) the first potential values of the cells from the second potential values of the cells to obtain a calculated (e.g., difference, added) table;

STEP270: Reading the plurality of difference values from the calculated table according to a predetermined order as the random number. In STEP270further includes obtaining an encryption/decryption key according to the random number. In an embodiment, the above steps are implemented by a memory controller that can access the flash memory.

Please refer toFIG. 1andFIG. 2together for explanation. In STEP210, the block110of the flash memory100is selected. However, the present invention is not limited to the one shown inFIG. 1, which is merely used to illustrate one of the implementations of the present invention. In other embodiments, other portions of the flash memory100may also be selected as blocks, such as selecting the lower left corner portion, the upper right corner portion, the lower right corner portion, the middle portion of the flash memory100, or a remaining appropriate portions, as such, when the different parts of the flash memory100are selected as the above block, the complexity of the subsequent encryption and decryption keys is further enhanced. In other embodiment, the block110of the flash memory100is selected based on the results of the pre-test in the flash memory100.

In STEP220, please refer toFIG. 3for explanation.FIG. 3is a Schematic diagram of block110in the flash memory100as shown inFIG. 1according to an embodiment of the present invention. As shown, the block110of the flash memory100includes a plurality of memory cells M11˜Mnm, and n and in are positive integers. As shown in STEP220, the block110of the flash memory100is initialized. For example, the initialization in STEP220may be performed by erasing the data of the cells M11to Mnmin the block110of the flash memory100.

Next, please refer to STEP230andFIG. 4for explanation.FIG. 4is a schematic diagram showing a first program operation in the block of the Flash memory as shown inFIG. 3according to an embodiment of the present invention. As shown in STEP230, the block110of the flash memory100is programmed to obtain a plurality of first potential values of the cells M11to Mnm in the block110. For example, the above programing operation may be to write (or provide) a high potential to the memory cells M11to Mnm in the block110of the flash memory100. Please refer toFIG. 4, which shows the potential value of stored in the memory cells M11˜Mnm in a dot matrix, wherein the denser the dot matrix, the higher the potential value. It should be noted that due to slight differences in materials, processes, etc., in general, the characteristics of each memory cell M11˜Mnm will be different, so even if the same high potential is applied to the memory cells M11˜Mnm, the potential values (that is, the number of electric charge) which are stored in the memory cells M11˜Mnm are still different.

Referring to STEP240, the block110of the flash memory100is re-initialized, for example, data in the memory cells M11˜Mnmin the block110of the flash memory100are re-erased/re-erased. Then, STEP250is performed.FIG. 5illustrates a second program operation in the block110of the flash memory100as shown inFIG. 3according to an embodiment of the present invention. As shown in STEP250, the block110of the flash memory100is re-/re-programmed to obtain a plurality of second potential values of the memory cells M11-Mnmin the block110. For example, the above second program operation may be to write a high potential to the memory cells M11to Mnmin the block110of the flash memory100. As shown inFIG. 5, after the high potential is written, the second potential values of the memory cells M11to Mnmare different in STEP250. The first potential values (in STEP230) and the second potential values (in STEP250) of the memory cells M11to Mnmare different.

In STEP260, the first potential values of the cells from the second potential values of the cells are calculated to obtain a calculated table. In an embodiment, the first potential values of the memory cells M11-Mnmare correspondingly subtracted from the second potentials to obtain a difference table. For example, the first potential values of the memory cells M11to Mnmshown inFIG. 4are subtracted from the second potential values of the corresponding memory cells M11to MnminFIG. 5to obtain the difference table300shown inFIG. 6. In detail, by subtracting the second potential values of the corresponding memory cell M11ofFIG. 5from the first potential values of the memory cell M11ofFIG. 4, the difference value D11shown inFIG. 6is obtained, and the remaining memory cells can also be used in the above manner to obtain the difference value. If all the difference values of cells M11to Mnmare gathered, the difference table300shown inFIG. 6can be obtained. It should be noted that not all memory cells will exhibit different potential value when they are programmed twice, such as memory cell M12, which has the same potential value after two programmed, so there is no difference value D12(there is no difference value, which is indicated here in white, but the embodiment ofFIG. 6is for illustration only, and is not limited to this invention).

Subsequently, in STEP270, reading the plurality of difference values in the difference table300in the predetermined order as the random number (or the encryption and decryption key). For example, if the difference value D11is 255 and the difference value D14is 127, the random number (or the encryption and decryption key) is 255127. However, this invention is not limited to this, and it only exemplarily illustrates one of the implementation methods of the present invention and is helpful for understanding. There are still many difference values in the difference table300. If these difference values are combined into the above-mentioned the random number or the encryption and decryption key. The complexity of the number (key) is very high, and it is safe for encryption and decryption.

In an embodiment, the matrix formed by the block110ofFIG. 3toFIG. 5or the matrix unit formed by one row and one column of the matrix formed by the difference value ofFIG. 6may be used as a basic unit. InFIG. 6, the difference value D12is a matrix unit, which occupies a basic unit of the matrix, and the difference value D13is also a matrix unit, which occupies a basic unit of the matrix. The encryption and decryption key in this embodiment can further increase the complexity according to the above situation. For example, except that the difference value D11is 255 and the difference value D14is 127, because the difference value D11and the difference value D14are separated by two basic units (such as D12, D13). Therefore, the encryption and decryption key can be formed by the combination of the difference value and the basic unit. In detail, the encryption and decryption key can be “the difference value D11, the basic unit2between the difference values (such as D12, D13) And the combination of the difference value D14”, that is, the encryption and decryption key can be 2552127. The difference table300has a number of difference values and basic units of the difference between the difference values. If the combination of these difference values and the basic unit is used as the above-mentioned random number and /or encryption/decryption key. The complexity of the number (or key) will be further improved, and the security of encryption and decryption is more secure.

In another embodiment, the predetermined order of the difference values in the read difference table described in STEP270may be: selectively reading the difference values corresponding to the same row of the matrix in the difference table300; selectively reading the difference values corresponding to the same column of the matrix in the difference table300; or selectively reading the difference values corresponding to any row and any column of the matrix of the difference table300and the read difference values are combined with the values of the basic units as the random number or the encryption and decryption key.

Referring toFIG. 6, the same column of the matrix is read as an example, which can read the difference value D11, the basic unit2(D12, D13), and the difference value D14. Therefore, the encryption and decryption key is 2552127. The same row of the matrix is read as an example, which can read the difference value D11, the basic unit1(D21), and the difference value D31. If the difference value D31is 268, the encryption and decryption key is 2551268. Taking any row and any column of the matrix in the reading order as an example, it can read the data on the oblique line of the difference table, such as reading the difference value D11, the basic unit1(D22), and the difference value D33, if the difference value D33is 525, at this time, the available encryption and decryption key is 2551515. Similarly, the invention is not limited to this case. The difference table300has a plurality of difference values and basic units spaced between the difference values. If the combination of the difference values and the basic unit is used as the encryption and decryption key, the encryption and decryption are performed. The complexity of the key can be further improved, and the security of encryption and decryption is more secure. In addition, the predetermined order of the difference values in the reading difference table described in STEP270is not limited to the above embodiment, and may be read at intervals between different difference values when reading, for example, a difference value having a difference For D11, D14, D16, D18, D19, the case can read the difference values D11, D16, D19at intervals, skip the difference values D14, D18, or the case can also read the even difference values D14, D18, or set any required reading order.

In another embodiment, a range may be set for the difference value, for example, the range of the difference value is set to 128 to 256. If the difference value not in the range is to be filtered out, the complexity of the encryption and decryption keys are further enhanced. For example, taking the same column in which the reading order is a matrix as an example, the difference value D11, the basic unit2(D12, D13), and the difference value D14can be read originally. However, the difference value D14is 127, which exceeds the range of the difference value. 128256, therefore, the difference value D14will not be read, but will continue to find the difference value of the remaining bits in the range of difference values in the same column. After the 500 basic units have passed, the difference value D1502is 152 (The above D1502is the first column and the 502th line). Then, after 50 basic units have passed, the difference value D1553is found to be 198 (the above D1553is the first column and the 553th line), then the combination of the above difference value and basic units is 25550015250198 as the encryption and decryption key, the detailed list is as follows:

In this way, when the complexity of the encryption and decryption key (the random number) can be increased again, the security of encryption and decryption is improved. It should be noted that the STEPs 3-6 may be performed by an electronic device or other suitable devices. For example, it can be executed by a central processing unit (CPU), a microprocessor (MCU), a controller, an Application-specific integrated circuit (ASIC) and/or other suitable components of the electronic device.

In conclusion, according to the technical content of the present invention, the random number or/and encryption/decryption key generation method shown in the embodiment of the present invention utilizes the difference value generated by the physical characteristics of the NAND memory to generate a random number or/and an encryption/decryption the key to enhance the complexity of the random number or/and the decryption key. In addition, embodiments of the present invention also use different read orders and/or different limit value ranges to filter out partial differences to increase the complexity of the random number or/and the encryption/decryption key generated in this embodiment of the present invention.