Data encryption method, device, electronic device and storage medium
By splitting the data to be encrypted into unit data and encrypting with sector allocation, and combining time information for encryption, the problem of single-in-one encryption results and correspondence relationships in the existing encryption methods is solved, and the security of data encryption is improved.
Patent Information
- Application Number
- CN202210750059.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-06-29
AI Technical Summary
During the encryption process of existing encryption methods, the encryption results and correspondence between plaintext and ciphertext are easily cracked, resulting in insufficient data security.
By splitting the data to be encrypted into unit data and using the data bit segmentation circle to generate a fan shape, the unit data is randomly allocated into the fan shape, and encrypted in combination with time information to generate a variety of encryption results to avoid the singularization of encryption results and corresponding relationships.
It improves the security of data encryption, avoids the singularization of encryption results and correspondence between plain text and ciphertext, and enhances the protection of confidential data.
Smart Images

Figure CN115276966B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption methods, and in particular to a data encryption method, a data encryption method device, an electronic device and a computer-readable storage medium. Background Art
[0002] With the development of computer and Internet technology, a large amount of people's sensitive personal information is collected and stored in many social public service fields such as finance, telecommunications, transportation, medical care, property management, accommodation services, express delivery, etc.
[0003] Therefore, how to encrypt sensitive information to improve the security of sensitive information is a technical problem that technicians in this field need to overcome. Summary of the invention
[0004] The embodiments of the present invention provide a data encryption method, device, electronic device and computer-readable storage medium to solve the problem of improving the security of data to be encrypted during the encryption process.
[0005] The embodiment of the present invention discloses a data encryption method, which may include:
[0006] Acquire data to be encrypted, and split the data to be encrypted into unit data;
[0007] Using the unit data to determine the number of data bits of the data to be encrypted;
[0008] The number of data bits is used to divide the circle to generate a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits;
[0009] Randomly assigning the unit data to the sectors so that a plurality of the unit data correspond to a plurality of the angle interval values one by one;
[0010] Acquire time information, and use the time information to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm;
[0011] First encrypted data for the data to be encrypted is generated using the first encrypted value.
[0012] Optionally, it may also include:
[0013] Generate a first binary number sequence using the first encrypted value;
[0014] Reversing the first binary number sequence bit by bit to generate a second binary number sequence;
[0015] Generate a second encrypted value using the second binary number sequence;
[0016] Second encrypted data is generated using the second encrypted value.
[0017] Optionally, it may also include:
[0018] Using the second encrypted value, calculate an arc length corresponding to the second encrypted value;
[0019] Using the arc length and the time information, a third encrypted value is calculated based on a second time algorithm;
[0020] The third encrypted data is generated by the third encrypted value.
[0021] Optionally, it may also include:
[0022] Generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value;
[0023] Fourth encrypted data is generated using the fourth encrypted value.
[0024] Optionally, the time information may be a key.
[0025] Optionally, the unit data may include actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
[0026] The embodiment of the present invention further discloses a data encryption device, which may include:
[0027] The encrypted data acquisition module is used to acquire the data to be encrypted and split the data to be encrypted into unit data;
[0028] A data bit number determination module, used to determine the data bit number of the to-be-encrypted data using the unit data;
[0029] A sector generating module, used for dividing a circle by the number of data bits to generate a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits;
[0030] A unit data allocation module, used for randomly allocating the unit data to the sectors, so that a plurality of the unit data correspond to a plurality of the angle interval values one by one;
[0031] A time information acquisition module, used to acquire time information, and use the time information to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm;
[0032] The first encrypted data generating module is used to generate first encrypted data for the data to be encrypted by using the first encrypted value.
[0033] Optionally, it may also include:
[0034] A first binary number sequence generating module, configured to generate a first binary number sequence using the first encrypted value;
[0035] A second binary number sequence generating module, used for performing bit-by-bit inversion on the first binary number sequence to generate a second binary number sequence;
[0036] A second encrypted value generating module, configured to generate a second encrypted value using the second binary number sequence;
[0037] The second encrypted data generating module is used to generate second encrypted data according to the second encrypted value.
[0038] Optionally, it may also include:
[0039] an arc length calculation module, configured to use the second encrypted value to calculate an arc length corresponding to the second encrypted value;
[0040] A third encrypted value calculation module, configured to calculate a third encrypted value based on a second time algorithm using the arc length and the time information;
[0041] The third encrypted data generating module is used to generate third encrypted data through the third encrypted value.
[0042] Optionally, it may also include:
[0043] a fourth encrypted value generating module, configured to generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value;
[0044] The fourth encrypted data generating module is used to generate fourth encrypted data using the fourth encrypted value.
[0045] Optionally, the time information may be a key.
[0046] Optionally, the unit data may include actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
[0047] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0048] The memory is used to store computer programs;
[0049] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0050] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0051] The embodiments of the present invention include the following advantages:
[0052] According to an embodiment of the present invention, data to be encrypted is obtained, and the data to be encrypted is split into unit data; the unit data is used to determine the number of data bits of the data to be encrypted; the number of data bits is used to divide a circle to generate multiple sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits; the unit data is randomly distributed to the sectors so that multiple unit data correspond to multiple angle interval values one by one; time information is obtained, and the time information is used to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm; first encrypted data for the data to be encrypted is generated through the first encryption value, thereby avoiding the simplification of encryption results between plaintext and ciphertext, and also avoiding the simplification of the correspondence between plaintext and ciphertext, thereby improving the security of confidential data. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 is a flowchart of a data encryption method provided in an embodiment of the present invention;
[0054] Figure 2 is a schematic diagram of the relationship between sectors and unit data provided in an embodiment of the present invention;
[0055] Figure 3 It is a structural block diagram of a data encryption method device provided in an embodiment of the present invention;
[0056] Figure 4 It is a hardware structure block diagram of an electronic device provided in each embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] In practical applications, encrypting data during data transmission and data storage is the simplest and most effective method. However, after the concept of encryption emerged, technicians in this field have been studying new encryption algorithms, from Morse code, which uses different combinations of long and short signals to encrypt all numerical values in fixed algorithms such as the data summary MD5 encryption algorithm, to encryption algorithms such as the DES symmetric encryption algorithm that require users to add keys or offset vectors. Although the logic of the encryption algorithm is becoming more and more complex, no matter how many rounds of XOR, permutation, substitution, and shift operations are used, the order of operations is constantly changed, or the user is allowed to participate in the encryption process to the maximum extent, the one-to-one correspondence between plaintext and ciphertext will not change. After a certain amount of plaintext and ciphertext are collected, through big data analysis and comparison, it is highly likely that this one-to-one correspondence can be found, thereby increasing the risk of leakage of encrypted data.
[0059] Reference Figure 1 , shows a flow chart of the steps of a data encryption method provided in an embodiment of the present invention, which may specifically include the following steps:
[0060] Step 101, obtaining data to be encrypted, and splitting the data to be encrypted into unit data;
[0061] Step 102, using the unit data to determine the number of data bits of the data to be encrypted;
[0062] Step 103, using the number of data bits to divide the circle, generating a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits;
[0063] Step 104, randomly assigning the unit data to the sectors, so that a plurality of the unit data correspond to a plurality of the angle interval values one by one;
[0064] Step 105, obtaining time information, and using the time information to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm;
[0065] Step 106: Generate first encrypted data for the data to be encrypted using the first encryption value.
[0066] In a specific implementation, the data to be encrypted in the implementation rules of the present invention can be any characters, for example, English letters, Latin letters, Chinese pinyin, Chinese phonetic symbols, Chinese characters, etc., or numbers or other symbols. In order to enable those skilled in the art to better understand the embodiments of the present invention, lowercase English letters and numbers will be used as examples to illustrate the encryption process for the data to be encrypted. Of course, those skilled in the art can encrypt other types of data in the following manner, and the embodiments of the present invention are not limited to this.
[0067] After obtaining the data to be encrypted, the embodiment of the present invention can split the data to be encrypted into unit data in equal or unequal divisions. For example, 26 lowercase English letters "AZ" and Arabic numerals "0-9" can be used as the data to be encrypted, that is, the data to be encrypted can be a string of "abcdefghijklmnopqrstuvwxyz0123456789". After obtaining the data to be encrypted, it can be split into three unit data of "abcdefgh", "ijklmnopqrstuvwxyz", and "0123456789", or it can be split into 13 unit data of "ab", "cd", "ef", "gh", "ij", "kl", "mn", "op", "qr", "st", "uv", "wx", "yz", "01", "23", "45", "67", and "89".
[0068] Optionally, the unit data in the embodiment of the present invention may be minimum unit data, for example, each letter and number in the string of characters "abcdefghijklmnopqrstuvwxyz0123456789" is regarded as a unit data.
[0069] After completing the splitting of the data to be encrypted, the embodiment of the present invention can use unit data to determine the number of data bits of the data to be encrypted. For example, the data to be encrypted "abcdefghijklmnopqrstuvwxyz0123456789" is divided into three unit data of "abcdefgh", "ijklmnopqrstuvwxyz", and "0123456789", and the number of data bits of the data to be encrypted is 3 bits; the data to be encrypted "abcdefghijklmnopqrstuvwxyz0123456789" is divided into "ab", "cd", "ef", "gh", "ij", "kl", "mn", "op", "qr", "st", "uv", "wx", "yz", "01", "23", "45", "67", and "89", and the number of data bits of the data to be encrypted is 13 bits.
[0070] In a specific implementation, the embodiment of the present invention may use the number of data bits to divide the circle to generate multiple sectors, and the sectors have internal angles, so the sectors may have corresponding angle interval values, and the number of sectors may be equal to the number of data bits.
[0071] Optionally, in the embodiment of the present invention, the original image may be divided into equal parts or unequal parts.
[0072] After the sector is generated, the embodiment of the present invention can randomly distribute the unit data to the sector so that the multiple unit data correspond to the multiple angle interval values one by one.
[0073] refer to Figure 2 , Figure 2 1 is a schematic diagram of the relationship between sectors and unit data provided by an embodiment of the present invention. If the data to be encrypted, "abcdefghijklmnopqrstuvwxyz0123456789", is divided into four unit data, namely, unit data 201 "abcdefgh", unit data 202 "0123456789", unit data 203 "stuvwxyz", and unit data 204 "ijklmnopqr", the number of bits of the data to be encrypted is 4 bits, and a circle can be divided into four sectors, namely, sector 205, sector 206, sector 207, and sector 208. The angle interval value of sector 205 can be 0° to 30°. The angle interval value of sector 206 can be 30° to 180°, the angle interval value of sector 207 can be 180° to 210°, and the angle interval value of sector 208 can be 210° to 360°. Among them, the angle interval value corresponding to unit data 201 "abcdefgh" can be 0° to 30°, the angle interval value corresponding to unit data 202 "0123456789" can be 30° to 180°, the angle interval value corresponding to unit data 203 "stuvwxyz" can be 180° to 210°, and the angle interval value corresponding to unit data 204 "ijklmnopqr" can be 210° to 360°.
[0074] After completing the allocation of the unit data, the embodiment of the present invention can obtain time information, and can use the time information to determine a first encryption value for the unit data in the angle interval value based on the first time algorithm.
[0075] For example, the data to be encrypted "abcdefghijklmnopqrstuvwxyz0123456789" is split into the smallest unit data, that is, the number of bits of the data to be encrypted is 36, the circle is divided into 36 sectors, and the unit data is randomly assigned to the sectors, so that multiple unit data correspond to multiple angle interval values one by one, and the following correspondence table can be obtained:
[0076] Center Angle Corresponding content Center Angle Corresponding content 0~10 7 181~190 f 11~20 q 191~200 4 21~30 w 201~210 g 31~40 e 211~220 h 41~50 5 221~230 j 51~60 r 231~240 k 61~70 t 241~250 0 71~80 y 251~260 9 81~90 8 261~270 l 91~100 u 271~280 z 101~110 i 281~290 x 111~120 o 291~300 2 121~130 6 301~310 c 131~140 p 311~320 v 141~150 a 321~330 b 151~160 1 331~340 3 161~170 s 341~350 n 171~180 d 351~360 m
[0077] Among them, each unit data corresponds to an angle interval value.
[0078] For example, assuming that the time information of the day to be encrypted for the encrypted data is March 30, 2022, this time information can be obtained and recorded as 20220330. The date digit of the time information can be divided by 3 and the remainder is used to determine the number of decimal places to be retained. If the remainder is 0, an integer is taken; if the remainder is 1, 1 decimal place is taken; if the remainder is 2, 2 decimal places are taken; 30÷3=10, if the remainder is 0, an integer is taken, then the first encrypted value of the unit data "e" can be a random integer between 31-40, such as 36 or 39, which can be recorded as "036" and "039" respectively, that is, any integer between 31-40 can represent the unit data "e", and the first encrypted value of the unit data "5" can be 50 or 47 can be recorded as "050" or "047" respectively, that is, any integer between 41 and 50 can represent the unit data "5". Similarly, if the date on which the encrypted data is encrypted is April 1, 2022, this date can be obtained, and the time information is recorded as 20220401. The last two digits of 0220401 are divided by three and the remainder is used to determine the number of decimal places. Then, the first encrypted value of the unit data "5" can be any number with two decimal places between 41 and 50, such as 42 degrees 9 minutes or 44 degrees 7 minutes, which can be recorded as "4209" or "4407" respectively. That is, any number with two decimal places between 41 and 50 can represent the unit data "5".
[0079] In the embodiment of the present invention, after determining the first encryption values corresponding to all the unit data, a plurality of first encryption values may be combined to generate first encrypted data for the data to be encrypted.
[0080] Optionally, the first encrypted value above 360 degrees may correspond to unit data expressing a space to separate words and numbers.
[0081] According to an embodiment of the present invention, data to be encrypted is obtained, and the data to be encrypted is split into unit data; the unit data is used to determine the number of data bits of the data to be encrypted; the number of data bits is used to divide a circle to generate multiple sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits; the unit data is randomly distributed to the sectors so that multiple unit data correspond to multiple angle interval values one by one; time information is obtained, and the time information is used to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm; first encrypted data for the data to be encrypted is generated through the first encryption value, thereby avoiding the simplification of encryption results between plaintext and ciphertext, and also avoiding the simplification of the correspondence between plaintext and ciphertext, thereby improving the security of confidential data.
[0082] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0083] In an optional embodiment of the present invention, it also includes:
[0084] Generate a first binary number sequence using the first encrypted value;
[0085] Reversing the first binary number sequence bit by bit to generate a second binary number sequence;
[0086] Generate a second encrypted value using the second binary number sequence;
[0087] Second encrypted data is generated using the second encrypted value.
[0088] In a specific implementation, the embodiment of the present invention may use the first encrypted value to generate a first binary number sequence, and perform bit-by-bit inversion on the first binary number sequence to generate a second binary number sequence, and then use the second binary number sequence to generate a second encrypted value.
[0089] For example, the first encryption value of the letter c is 304. 304 is converted into binary to generate the first binary sequence "100110000", and then "100110000" is reversed bit by bit to generate the second binary sequence "011001111". After the second binary sequence is generated, the second binary sequence "011001111" can be converted into decimal to generate the second encryption value 207.
[0090] After all the first encrypted data are converted into the second encrypted values, the embodiment of the present invention can generate the second encrypted data through the second encrypted values.
[0091] The embodiment of the present invention generates a first binary number sequence by using the first encryption value; generates a second binary number sequence by bit-by-bit inversion of the first binary number sequence; generates a second encryption value by using the second binary number sequence; and generates second encrypted data by using the second encryption value, thereby further improving the security of confidential data.
[0092] In an optional embodiment of the present invention, it also includes:
[0093] Using the second encrypted value, calculate an arc length corresponding to the second encrypted value;
[0094] Using the arc length and the time information, a third encrypted value is calculated based on a second time algorithm;
[0095] The third encrypted data is generated by the third encrypted value.
[0096] In a specific implementation, the second encrypted value of the embodiment of the present invention can still represent the inner angle of the sector, so the second encrypted value can be used to calculate the arc length corresponding to the second encrypted value.
[0097] For example, the arc length L can be calculated by the following formula: (r / 180)*π*n, where L is the arc length, r is the radius, which can be 1; π is the pi, which can be 3; and n is the center angle, which can be the second encrypted value.
[0098] After calculating the arc length corresponding to the second encrypted value, the arc length and time information may be used to calculate a third encrypted value based on the second time algorithm.
[0099] For example, assuming that the time information of the day on which the encrypted data is encrypted is March 30, 2022, this time information can be obtained and recorded as 20220330. The date digit of the time information can be divided by 2 and the remainder can be used to determine the number of decimal places to be retained. Suppose the remainder is 0, and 2 decimal places are taken; the remainder is 1, and 3 decimal places are taken; 30÷2=15, the remainder is 0, and 2 decimal places are taken. The second encryption value is 207, and the arc length of the sector with a central angle of 207° is 3.45, recorded as 345, and the third encryption value is 345.
[0100] After all the second encrypted data are converted into the third encrypted value, the embodiment of the present invention can generate the third encrypted data through the third encrypted value.
[0101] In an embodiment of the present invention, the arc length corresponding to the second encryption value is calculated by using the second encryption value; the third encryption value is calculated based on a second time algorithm using the arc length and the time information; and third encrypted data is generated by the third encryption value, thereby further improving the security of confidential data.
[0102] In an optional embodiment of the present invention, it also includes:
[0103] Generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value;
[0104] Fourth encrypted data is generated using the fourth encrypted value.
[0105] In a specific implementation, the embodiment of the present invention can generate the fourth encrypted value by performing an XOR operation on the time information and the third encrypted value.
[0106] For example, 345 is converted into a binary number sequence 101011001. Assuming that the time information of the encrypted data is March 30, 2022, the time information can be obtained and recorded as 20220330. 20220330 is converted into a binary number sequence 1001101001000100110101010. By performing an XOR operation on the time information and the third encrypted value, 345 (binary 101011001) is obtained. 20220330 (binary 1001101001000100110101010)=20220147 (binary 1001101001000100011110011), that is, the fourth encrypted value is 20220147 (binary 1001101001000100011110011).
[0107] After all the third encrypted data are converted into fourth encrypted values, the embodiment of the present invention can generate fourth encrypted data through the fourth encrypted values.
[0108] The embodiment of the present invention generates a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value; and generates fourth encrypted data by using the fourth encrypted value, thereby further improving the security of confidential data.
[0109] In an optional embodiment of the present invention, the time information is a key.
[0110] In practical applications, using time information as a key can ensure the timeliness of the key, thereby further improving the security of confidential data. At the same time, the key of the embodiment of the present invention can also be used for decryption to restore the ciphertext to plaintext, that is, to restore the encrypted data.
[0111] For example, assuming that the time information of the day on which the encrypted data is encrypted is March 30, 2022, this time information can be obtained, and the key is 20220330. The fourth encrypted value in the fourth encrypted data is 20220147. By performing bitwise XOR calculation on the fourth encrypted value 20220147 and the key 20220330, the third encrypted value can be calculated to be 345. The remainder of the date digit 30 divided by 2 is 0, so the third encrypted value 345 can be obtained. The arc length should be 3.45. Using the arc length formula L = (r / 180)*π*n (L is the arc length, r is 1, π is 3, and n is the degree of the center angle), the second encrypted value is calculated to be 207. The second encrypted value 207 is bitwise inverted to calculate the first encrypted value to be 304. The remainder of the date digit 30 divided by 2 is 0, so 304 corresponds to 304 degrees. 304 degrees is in the range of 301 to 310 degrees. In the fourth encrypted data, the result corresponding to the fourth encrypted value is c.
[0112] In an optional embodiment of the present invention, the unit data includes actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
[0113] In practical applications, embodiments of the present invention may split the data to be encrypted into unit data in a multi-partition manner. Specifically, the data to be encrypted may be split into actual unit data that actually expresses the data to be encrypted and virtual unit data that is not used to actually express the data to be encrypted.
[0114] For example, when the data to be encrypted is a string of characters "0123456789", the data to be encrypted can be changed to a sequence of "0_1_2_3_4_5_6_7_8_9", where "1", "2", "3", "4", "5", "6", "7", "8", and "9" actually express the actual unit data of the data to be encrypted, and the other 9 "_" can be virtual unit data that is not used to actually express the data to be encrypted. If the sequence of "0_1_2_3_4_5_6_7_8_9" is split into the smallest unit data, the number of bits of the data to be encrypted is 19, which means that the circle can be It is divided into 19 sectors. After the unit data are randomly assigned to the sectors, the inner angles of 9 sectors will correspond to "_". However, in actual applications, if virtual unit data appears, that is, "_" appears during the decoding process, it can be regarded as a third party trying to crack the encryption algorithm, or the encrypted data is attacked by junk data. Therefore, the embodiment of the present invention can form unit data by adopting actual unit data for actually expressing the data to be encrypted and virtual unit data that is not used to actually express the data to be encrypted. When virtual unit data appears during decoding, a security warning is issued, thereby further improving the security of confidential data.
[0115] Furthermore, the embodiment of the present invention encrypts data by utilizing the center angle of a circle, thereby converting the encryption relationship into one-to-many, thereby achieving the same original data, being encrypted at the same time, and having multiple ciphertext results; the complexity of the algorithm is increased by combining the sector arc length formula, bitwise inversion, and bitwise XOR; the number of decimal places to be retained is determined by time information, so that the possibility of the encryption result of the same original text within a unit time is different from that at the previous time; and the timeliness is guaranteed by utilizing the date as the key.
[0116] In order to enable those skilled in the art to better understand the embodiments of the present invention, a complete example is used below to illustrate the embodiments of the present invention.
[0117] Step 1: Divide the circle into equal parts as needed. For example, if you need to encrypt 26 lowercase English letters and Arabic numerals 0-9, divide the circle into 36 equal parts.
[0118] Step 2: Randomly assign the minimum atomic data source to the split sectors to obtain the following table.
[0119]
[0120]
[0121] Step 3: The center angle of the sector is the encrypted value range of English letters or Arabic numerals. The number of decimal places to be retained is determined by dividing the last two digits of the date by three using data transmission (storage) and taking the remainder (if the remainder is 0, take an integer; if the remainder is 1, take 1 decimal place; if the remainder is 2, take 2 decimal places). For example, when data is stored on March 30, 2022 (20220330), 30 divided by 3 has a remainder of 0, and the integer is taken. 36 degrees (036) corresponds to the English letter e, 39 degrees (039) also corresponds to the English letter e, and 50 degrees (050) corresponds to the Arabic numeral 5; when data is stored on April 1, 2022 (20220401), 01 is divided by 3, and the remainder is 1. One decimal place is retained, 36 degrees 3 minutes (0363) corresponds to the English letter e, 39 degrees 0 minutes (0390) also corresponds to the English letter e, and 50 degrees 9 minutes (0509) corresponds to the Arabic numeral 5. Spaces above 360 degrees are used to split words and numbers.
[0122] Step 4: Replace the English words or Arabic numerals with the corresponding center angles according to the corresponding relationship, and then perform bitwise inversion. For example, the English letter c corresponds to 304 (binary 100110000), and the bitwise inversion result is 207 (binary 011001111).
[0123] Step 5: Take the arc length of the sector corresponding to the central angle of the circle within the unit circle (keep two decimal places) L = (r / 180) * π * n (L is the arc length, r is 1, π is 3, and n is the degree of the central angle of the circle). Use data transmission (storage) to divide the date and month of the day by two and take the remainder to determine the number of decimal places to be retained (remainder is 0, take 2 decimal places; remainder is 1, take 3 decimal places). For example, March 30, 2022 (20220330) is used to store data, 30 divided by 2, the remainder is 0, take 2 decimal places, and the arc length of the sector corresponding to the central angle of 207 degrees is 3.45, which is recorded as 345. Furthermore, the encryption and decryption parties can agree on the decimal places to be retained for π in the formula for the arc length of the sector, or they can agree on the order of bitwise inversion and bitwise XOR in the entire algorithm.
[0124] Step 6: Use the date of transmission (storage) as the key. During transmission, the "timestamp" parameter is added to distinguish the key. When storing, the "save time" is used to distinguish the key. For example, March 30, 2022 is recorded as 20220330. The central angle of the circle corresponds to the arc length of the sector. Perform bitwise XOR, such as 345 (binary 101011001) xor 20220330 (binary 1001101001000100110101010) = 20220147 (binary 1001101001000100011110011).
[0125] Step 7: Decryption
[0126] Decryption is the reverse processing of the encryption result.
[0127] For example, on March 30, 2022, the encryption result of c (the central angle is 304) is 20220147. The decryption process is as follows: (the sixth step is reverse processing) 20220147 is bitwise XORed, the key is 20220330, and the result is 345; (the fifth step is reverse processing) 30 is divided by 2, and the remainder is 0, so the arc length corresponding to 345 is 3.45. Using the arc length formula L = (r / 180)*π*n (L is the arc length, r is 1, π is 3 , n is the degree of the center angle), calculate the center angle, the result is 207; (the fourth step is reverse processing) 207 is bitwise inverted, the result is 304; (the third step is reverse processing) 30 is divided by 3, the remainder is 0, and 304 corresponds to 304 degrees. 304 degrees is in the range of 301 degrees to 310 degrees, and the corresponding result is c, that is, encryption: c→304→207→345→20220147; decryption: 20220147→345→207→304→c.
[0128] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0129] Reference Figure 3 , shows a structural block diagram of a data encryption method device provided in an embodiment of the present invention, which may specifically include the following modules:
[0130] The encrypted data acquisition module 301 is used to acquire the data to be encrypted and split the data to be encrypted into unit data;
[0131] A data bit number determination module 302, configured to determine the data bit number of the to-be-encrypted data using the unit data;
[0132] The sector generating module 303 is used to divide the circle by the number of data bits to generate a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits;
[0133] A unit data allocation module 304, configured to randomly allocate the unit data to the sectors, so that a plurality of the unit data correspond to a plurality of the angle interval values one by one;
[0134] A time information acquisition module 305, configured to acquire time information, and determine a first encryption value for the unit data in the angle interval value based on the first time algorithm using the time information;
[0135] The first encrypted data generating module 306 is configured to generate first encrypted data for the data to be encrypted using the first encrypted value.
[0136] Optionally, it may also include:
[0137] A first binary number sequence generating module, configured to generate a first binary number sequence using the first encrypted value;
[0138] A second binary number sequence generating module, used for performing bit-by-bit inversion on the first binary number sequence to generate a second binary number sequence;
[0139] A second encrypted value generating module, configured to generate a second encrypted value using the second binary number sequence;
[0140] The second encrypted data generating module is used to generate second encrypted data according to the second encrypted value.
[0141] Optionally, it may also include:
[0142] an arc length calculation module, configured to use the second encrypted value to calculate an arc length corresponding to the second encrypted value;
[0143] A third encrypted value calculation module, configured to calculate a third encrypted value based on a second time algorithm using the arc length and the time information;
[0144] The third encrypted data generating module is used to generate third encrypted data through the third encrypted value.
[0145] Optionally, it may also include:
[0146] a fourth encrypted value generating module, configured to generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value;
[0147] The fourth encrypted data generating module is used to generate fourth encrypted data using the fourth encrypted value.
[0148] Optionally, the time information may be a key.
[0149] Optionally, the unit data may include actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
[0150] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0151] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data encryption method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0152] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned data encryption method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] Figure 4 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0154] The electronic device 400 includes but is not limited to: a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, a processor 410, and a power supply 411. Those skilled in the art will appreciate that Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0155] It should be understood that in the embodiment of the present invention, the radio frequency unit 401 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 410 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 401 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 401 can also communicate with the network and other devices through a wireless communication system.
[0156] The electronic device provides users with wireless broadband Internet access through the network module 402, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0157] The audio output unit 403 can convert the audio data received by the RF unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output it as sound. Moreover, the audio output unit 403 can also provide audio output related to a specific function performed by the electronic device 400 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, etc.
[0158] The input unit 404 is used to receive audio or video signals. The input unit 404 may include a graphics processor (GPU) 4041 and a microphone 4042, and the graphics processor 4041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 406. The image frame processed by the graphics processor 4041 can be stored in the memory 409 (or other storage medium) or sent via the radio frequency unit 401 or the network module 402. The microphone 4042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 401 in the case of a telephone call mode.
[0159] The electronic device 400 also includes at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 4061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 4061 and / or the backlight when the electronic device 400 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 405 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0160] The display unit 406 is used to display information input by the user or information provided to the user. The display unit 406 may include a display panel 4061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0161] The user input unit 407 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. The touch panel 4071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 4071 or near the touch panel 4071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 4071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 410, receives the command sent by the processor 410 and executes it. In addition, the touch panel 4071 can be implemented using various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 4071, the user input unit 407 may also include other input devices 4072. Specifically, other input devices 4072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0162] Furthermore, the touch panel 4071 may be overlaid on the display panel 4061. When the touch panel 4071 detects a touch operation on or near it, it is transmitted to the processor 410 to determine the type of the touch event. Then, the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. Figure 4 In the figure, the touch panel 4071 and the display panel 4061 are two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 4071 and the display panel 4061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0163] The interface unit 408 is an interface for connecting an external device to the electronic device 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 400 or may be used to transmit data between the electronic device 400 and an external device.
[0164] The memory 409 can be used to store software programs and various data. The memory 409 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 409 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0165] The processor 410 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 409, and calling data stored in the memory 409, so as to monitor the electronic device as a whole. The processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 410.
[0166] The electronic device 400 may also include a power supply 411 (such as a battery) for supplying power to each component. Preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0167] In addition, the electronic device 400 includes some functional modules not shown, which will not be described in detail here.
[0168] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0169] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0170] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0171] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0172] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0173] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods 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.
[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0175] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0176] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0177] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A data encryption method, characterized in that: include: Acquire data to be encrypted, and split the data to be encrypted into unit data; Using the unit data to determine the number of data bits of the data to be encrypted; The data bit number is used to express the number of bits required to form the complete data to be encrypted using the unit data; The number of data bits is used to divide the circle to generate a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits; Randomly assigning the unit data to the sectors so that a plurality of the unit data correspond to a plurality of the angle interval values one by one; Acquire time information, and use the time information to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm; First encrypted data for the data to be encrypted is generated using the first encrypted value.
2. The method according to claim 1, characterized in that Also includes: Generate a first binary number sequence using the first encrypted value; Reversing the first binary number sequence bit by bit to generate a second binary number sequence; Generate a second encrypted value using the second binary number sequence; Second encrypted data is generated using the second encrypted value.
3. The method according to claim 2, characterized in that Also includes: Using the second encrypted value, calculate an arc length corresponding to the second encrypted value; The step of using the second encrypted value to calculate the arc length corresponding to the second encrypted value comprises: Determine the inner angle degree of the sector corresponding to the second encrypted value, and use the inner angle degree of the sector to calculate the arc length corresponding to the second encrypted value; Using the arc length and the time information, a third encrypted value is calculated based on a second time algorithm; The third encrypted data is generated by the third encrypted value.
4. The method according to claim 3, characterized in that: Also includes: Generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value; Fourth encrypted data is generated using the fourth encrypted value.
5. The method according to any one of claims 1 to 4, characterized in that: The time information is a key.
6. The method according to claim 1, characterized in that The unit data includes actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
7. A data encryption device, characterized in that: include: The encrypted data acquisition module is used to acquire the data to be encrypted and split the data to be encrypted into unit data; A data bit number determination module, used to determine the data bit number of the data to be encrypted by using the unit data; the data bit number is used to express the number of bits required to form the complete data to be encrypted by using the unit data; A sector generating module, used for dividing a circle by the number of data bits to generate a plurality of sectors; the sectors have corresponding angle interval values; the number of sectors is equal to the number of data bits; A unit data allocation module, used for randomly allocating the unit data to the sectors, so that a plurality of the unit data correspond to a plurality of the angle interval values one by one; A time information acquisition module, used to acquire time information, and use the time information to determine a first encryption value for the unit data in the angle interval value based on a first time algorithm; The first encrypted data generating module is used to generate first encrypted data for the data to be encrypted by using the first encrypted value.
8. The device according to claim 7, characterized in that Also includes: A first binary number sequence generating module, configured to generate a first binary number sequence using the first encrypted value; A second binary number sequence generating module, used for performing bit-by-bit inversion on the first binary number sequence to generate a second binary number sequence; A second encrypted value generating module, configured to generate a second encrypted value using the second binary number sequence; The second encrypted data generating module is used to generate second encrypted data according to the second encrypted value.
9. The device according to claim 8, characterized in that Also includes: An arc length calculation module, used to determine the inner angle degree of the sector corresponding to the second encrypted value, and use the inner angle degree of the sector to calculate the arc length corresponding to the second encrypted value; A third encrypted value calculation module, configured to calculate a third encrypted value based on a second time algorithm using the arc length and the time information; The third encrypted data generating module is used to generate third encrypted data through the third encrypted value.
10. The device according to claim 9, characterized in that Also includes: a fourth encrypted value generating module, configured to generate a fourth encrypted value by performing an XOR operation on the time information and the third encrypted value; The fourth encrypted data generating module is used to generate fourth encrypted data using the fourth encrypted value.
11. The device according to any one of claims 7 to 10, characterized in that: The time information is a key.
12. The device according to claim 7, characterized in that The unit data includes actual unit data used to actually express the data to be encrypted, and virtual unit data not used to actually express the data to be encrypted.
13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 6 when executing the program stored in the memory.
14. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data transmission method, electronic equipment and storage medium
CN110324143A
Password generation method and device, electronic equipment and storage medium
CN112564905A