Numerical data encryption algorithm
Through bit-by-bit partitioning and two-layer numerical data encryption algorithms, the key is used to replace the data bit value, which solves the problem of lengthening bytes in floating-point data transmission, and improves the reliability and efficiency of data transmission.
Patent Information
- Application Number
- CN202411021454.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-01-03
AI Technical Summary
Existing numerical data encryption algorithms can easily lead to the increase in the number of data bytes in floating-point data transmission, affecting the transmission reliability.
A numerical data encryption algorithm with bit-by-bit partitioning is used to replace the data bit value through two-layer hierarchical and non-repeatable keys to form a new data format, and to send and receive encrypted data in a fixed data frame structure.
The data encryption function is realized, the number of data bytes is reduced, and the reliability and efficiency of data transmission is improved.
Smart Images

Figure CN119254415A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a numerical data encryption algorithm, belonging to the technical field of software engineering. Background Art
[0002] With the development of information and digital technology, people's awareness of the importance of information security and confidentiality has been continuously improved. Data encryption has become a necessary means in areas such as data transmission. Commonly used confidentiality algorithms include DES, RSA, SHA, AES, ECC, etc. Especially in the field of communications, the use of coding modulation and scrambling to encrypt data streams has also become a common data transmission mode. Encryption of numerical types, especially floating-point types, often results in the lengthening of the number of data bytes in the form of encoding, which has a certain impact on the reliability of data transmission.
[0003] The present invention designs a numerical data encryption algorithm to provide a practical and simple method to solve this problem. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide an implementation method of a numerical data encryption algorithm for the above-mentioned prior art, in which the actual numerical value is corresponded bit by bit to the specific keys in the two layers, and then the two adjacent layers are formed into a byte, wherein the keys are two non-repeatable groups of numbers, and the method has the characteristics of clear principle, simple structure and easy implementation.
[0005] The technical solution adopted by the present invention to solve the above-mentioned problem is: a numerical data encryption algorithm, characterized in that: the algorithm is to partition the numerical data by bit, each zone includes a key and a level, the level is divided into two layers, the key is used to replace the level, that is, the real value of the bit of the data is replaced, and the encrypted value will be assigned to each partition in bit order, reverse order or cross form as needed, and the keys for each bit obtained will be combined in pairs in the partition to form a new data format, thereby realizing encryption, and the encrypted data is sent and received according to a fixed data frame.
[0006] Preferably, the partitioning means assigning an encryption area to each bit of the numerical data, and performing encryption in the area according to the number of layers represented by the value of the bit in the numerical data according to the assigned key.
[0007] Preferably, the hierarchy is for numerical data, each bit of which takes a value between [0-9], and it has 10! = 3628800 permutations, all of which form an array, and the 10 values of each permutation in the array are divided into two layers, each layer has five levels, and a permutation in the array is randomly selected to obtain a 1-byte array number C5, and C5 is sent to the decryption end.
[0008] Preferably, the corresponding number of bits of the numerical data has n! = n*(n-1)*(n-2)...*1 permutations, where n represents the number of bits of the numerical data. All permutations are formed into an array. When used, a permutation is randomly selected, that is, the permutation number C1 with a sequence number of 1 byte is used to identify it in the array, and then C1 is sent to the decryption end.
[0009] Preferably, the key is 10 non-repeating groups of numbers selected from the 16 numbers [0-9, af], which are divided into two groups [0-9] and [af], and the arrangement of [0-9] is C 5 10 The arrangement of [af] is C 5 6 To form two arrays, a group of numbers are randomly selected from the two arrays to obtain 1-byte arrangement numbers C2 and C3 for identification. When used, C2 and C3 are sent to the decryption end.
[0010] Preferably, in view of the fact that the hierarchy is divided into two layers, the two groups of key arrays are allocated in the [0] or [1] mode to ensure that each layer of the hierarchy has a corresponding key. The key allocation mode is represented by C4, and C4 is sent to the decryption end and allocated to the upper 5 layers and the lower 5 layers of the hierarchy. 0 means that C2 is allocated to the upper 5 layers and C3 is allocated to the lower 5 layers. 1 means that C2 is allocated to the lower 5 layers and C3 is allocated to the upper 5 layers. Each group of passwords extracted is allocated to the hierarchy, that is, each bit of the key replaces the number represented by the hierarchy.
[0011] Preferably, the data frame is a frame structure form of data transmission. After the encrypted data is formed, the frame structure includes a 1-byte frame header, a 1-byte function code, n-byte data length and n-byte data.
[0012] Preferably, the frame header is 1-byte data that is not likely to appear in the entire frame data, the function code is a code representing that the data performs certain special functions, the data length is 1 byte, and the data length is a hexadecimal representation of the number of n-byte data. The data is the specific content that needs to be executed for the function code, and the return frame structure is the same as the sending frame structure, distinguished by the function code.
[0013] Compared with the prior art, the present invention has the following beneficial effects:
[0014] A numerical data encryption algorithm of the present invention adopts partitioning according to the real bit number of data, and each partition represents one bit. In the partition, the value of the bit is distinguished according to the two-level hierarchy, and then the value of the layer is replaced by the key, so as to realize the data encryption function. According to the frame structure of frame header + function code + data length + data, a specific function is executed according to the function code, so as to complete a specific task. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is an encryption structure diagram of a numerical data encryption algorithm of the present invention.
[0016] Figure 2 An example diagram of a numerical data encryption algorithm of the present invention
[0017] Figure 3 for Figure 1 frame structure. DETAILED DESCRIPTION
[0018] See also Figure 1 , a numerical data encryption algorithm of the present invention is mainly divided into bit-by-bit partitions, each zone includes a key and a level, the key is used to replace the level, so as to realize data encryption, and the encrypted data is sent and received according to a fixed data frame, wherein:
[0019] The partitioning means assigning an encryption area to each bit of the numerical data (including the decimal point), and encrypting the data in the area according to the assigned key and the number of layers represented by the value of the bit. The corresponding number of bits can be n! = n*(n-1)*(n-2)...*1 permutations, where n represents the number of bits of the numerical data, forming an array whose array elements are not real values but only represent the order of the bits. When the number of numerical elements is greater than 254, 254 of them are extracted to form an integer array, which is stored in the encryption end and the decryption end. For example, the numerical data 3764582 is formed into a numerical form containing 254 elements [1234567, 7654321, 1324567...7564321], and its sequence number is [0, 1,..., 253]. When in use, a random arrangement is selected, that is, the arrangement number of 1byteC1 is used in the array. For example, 7654321 is selected in the above example, then C1=0X01, which means that the millionth bit is moved to the unit bit, the hundredth bit is moved to the tenth bit, the tenth bit is moved to the hundredth bit, the tenth bit is moved to the tenth bit, the tenth bit is moved to the hundredth bit, the hundredth bit is moved to the ten thousandth bit, and the unit bit is moved to the millionth bit, and then C1 is sent to the decryption end. The partition contains N+1, where N corresponds to the number of digits contained in the numeric data, and the N+1 partition is used to indicate whether the decimal point and the number of digits of the decimal point are included, such as Figure 1 As shown, the keys are distributed from bottom to top according to [0-4, ae], and the levels are distributed from top to bottom according to [0-9]. The selected key result is represented by C. When there is no decimal place, the key of level 0 is e, then C=0X0E.
[0020] The key is 10 groups of numbers that are not repeated from the 16 numbers [0-9, af], which are divided into two groups [0-9] and [af], and the arrangement of [0-9] is C 5 10, select 254 elements from them to form an array, corresponding to Figure 1 X1-X5 or Y1-Y5, the arrangement of [af] is C 5 6 , corresponding to Figure 1 X1-X5 or Y1-Y5 form an array, which forms two arrays and is stored in the encryption end and the decryption end. The two arrays randomly extract a group of numbers and assign their serial numbers to 1-byte C2 and C3 respectively. When in use, C2 and C3 are sent to the decryption end. Among them, in view of the characteristics that the hierarchy is divided into upper and lower layers, each layer has five levels, the two key arrays are allocated according to the [0] or [1] mode to ensure that each layer of the hierarchy has a corresponding key. The key allocation mode is represented by C4. It can be seen that C4 has two expressions of 0X00 and 0X01. 0X00 means that the element where the serial number C2 is located is allocated to the upper 5 layers, and the element where the serial number C3 is located is allocated to the lower 5 layers. 0X01 means that the element where the serial number C2 is located is allocated to the lower 5 layers, and the element where the serial number C3 is located is allocated to the upper 5 layers. The elements where the serial numbers C2 and C3 are located are allocated to the hierarchy bit by bit, that is, each bit of the key can replace the number represented by the hierarchy.
[0021] The hierarchy is for numeric data, each bit is between [0-9], it has 10! = 3628800 permutations, 254 of which are selected to form an array, which is stored in the encryption end and the decryption end. When used, a permutation in the array is randomly selected to obtain a 1-byte array number C5, and C5 is sent to the decryption end.
[0022] The encryption is to distribute the encrypted value to each partition in the form of positive or reverse order or cross order, etc., and combine the obtained key bits in pairs in the partition to form a new data format, so as to realize encryption.
[0023] The data frame is a frame structure form of data transmission. After the encrypted data is formed, Figure 3 The frame structure shown includes a 1-byte frame header, a 1-byte function code, n-byte data length, and n-byte data. The frame header is a 1-byte data that is not easy to appear in the entire frame data. The function code is a code representing that the data performs some special functions. The data length is 1 byte, and the data length is a hexadecimal representation of the number of n-byte data. The data is the specific content that needs to be executed for the function code. The return frame structure is the same as the sending frame structure, distinguished by the function code.
[0024] For example Figure 2 and Figure 3For example, if the numeric data is 7896.5432, the bit is sorted normally from left to right, that is, C1=00, and the corresponding key is [a,b,c,d,e,0,1,2,3,4,]. Both C2 and C3 are 00, and the corresponding key array sequence is 10, that is, C4=10. The key is divided into two groups [a,b,c,d,e] and [0,1,2,3,4]. The two groups are cross-distributed in the partition, and the levels are distributed from low to high [0-9]. C5=00, then 7896.5432 becomes 2d4b04d2 in hexadecimal after encryption. It can be seen that the floating point number that originally required 8 bytes to represent is now represented by 4 bytes. The data group frame is FF 01 07C1 C2 C3C4 C5, and the return frame is FF 02 07C1 C2 C3 C4 C5.
[0025] In addition to the above embodiments, the present invention also includes other implementation modes. Any technical solutions formed by equivalent transformation or equivalent replacement should fall within the protection scope of the claims of the present invention.
Claims
1. A numerical data encryption algorithm, characterized in that: The algorithm is to partition the numerical data by bit, each zone includes a key and a level, the level is divided into upper and lower levels, the key is used to replace the level, that is, the real value of the bit of the data is replaced, and the encrypted value will be assigned to each partition in bit order, reverse order or cross form as needed, and the keys for each bit will be combined in pairs in the partition to form a new data format, thereby realizing encryption, and the encrypted data is sent and received according to a fixed data frame.
2. A numerical data encryption algorithm according to claim 1, characterized in that: The partitioning means assigning an encryption area to each bit of the numerical data, and performing encryption in the area according to the number of layers represented by the value of the bit in the numerical data according to the assigned key.
3. A numerical data encryption algorithm according to claim 1, characterized in that: The hierarchy is for numeric data, each bit is between [0-9], it has 10! = 3628800 permutations, all permutations form an array, in the array, the 10 values of each permutation are divided into two layers, each layer has five levels, randomly select one permutation in the array, get the 1-byte array number C5, and send C5 to the decryption end.
4. A numerical data encryption algorithm according to claim 2, characterized in that: There are n!=n*(n-1)*(n-2)...*1 permutations of the corresponding number of bits of the numeric data, where n represents the number of bits of the numeric data. All permutations are formed into an array. When used, a permutation is randomly selected, that is, the permutation number C1 with a serial number of 1 byte is used to identify it in the array, and then C1 is sent to the decryption end.
5. A numerical data encryption algorithm according to claim 1, characterized in that: The key is 10 non-repeating groups of numbers selected from the 16 numbers [0-9, af], which are divided into two groups [0-9] and [af], and the arrangement of [0-9] is C 5 10 The arrangement of [af] is C 5 6, forming two groups of arrays, the two groups of arrays respectively randomly extract a group of numbers, and obtain 1-byte arrangement numbers C2 and C3 for identification. When used, C2 and C3 are sent to the decryption end.
6. A numerical data encryption algorithm according to claim 5, characterized in that: In view of the fact that the hierarchy is divided into two layers, the two groups of key arrays are allocated in the [0] or [1] mode to ensure that each layer of the hierarchy has a corresponding key. The key allocation mode is represented by C4, and C4 is sent to the decryption end and allocated to the upper 5 layers and the lower 5 layers of the hierarchy. 0 means that C2 is allocated to the upper 5 layers and C3 is allocated to the lower 5 layers. 1 means that C2 is allocated to the lower 5 layers and C3 is allocated to the upper 5 layers. Each group of passwords extracted is assigned to the hierarchy, that is, each bit of the key replaces the number represented by the hierarchy.
7. A numerical data encryption algorithm according to claim 1, characterized in that: The data frame is a frame structure form of data transmission. After the encrypted data is formed, the frame structure includes a 1-byte frame header, a 1-byte function code, n-byte data length and n-byte data.
8. A numerical data encryption algorithm according to claim 7, characterized in that: The frame header is a 1-byte data that is not easy to appear in the entire frame data. The function code is a code representing that the data performs certain special functions. The data length is 1 byte. The data length is the hexadecimal representation of the number of n-byte data. The data is the specific content that needs to be executed for the function code. The return frame structure is the same as the sending frame structure, and is distinguished by the function code.
