Key generation method and device, electronic equipment and readable storage medium
By using the differential information of channel characteristics in wireless communication for quantization operations, the problem of high key inconsistency rate in traditional key quantization algorithms is solved, and a lower key inconsistency rate and higher randomness and generation rate are achieved.
Patent Information
- Application Number
- CN202311099152.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In wireless communication scenarios, traditional key quantization algorithms have a high inconsistency rate of keys due to noise, multipath transmission and other reasons.
By obtaining the difference information of channel characteristics, quantizing operations are performed for each quantization unit to generate a key. This method does not need to divide the judgment interval, avoiding the problem of judgment errors.
The key inconsistency rate (KDR) is reduced, and the randomness and generation rate of keys are improved.
Smart Images

Figure CN119544192A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless security technology, and in particular to a key generation method, device, electronic device and readable storage medium. Background Art
[0002] The key generation technology in physical layer security is a technology that uses the short-term reciprocity of the communication channel to generate keys. In the time division duplex mode, the uplink and downlink signals experience similar environments in the channel. In the wireless scenario, the multipath transmission characteristics of the wireless channel are also spatially unique, rapidly time-varying, and unpredictable. Eavesdroppers cannot obtain channel characteristics related to legitimate communicators outside the coherent distance.
[0003] The traditional key quantization algorithm divides the equal value interval according to the maximum and minimum values of the channel characteristics, and quantizes the points falling into the interval into corresponding patterns. However, due to noise, multipath transmission, non-simultaneous sampling, and device fingerprints, the channel characteristics obtained by the communicating parties are not completely consistent. This makes the points at the edge of the decision interval very prone to errors, resulting in a high inconsistency rate (Key Disagreement Rate, KDR) of the generated key. Summary of the invention
[0004] Embodiments of the present invention provide a key generation method, device, electronic device and readable storage medium to solve the problem of high inconsistency rate of generated keys.
[0005] In a first aspect, an embodiment of the present invention provides a key generation method, comprising:
[0006] Acquire a channel feature, where the channel feature includes n quantization units, where n is a positive integer;
[0007] For each quantization unit of the n quantization units, obtaining a quantization value of each quantization unit based on the differential information of the channel characteristics;
[0008] A key is generated based on the quantized values of the n quantized units.
[0009] Optionally, the acquiring, for each of the n quantization units, a quantization value of each quantization unit based on the differential information of the channel characteristic includes:
[0010] Determine first-order difference information and second-order difference information of a target quantization unit, wherein the first-order difference information is used to characterize the magnitude relationship between a channel characteristic of the target quantization unit and a channel characteristic of an adjacent quantization unit, and the second-order difference information is used to characterize the magnitude relationship between the first-order difference information of the target quantization unit and the first-order difference information of an adjacent quantization unit, wherein the target quantization unit is any one of the n quantization units, and the adjacent quantization unit is a quantization unit adjacent to the target quantization unit among the n quantization units;
[0011] Performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit;
[0012] determining a quantization value of the target quantization unit based on at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit;
[0013] Among them, the first quantization value is determined based on the size relationship between the channel characteristics of the target quantization unit and the channel characteristics of the adjacent quantization unit, the second quantization value is determined based on the size relationship between the first-order difference information of the target quantization unit and the first-order preset threshold; the third quantization value is determined based on the size relationship between the second-order difference information of the target quantization unit and the second-order preset threshold.
[0014] Optionally, performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit includes:
[0015] Determine the quantification mode;
[0016] Based on the quantization mode, performing a quantization operation on the target quantization unit;
[0017] Among them, when the quantization mode is the first mode, the quantization operation includes any one of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the second mode, the quantization operation includes any two of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the third mode, the quantization operation includes the first quantization operation, the second quantization operation and the third quantization operation; the first quantization operation is used to obtain the first quantization value, the second quantization operation is used to obtain the second quantization value, and the third quantization operation is used to obtain the third quantization value.
[0018] Optionally, the first quantization operation includes:
[0019] When the channel characteristic of the i-th quantization unit is greater than the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be either 0 or 1; when the channel characteristic of the i-th quantization unit is less than or equal to the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be the other of 0 and 1, where i is an integer less than or equal to n;
[0020] The second quantization operation includes:
[0021] When the first-order difference information of the i-th quantization unit is greater than the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be either 0 or 1; when the first-order difference information of the i-th quantization unit is less than or equal to the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be the other of 0 and 1;
[0022] The third quantization operation comprises:
[0023] When the second-order difference information of the i-th quantization unit is greater than the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be either 0 or 1; when the second-order difference information of the i-th quantization unit is less than or equal to the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be the other of 0 and 1;
[0024] The target quantization unit is the i-th quantization unit, and the adjacent quantization unit is the i-1-th quantization unit.
[0025] Optionally, determining the quantization value of the target quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the target quantization unit includes:
[0026] determining an intermediate value of the i-th quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the i-th quantization unit;
[0027] Determine a target number of times, where the target number of times is the number of occurrences of the intermediate value in the quantization values of the first i-1 quantization units plus one;
[0028] When the target number is greater than a preset compensation threshold, a compensation operation is performed on the intermediate value to obtain a quantized value so that the number of occurrences of the quantized value in the quantized values of the first i quantization units is less than or equal to the preset compensation threshold.
[0029] Optionally, when the target number is greater than a preset compensation threshold, performing a compensation operation on the intermediate value to obtain a quantized value includes:
[0030] Determine a replacement quantization unit from the first i-1 quantization units, the quantization value of the replacement quantization unit is different from the intermediate value, and the number of occurrences of the quantization value of the target quantization unit in the quantization values of the first i-1 quantization units is less than the preset compensation threshold;
[0031] The intermediate value is replaced by the quantized value of the replacement quantization unit to obtain the quantized value of the i-th quantization unit.
[0032] Optionally, the first-order preset threshold is inversely proportional to n, and the first-order preset threshold is proportional to the sum of the first-order difference information of n quantization units; and / or,
[0033] The second-order preset threshold is inversely proportional to n, and the second-order preset threshold is proportional to the sum of the second-order difference information of the n quantization units.
[0034] Optionally, the preset compensation threshold is proportional to n, and the preset compensation threshold is inversely proportional to the quantization order;
[0035] Among them, when the quantization mode is the first mode, the quantization order is 1, when the quantization mode is the second mode, the quantization order is 2, and when the quantization mode is the third mode, the quantization order is 3.
[0036] In a second aspect, an embodiment of the present invention provides a key generation device, including:
[0037] A first acquisition module is used to acquire a channel feature, where the channel feature includes n quantization units, where n is a positive integer;
[0038] A second acquisition module, configured to acquire, for each of the n quantization units, a quantization value of each quantization unit based on the differential information of the channel characteristics;
[0039] A generating module is used to generate a key based on the quantization values of the n quantization units.
[0040] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a program stored in the memory and executable on the processor;
[0041] The processor is used to read the program in the memory to implement the steps in the method described in the first aspect.
[0042] In a first aspect, an embodiment of the present invention provides a readable storage medium for storing a program, wherein when the program is executed by a processor, the steps in the method described in the first aspect are implemented.
[0043] In the embodiment of the present application, a channel characteristic is obtained, and the channel characteristic includes n quantization units; for each of the n quantization units, a quantization value of each quantization unit is obtained based on differential information of the channel characteristic; and a key is generated based on the quantization value of the n quantization units. In the present embodiment, the quantization value is obtained based on the differential information of the channel characteristic, and there is no need to divide the decision interval, and there is no problem of decision error, so that the key KDR obtained by the present method is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0045] Figure 1 This is one of the flowcharts of the key generation method provided by an embodiment of the present invention;
[0046] Figure 2 is a schematic diagram of a flow chart of a compensation operation provided by an embodiment of the present invention;
[0047] Figure 3 This is a second flow chart of the key generation method provided by an embodiment of the present invention;
[0048] Figure 4 This is a third flow chart of the key generation method provided by an embodiment of the present invention;
[0049] Figure 5 This is a fourth flow chart of the key generation method provided by an embodiment of the present invention;
[0050] Figure 6 is a schematic diagram of the structure of a key generation device provided by an embodiment of the present invention;
[0051] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.
[0053] See also Figure 1 , Figure 1This is the process of the key generation method provided by the embodiment of the present invention. The key generation method provided by this application can generate keys by using the short-term reciprocity of the communication channel. The key generation method provided by the embodiment of the present invention can be used in wireless communication systems, wired communication systems, and optical fiber communication systems. In practical applications, both parties in communication can generate keys based on this method. Figure 1 As shown, the method specifically comprises the following steps:
[0054] Step 101: Acquire channel characteristics, where the channel characteristics include n quantization units, where n is a positive integer.
[0055] The channel characteristics can be obtained in advance through channel detection. The specific method can be found in the description of the relevant technology and will not be described here. When the communicating parties detect a frame of channel characteristics, a key can be generated based on the detected channel characteristics. Among them, the number of quantization units contained in a frame of channel characteristics is n, and each quantization unit is quantized separately.
[0056] Step 102: For each of the n quantization units, obtain a quantization value of each quantization unit based on the differential information of the channel characteristics.
[0057] For each of the n quantization units, a quantization value of the quantization unit is obtained based on differential information of the channel characteristics of the quantization unit, and the operation performed on each quantization unit is the same.
[0058] In a specific implementation, the differential information of the channel characteristics may be differential information obtained by performing first-order differential processing on the channel characteristics, differential information obtained by performing second-order differential processing on the channel characteristics, and / or differential information obtained by performing third-order or higher-order differential processing on the channel characteristics.
[0059] Optionally, in some embodiments, step 102 includes:
[0060] Determine first-order difference information and second-order difference information of a target quantization unit, wherein the first-order difference information is used to characterize the magnitude relationship between a channel characteristic of the target quantization unit and a channel characteristic of an adjacent quantization unit, and the second-order difference information is used to characterize the magnitude relationship between the first-order difference information of the target quantization unit and the first-order difference information of an adjacent quantization unit, wherein the target quantization unit is any one of the n quantization units, and the adjacent quantization unit is a quantization unit adjacent to the target quantization unit among the n quantization units;
[0061] Performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit;
[0062] determining a quantization value of the target quantization unit based on at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit;
[0063] Among them, the first quantization value is determined based on the size relationship between the channel characteristics of the target quantization unit and the channel characteristics of the adjacent quantization unit, the second quantization value is determined based on the size relationship between the first-order difference information of the target quantization unit and the first-order preset threshold; the third quantization value is determined based on the size relationship between the second-order difference information of the target quantization unit and the second-order preset threshold.
[0064] The target quantization unit is any one of the n quantization units, and the adjacent quantization unit is a quantization unit adjacent to the target quantization unit among the n quantization units. Exemplarily, when the target quantization unit is the jth quantization unit, the adjacent quantization unit may be the j-1th quantization unit or the j+1th quantization unit, where j is a positive integer less than or equal to n.
[0065] It should be noted that, when the target quantization unit is the jth quantization unit and the adjacent quantization unit is the j-1th quantization unit, the adjacent quantization unit of the first quantization unit is the nth quantization unit. When the target quantization unit is the jth quantization unit and the adjacent quantization unit is the j+1th quantization unit, the adjacent quantization unit of the nth quantization unit is the first quantization unit.
[0066] Exemplarily, the first-order differential information of the target quantization unit can be determined based on the difference between the channel characteristics of the target quantization unit and the channel characteristics of the adjacent quantization unit, and is used to characterize the increasing and decreasing trends of the channel characteristics of two adjacent quantization units, which can be analogized with the first-order derivative in mathematical concepts.
[0067] Exemplarily, the second-order differential information of the target quantization unit can be determined based on the difference between the first-order differential information of the target quantization unit and the first-order differential information of the adjacent quantization unit, and is used to characterize the change trend of the first-order differential information of two adjacent quantization units, which can be analogized with the second-order derivative in mathematical concepts.
[0068] When a quantization operation is performed on the target quantization unit and any one of the first quantization value, the second quantization value and the third quantization value is obtained, it is determined as the quantization value of the target quantization unit.
[0069] When a quantization operation is performed on the target quantization unit to obtain any two of the first quantization value, the second quantization value and the third quantization value, the two obtained values are concatenated to obtain the quantization value of the target quantization unit. The specific concatenation order is not limited here.
[0070] When a quantization operation is performed on the target quantization unit to obtain three of the first quantization value, the second quantization value and the third quantization value, the three values are concatenated to obtain the quantization value of the target quantization unit, and the concatenation order is not limited here.
[0071] Optionally, performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit includes:
[0072] Determine the quantification mode;
[0073] Based on the quantization mode, performing a quantization operation on the target quantization unit;
[0074] Among them, when the quantization mode is the first mode, the quantization operation includes any one of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the second mode, the quantization operation includes any two of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the third mode, the quantization operation includes the first quantization operation, the second quantization operation and the third quantization operation; the first quantization operation is used to obtain the first quantization value, the second quantization operation is used to obtain the second quantization value, and the third quantization operation is used to obtain the third quantization value.
[0075] The quantization mode includes a first mode, a second mode and a third mode. When the quantization mode is the first mode, any one of the first quantization operation, the second quantization operation and the third quantization operation is performed on the target quantization unit to obtain a corresponding one of the first quantization value, the second quantization value and the third quantization value. When the quantization mode is the second mode, any two of the first quantization operation, the second quantization operation and the third quantization operation are performed on the target quantization unit to obtain a corresponding two of the first quantization value, the second quantization value and the third quantization value. When the quantization mode is the third mode, the first quantization operation, the second quantization operation and the third quantization operation are performed on the target quantization unit to obtain a first quantization value, a second quantization value and a third quantization value.
[0076] Optionally, the first quantization operation includes:
[0077] When the channel characteristics of the i-th quantization unit are greater than the channel characteristics of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be either 0 or 1; when the channel characteristics of the i-th quantization unit are less than or equal to the channel characteristics of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be the other of 0 and 1, where i is an integer less than or equal to n.
[0078] The second quantization operation includes:
[0079] When the first-order difference information of the i-th quantization unit is greater than the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be either 0 or 1; when the first-order difference information of the i-th quantization unit is less than or equal to the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be the other of 0 and 1.
[0080] The third quantization operation comprises:
[0081] When the second-order difference information of the i-th quantization unit is greater than the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be either 0 or 1; when the second-order difference information of the i-th quantization unit is less than or equal to the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be the other of 0 and 1.
[0082] The target quantization unit is the i-th quantization unit, and the adjacent quantization unit is the i-1-th quantization unit.
[0083] It should be understood that the specific value of the first-order preset threshold is not limited here, and its specific value can be adaptively changed or adjusted according to the channel characteristics. Optionally, in some embodiments, the first-order preset threshold is inversely proportional to n, and the first-order preset threshold is proportional to the sum of the first-order difference information of the n quantization units.
[0084] Exemplarily, in some embodiments, the first-order preset threshold t1 satisfies:
[0085]
[0086] Among them, g(i) is the first-order difference information of the i-th quantization unit, and n is the total number of quantization units.
[0087] It should be understood that the specific value of the second-order preset threshold is not limited here, and its specific value can be adaptively changed or adjusted according to the channel characteristics. Optionally, in some embodiments, the second-order preset threshold is inversely proportional to n, and the second-order preset threshold is proportional to the sum of the second-order difference information of the n quantization units.
[0088] Exemplarily, in some embodiments, the second-order preset threshold t2 satisfies:
[0089]
[0090] Among them, h(i) is the second-order difference information of the i-th quantization unit, and n is the total number of quantization units.
[0091] In this embodiment, the quantization mode is first determined, and then the quantization operation is performed on the target quantization unit based on the quantization mode. Through the above method, the process of the quantization operation can be simplified, and only the required operation is performed, thereby improving the efficiency of the quantization operation. The first quantization value obtained by the above method is 0 or 1, the second quantization value is 0 or 1, and the third quantization value is 0 or 1.
[0092] Of course, in some embodiments, the first quantization operation, the second quantization operation and the third quantization operation may be performed first to obtain the first quantization value, the second quantization value and the third quantization value, and then the required data may be determined from the first quantization value, the second quantization value and the third quantization value according to the quantization mode.
[0093] Exemplarily, when the quantization mode is the first mode, any one is selected from the first quantization value, the second quantization value, and the third quantization value. When the quantization mode is the second mode, any two are selected from the first quantization value, the second quantization value, and the third quantization value. When the quantization mode is the second mode, the first quantization value, the second quantization value, and the third quantization value are directly used.
[0094] Optionally, see Figure 2 , the determining the quantization value of the target quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the target quantization unit comprises:
[0095] determining an intermediate value of the i-th quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the i-th quantization unit;
[0096] Determine a target number of times, where the target number of times is the number of occurrences of the intermediate value in the quantization values of the first i-1 quantization units plus one;
[0097] When the target number is greater than a preset compensation threshold, a compensation operation is performed on the intermediate value to obtain a quantized value so that the number of occurrences of the quantized value in the quantized values of the first i quantization units is less than or equal to the preset compensation threshold.
[0098] In this embodiment, the quantization operation is performed on n quantization units in sequence. When the quantization operation is performed on the i-th quantization unit, the quantization operation is performed on the first i-1 quantization units to obtain the quantization values of the first i-1 quantization units.
[0099] A quantization operation is performed on the i-th quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the i-th quantization unit, and an intermediate value of the i-th quantization unit is obtained based on at least one of the first quantization value, the second quantization value, and the third quantization value of the i-th quantization unit.
[0100] It should be understood that, since the first quantization value, the second quantization value, and the third quantization value are all 0 or 1, the possible combinations of 0 and 1 in different quantization modes can be determined, so the quantization value can only appear in the preset value. For example, when the quantization mode is the first mode, the preset value includes 0 and 1. When the quantization mode is the second mode, the preset value includes 00, 01, 10, and 11. When the quantization mode is the third mode, the preset value includes 000, 001, 010, 011, 101, 100, 110, and 111.
[0101] Therefore, after obtaining the intermediate value of the i-th quantization unit, the number of occurrences of the intermediate value in the quantization values of the first i-1 quantization units can be determined, and 1 is added to the number to obtain the target number. When the target number is greater than the preset compensation threshold, the compensation operation is performed on the intermediate value to obtain the quantization value, so as to avoid excessive occurrence of a preset value.
[0102] In this embodiment, when the target number is greater than the preset compensation threshold, a compensation operation is performed on the intermediate value to obtain a quantized value. Through the above method, the number of occurrences of each preset value in the quantized values of the first i quantized units can be made less than the preset compensation threshold, thereby avoiding excessive occurrences of a preset value. By performing the compensation operation, the balance of 0 and 1 in the final key can be improved, and high randomness can be achieved while ensuring a low KDR.
[0103] The specific method of performing the compensation operation on the intermediate value to obtain the quantized value is not limited here, as long as the number of occurrences of each preset value can be made less than the preset compensation threshold after the compensation operation is performed.
[0104] It should be noted that performing a compensation operation on the intermediate value is to select a replacement value from other preset values to replace the current intermediate value. After the replacement, the number of occurrences of each preset value in the quantization values of the first i quantization units is less than or equal to the preset compensation threshold.
[0105] Exemplarily, when the quantization mode is the second mode, the preset values include 00, 01, 10, and 11. Assuming that the current intermediate value is 01, and the number of quantization units with quantization values of 01 in the first i-1 quantization units is X, and X+1 is greater than the preset compensation threshold, at this time, a compensation operation is performed on the intermediate value, and a replacement value is selected from 00, 10, and 11 to replace the intermediate value. After the replacement, the number of quantization units with quantization values of 00, 01, 10, and 11 in the first i quantization units is less than or equal to the preset compensation threshold.
[0106] It should be understood that the specific manner of selecting the replacement value is not limited herein. Optionally, in some embodiments, when the target number is greater than the preset compensation threshold, performing a compensation operation on the intermediate value to obtain a quantization value includes:
[0107] Determining a replacement quantization unit from the previous i - 1 quantization units, where the quantization value of the replacement quantization unit is different from the intermediate value, and the occurrence times of the quantization value of the target quantization unit among the quantization values of the previous i - 1 quantization units is less than the preset compensation threshold;
[0108] Using the quantization value of the replacement quantization unit to replace the intermediate value to obtain the quantization value of the i-th quantization unit.
[0109] In this embodiment, the quantization value of the replacement quantization unit is the replacement value. For the convenience of description, the intermediate value of the i-th quantization unit is denoted as m, the decimal size of the intermediate value of the i-th quantization unit is denoted as d m , the target number is denoted as k m , and the preset compensation threshold is denoted as t. The following takes the quantization mode as the third mode as an example for illustration.
[0110] Arranging the quantization values of the previous i - 1 quantization units and the intermediate value together in ascending order according to their corresponding decimal values. Exemplarily, the arranged queue is as follows: 000, 001, 010, 011, 100, 101, 110, 111.
[0111] As an alternative implementation manner, a one-way difference compensation scheme is adopted. Specifically, starting from m, traversing the queue cyclically to the left or right to find the first preset value whose occurrence times in the queue do not exceed t, that is, the first quantization value m a satisfying k a <t, where k a is the occurrence times of m a in the queue. For example, starting from m and traversing the queue cyclically to the right, determining whether there is an m a satisfying k a <t on the right side of m. If not, continue searching from 000 until m a is found, and using m a to replace m, that is, the quantization value of the i-th quantization unit becomes m a . At the same time, update k m and k a to ensure that both k m and k a are less than t.
[0112] As another alternative implementation, a bidirectional differential compensation scheme is adopted. Specifically, starting from m, traverse the queue to the left and right respectively, and find the first quantization value that appears no more than t times in the queue. The first quantization value satisfying k b <t on the left is denoted as m b , where k b is the number of times m b appears in the queue. The first quantization value satisfying k c <t on the right is denoted as m c , where k c is the number of times m c appears in the queue.
[0113] In the case where only m b or m c is found, replace m with m b or m c . In the case where both m b and m c are found, either one of m b and m c can be selected to replace m, or the distances between m b and m c to m can be calculated respectively.
[0114] Define l b and l c as the distances between m b and m c and m respectively, with the initial value being 2 r . If m b is found, then update l b to d m -d b ; if m c is found, then update l c to d c -d m . Compare the magnitudes of l b and l c , select the one with the smaller distance as the replacement value, denoted as m j , update k m and k j , and replace m with m j .
[0115] In this embodiment, since the queue is arranged according to the corresponding decimal values, the distance between any two values in the queue is the absolute value of the difference between their decimal values. Assume that d i and d j are the decimal values corresponding to any two values in the queue, then the distance d ij between these two values satisfies:
[0116] d ij =|d i -d j |.
[0117] Of course, in actual application, the quantized values and the intermediate values of the first i-1 quantized units can be arranged based on other rules, and the method for determining the distance between any two values can also be adaptively adjusted. For example, the distance between any two values can be determined based on the number of values between the two values.
[0118] In this embodiment, a replacement quantization unit is determined from the first i-1 quantization units, the quantization value of the replacement quantization unit is different from the intermediate value, and the number of occurrences of the quantization value of the target quantization unit in the quantization values of the first i-1 quantization units is less than a preset compensation threshold; the quantization value of the replacement quantization unit is used to replace the intermediate value to obtain the quantization value of the i-th quantization unit. Through the above method, the compensation operation process is more standardized, which is convenient for determining the replacement quantization unit, and at the same time, the balance and randomness of the distribution of 0 and 1 in the first i quantization units after replacement are improved.
[0119] Optionally, in some embodiments, the preset compensation threshold is proportional to n, and the preset compensation threshold is inversely proportional to the quantization order;
[0120] Among them, when the quantization mode is the first mode, the quantization order is 1, when the quantization mode is the second mode, the quantization order is 2, and when the quantization mode is the third mode, the quantization order is 3.
[0121] Exemplarily, in some embodiments, the preset compensation threshold t satisfies:
[0122]
[0123] Wherein, r is the quantization order, and n is the total number of quantization units. If the communication environment is bad, the accumulation of error bits caused by the compensation operation will increase the key inconsistency rate, and you can choose to increase the preset compensation threshold to reduce the key inconsistency rate. Specifically, you can choose to adopt a unidirectional differential compensation scheme that increases the preset compensation threshold, or a bidirectional differential compensation scheme that increases the preset compensation threshold.
[0124] Step 103: Generate a key based on the quantization values of the n quantization units.
[0125] The quantization value of each quantization unit is obtained respectively, and the quantization values of n quantization units are spliced together according to a preset rule to generate a key. For example, the quantization values of n quantization units are spliced together in the order of arrangement of the n quantization units to obtain the key.
[0126] In the embodiment of the present application, a channel characteristic is obtained, and the channel characteristic includes n quantization units; for each of the n quantization units, a quantization value of each quantization unit is obtained based on differential information of the channel characteristic; and a key is generated based on the quantization value of the n quantization units. In the present embodiment, the quantization value is obtained based on the differential information of the channel characteristic, and there is no need to divide the decision interval, and there is no problem of decision error, so that the key KDR obtained by the present method is reduced.
[0127] See also Figure 3 For ease of understanding, a specific embodiment is used as an example for explanation below.
[0128] Step 1: Perform differential quantization on the channel characteristics. The differential quantization process can be found in Figure 4 , as follows:
[0129] When the communicating parties detect the channel characteristics of a frame, they perform quantization operations on n quantization units in sequence, where the channel characteristics of the i-th quantization unit are f(i), and the channel characteristics of the i-1-th quantization unit are f(i-1), i is a positive integer less than or equal to n, and when i=1, the i-1-th quantization unit is the n-th quantization unit.
[0130] Calculate the first-order preset threshold t1, the second-order difference threshold t2, the preset compensation threshold t, and the first-order difference information g(i) and the second-order difference information h(i) corresponding to the i-th quantization unit. Assume that the quantization order is r, the first quantization value is K1, the second quantization value is K2, and the third quantization value is K3. The specific calculation method of each parameter is as follows:
[0131] g(i)=f(i)-f(i-1);
[0132] h(i)=||g(i)|-|g(i-1)||;
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139] Among them, the first-order differential information g(i) represents the changing trend of the adjacent channel characteristics, which can be compared with the first-order derivative in mathematical concepts; the second-order differential information h(i) represents the changing trend of g(i), which can be compared with the second-order derivative in mathematical concepts. t1 and t2 can change adaptively according to the channel characteristics. t is used to determine whether compensation operation needs to be performed.
[0140] Taking r=3 as an example, three bits are obtained by quantization through K1, K2 and K3 respectively, and the three bits are concatenated to obtain the intermediate value m=K1K2K3. Of course, the concatenation order can be adjusted according to the settings.
[0141] Step 2: Real-time count of the number of occurrences of each preset value to determine whether compensation needs to be performed on the currently obtained intermediate value. The specific steps are as follows:
[0142] In the case of r=3, the number of preset values is 8, and the intermediate value is one of the 8 preset values. According to m, the number of times k that the preset value corresponding to m appears in the quantization value of the first i quantization units is queried. m , update k m k m =k m +1. If k m >t, proceed to Step 3, otherwise directly output m as the quantized value of the i-th quantization unit.
[0143] Step 3, if Figure 5 As shown, a compensation operation is performed on the intermediate value, a replacement value is found, and the intermediate value is replaced with the replacement value to obtain the quantization value of the i-th quantization unit, and the number of occurrences of each preset value is updated in real time. The compensation operation can adopt the aforementioned unidirectional differential compensation scheme or bidirectional differential compensation scheme. For details, please refer to the aforementioned content and will not be repeated here.
[0144] In this embodiment, quantization is performed based on differential information of channel characteristics, and the obtained key KDR is low, randomness is high, and the key generation rate (KGR) is high. At the same time, the adaptive differential quantization method in the present invention is fast, does not require global channel characteristic information, and can support pipeline real-time processing scenarios. Furthermore, by executing a differential compensation scheme, it is possible to avoid a certain preset value from appearing too many times, thereby improving the randomness of the key.
[0145] like Figure 6 As shown, the embodiment of the present invention further provides a file storage device 600, including:
[0146] A first acquisition module 601 is used to acquire a channel feature, where the channel feature includes n quantization units, where n is a positive integer;
[0147] A second acquisition module 602 is configured to acquire, for each of the n quantization units, a quantization value of each quantization unit based on the differential information of the channel characteristics;
[0148] The generating module 603 is configured to generate a key based on the quantized values of the n quantized units.
[0149] Optionally, the second acquisition module 602 includes:
[0150] A determination unit, used to determine first-order difference information and second-order difference information of a target quantization unit, wherein the first-order difference information is used to characterize the magnitude relationship between a channel characteristic of the target quantization unit and a channel characteristic of an adjacent quantization unit, and the second-order difference information is used to characterize the magnitude relationship between the first-order difference information of the target quantization unit and the first-order difference information of an adjacent quantization unit, wherein the target quantization unit is any one of the n quantization units, and the adjacent quantization unit is a quantization unit adjacent to the target quantization unit among the n quantization units;
[0151] an execution unit, configured to perform a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit;
[0152] a determining unit, configured to determine a quantization value of the target quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the target quantization unit;
[0153] Among them, the first quantization value is determined based on the size relationship between the channel characteristics of the target quantization unit and the channel characteristics of the adjacent quantization unit, the second quantization value is determined based on the size relationship between the first-order difference information of the target quantization unit and the first-order preset threshold; the third quantization value is determined based on the size relationship between the second-order difference information of the target quantization unit and the second-order preset threshold.
[0154] Optionally, the execution unit includes:
[0155] A first determining subunit, used to determine a quantization mode;
[0156] A first execution subunit, configured to perform a quantization operation on the target quantization unit based on the quantization mode;
[0157] Among them, when the quantization mode is the first mode, the quantization operation includes any one of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the second mode, the quantization operation includes any two of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the third mode, the quantization operation includes the first quantization operation, the second quantization operation and the third quantization operation; the first quantization operation is used to obtain the first quantization value, the second quantization operation is used to obtain the second quantization value, and the third quantization operation is used to obtain the third quantization value.
[0158] Optionally, the first quantization operation includes:
[0159] When the channel characteristic of the i-th quantization unit is greater than the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be either 0 or 1; when the channel characteristic of the i-th quantization unit is less than or equal to the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be the other of 0 and 1, where i is an integer less than or equal to n;
[0160] The second quantization operation includes:
[0161] When the first-order difference information of the i-th quantization unit is greater than the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be either 0 or 1; when the first-order difference information of the i-th quantization unit is less than or equal to the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be the other of 0 and 1;
[0162] The third quantization operation comprises:
[0163] When the second-order difference information of the i-th quantization unit is greater than the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be either 0 or 1; when the second-order difference information of the i-th quantization unit is less than or equal to the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be the other of 0 and 1;
[0164] The target quantization unit is the i-th quantization unit, and the adjacent quantization unit is the i-1-th quantization unit.
[0165] Optionally, the determining unit includes:
[0166] a second determining subunit, configured to determine an intermediate value of the i-th quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the i-th quantization unit;
[0167] A third determining subunit is used to determine a target number of times, where the target number of times is the number of occurrences of the intermediate value in the quantization values of the first i-1 quantization units plus one;
[0168] The second execution subunit is used to perform a compensation operation on the intermediate value to obtain a quantized value when the target number is greater than a preset compensation threshold, so that the number of occurrences of the quantized value in the quantized values of the first i quantization units is less than or equal to the preset compensation threshold.
[0169] Optionally, the second execution subunit is specifically used for:
[0170] Determine a replacement quantization unit from the first i-1 quantization units, the quantization value of the replacement quantization unit is different from the intermediate value, and the number of occurrences of the quantization value of the target quantization unit in the quantization values of the first i-1 quantization units is less than the preset compensation threshold;
[0171] The intermediate value is replaced by the quantized value of the replacement quantization unit to obtain the quantized value of the i-th quantization unit.
[0172] Optionally, the first-order preset threshold is inversely proportional to n, and the first-order preset threshold is proportional to the sum of the first-order difference information of n quantization units; and / or,
[0173] The second-order preset threshold is inversely proportional to n, and the second-order preset threshold is proportional to the sum of the second-order difference information of the n quantization units.
[0174] Optionally, the preset compensation threshold is proportional to n, and the preset compensation threshold is inversely proportional to the quantization order;
[0175] Among them, when the quantization mode is the first mode, the quantization order is 1, when the quantization mode is the second mode, the quantization order is 2, and when the quantization mode is the third mode, the quantization order is 3.
[0176] The file storage device 600 provided in the embodiment of the present invention can realize Figure 1 The various processes implemented by the method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.
[0177] like Figure 7 As shown, the embodiment of the present invention further provides an electronic device 700, including a processor 701, a memory 702, a program or instruction stored in the memory 702 and executable on the processor 701, and the program or instruction is executed by the processor 701 to implement the following Figure 1The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0178] The embodiment of the present invention further provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, the above-mentioned Figure 1 The various processes of the method embodiments shown in the figure can achieve the same technical effect, and are not described here in detail to avoid repetition. The readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0179] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0180] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0181] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0182] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A key generation method, characterized in that: include: Acquire a channel feature, where the channel feature includes n quantization units, where n is a positive integer; For each quantization unit of the n quantization units, obtaining a quantization value of each quantization unit based on the differential information of the channel characteristics; A key is generated based on the quantized values of the n quantized units.
2. The method according to claim 1, characterized in that The acquiring, for each of the n quantization units, a quantization value of each quantization unit based on the differential information of the channel characteristics, comprises: Determine first-order difference information and second-order difference information of a target quantization unit, wherein the first-order difference information is used to characterize the magnitude relationship between a channel characteristic of the target quantization unit and a channel characteristic of an adjacent quantization unit, and the second-order difference information is used to characterize the magnitude relationship between the first-order difference information of the target quantization unit and the first-order difference information of an adjacent quantization unit, wherein the target quantization unit is any one of the n quantization units, and the adjacent quantization unit is a quantization unit adjacent to the target quantization unit among the n quantization units; Performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit; determining a quantization value of the target quantization unit based on at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit; Among them, the first quantization value is determined based on the size relationship between the channel characteristics of the target quantization unit and the channel characteristics of the adjacent quantization unit, the second quantization value is determined based on the size relationship between the first-order difference information of the target quantization unit and the first-order preset threshold; the third quantization value is determined based on the size relationship between the second-order difference information of the target quantization unit and the second-order preset threshold.
3. The method according to claim 2, characterized in that The performing a quantization operation on the target quantization unit to obtain at least one of a first quantization value, a second quantization value, and a third quantization value of the target quantization unit includes: Determine the quantification mode; Based on the quantization mode, performing a quantization operation on the target quantization unit; Among them, when the quantization mode is the first mode, the quantization operation includes any one of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the second mode, the quantization operation includes any two of the first quantization operation, the second quantization operation and the third quantization operation; when the quantization mode is the third mode, the quantization operation includes the first quantization operation, the second quantization operation and the third quantization operation; the first quantization operation is used to obtain the first quantization value, the second quantization operation is used to obtain the second quantization value, and the third quantization operation is used to obtain the third quantization value.
4. The method according to claim 3, characterized in that The first quantization operation includes: When the channel characteristic of the i-th quantization unit is greater than the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be either 0 or 1; when the channel characteristic of the i-th quantization unit is less than or equal to the channel characteristic of the i-1-th quantization unit, the first quantization value of the i-th quantization unit is determined to be the other of 0 and 1, where i is an integer less than or equal to n; The second quantization operation includes: When the first-order difference information of the i-th quantization unit is greater than the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be either 0 or 1; when the first-order difference information of the i-th quantization unit is less than or equal to the first-order preset threshold, the second quantization value of the i-th quantization unit is determined to be the other of 0 and 1; The third quantization operation comprises: When the second-order difference information of the i-th quantization unit is greater than the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be either 0 or 1; when the second-order difference information of the i-th quantization unit is less than or equal to the second-order preset threshold, the third quantization value of the i-th quantization unit is determined to be the other of 0 and 1; The target quantization unit is the i-th quantization unit, and the adjacent quantization unit is the i-1-th quantization unit.
5. The method according to claim 4, characterized in that The determining the quantization value of the target quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the target quantization unit comprises: determining an intermediate value of the i-th quantization unit based on at least one of the first quantization value, the second quantization value, and the third quantization value of the i-th quantization unit; Determine a target number of times, where the target number of times is the number of occurrences of the intermediate value in the quantization values of the first i-1 quantization units plus one; When the target number is greater than a preset compensation threshold, a compensation operation is performed on the intermediate value to obtain a quantized value so that the number of occurrences of the quantized value in the quantized values of the first i quantization units is less than or equal to the preset compensation threshold.
6. The method according to claim 5, characterized in that When the target number is greater than a preset compensation threshold, performing a compensation operation on the intermediate value to obtain a quantized value includes: Determine a replacement quantization unit from the first i-1 quantization units, the quantization value of the replacement quantization unit is different from the intermediate value, and the number of occurrences of the quantization value of the target quantization unit in the quantization values of the first i-1 quantization units is less than the preset compensation threshold; The intermediate value is replaced by the quantized value of the replacement quantization unit to obtain the quantized value of the i-th quantization unit.
7. The method according to claim 2, characterized in that The first-order preset threshold is inversely proportional to n, and the first-order preset threshold is proportional to the sum of the first-order difference information of the n quantization units; and / or, The second-order preset threshold is inversely proportional to n, and the second-order preset threshold is proportional to the sum of the second-order difference information of the n quantization units.
8. The method according to claim 5, characterized in that The preset compensation threshold is proportional to n, and the preset compensation threshold is inversely proportional to the quantization order; Among them, when the quantization mode is the first mode, the quantization order is 1, when the quantization mode is the second mode, the quantization order is 2, and when the quantization mode is the third mode, the quantization order is 3.
9. A key generation device, characterized in that: include: A first acquisition module is used to acquire a channel feature, where the channel feature includes n quantization units, where n is a positive integer; A second acquisition module, configured to acquire, for each of the n quantization units, a quantization value of each quantization unit based on the differential information of the channel characteristics; A generating module is used to generate a key based on the quantization values of the n quantization units.
10. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; characterized in that: The processor is used to read the program in the memory to implement the steps in any one of the methods according to claims 1 to 8.
11. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Wireless channel key generation method based on feature distribution transformation
CN106102055A
Rapid generation method of point-to-point session key under static wireless channel condition
CN108183792A
Channel characteristic quantification method and device, electronic equipment and storage medium
CN112532328A
Method and system for generating a secret key from joint randomness
US20070165845A1