CN113486379A - Information encryption method, device, medium and electronic equipment - Google Patents

Information encryption method, device, medium and electronic equipment Download PDF

Info

Publication number
CN113486379A
CN113486379A CN202110837703.XA CN202110837703A CN113486379A CN 113486379 A CN113486379 A CN 113486379A CN 202110837703 A CN202110837703 A CN 202110837703A CN 113486379 A CN113486379 A CN 113486379A
Authority
CN
China
Prior art keywords
encrypted
character
information
characters
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110837703.XA
Other languages
Chinese (zh)
Inventor
季瑞军
朱坤
黎万英
陈守益
张霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202110837703.XA priority Critical patent/CN113486379A/en
Publication of CN113486379A publication Critical patent/CN113486379A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/157Transformation using dictionaries or tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Bioethics (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • Storage Device Security (AREA)

Abstract

The application relates to the field of data security, and discloses an information encryption method, an information encryption device, an information encryption medium and electronic equipment. The method comprises the following steps: acquiring first information to be encrypted; sequentially converting each character to be encrypted in the first information into corresponding binary data according to the ASCII code comparison table to obtain a first binary sequence corresponding to the first information; sequentially intercepting the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups; converting the binary data in each group into decimal data; taking the decimal data as an index, finding out characters corresponding to the decimal data from the first character index comparison table, and using the characters as encrypted characters; and generating first encrypted information corresponding to the first information according to the encrypted characters. The method has low computational complexity and high encryption safety, and the encrypted data is not easy to crack, thereby improving the data security.

Description

Information encryption method, device, medium and electronic equipment
Technical Field
The present application relates to the field of data security technologies, and in particular, to an information encryption method, apparatus, medium, and electronic device.
Background
With the development of the internet and information technology, the amount of data generated by humans is growing exponentially, and a big data age has come.
Data security is becoming increasingly important as the volume of data production continues to increase. However, at present, a part of the encryption algorithm has been disclosed, resulting in that the encrypted data is easily cracked; the other part of the encryption algorithm is not easy to crack, but has high computational complexity, so that a large amount of computing resources are consumed.
Disclosure of Invention
In order to solve the above technical problems in the technical field of data security, the present application aims to provide an information encryption method, apparatus, medium and electronic device.
According to an aspect of the present application, there is provided a method of encrypting information, the method including:
acquiring first information to be encrypted;
sequentially converting each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information, wherein the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information;
sequentially intercepting the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups, wherein when the part which is not intercepted in the first binary sequence is less than 6 bits, the 6 bits are complemented by 0 after the part which is not intercepted so as to form the last group obtained by dividing the first binary sequence;
converting the binary data in each group into decimal data;
searching characters corresponding to the decimal data from a first character index comparison table by taking the decimal data as an index, wherein the first character index comparison table comprises 64 characters and an index corresponding to each character;
and generating first encrypted information corresponding to the first information according to the encrypted characters.
According to another aspect of the present application, there is provided an apparatus for encrypting information, the apparatus including:
an acquisition module configured to acquire first information to be encrypted;
the first conversion module is configured to sequentially convert each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information, wherein the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information;
the dividing module is configured to sequentially intercept the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups, wherein when the part which is not intercepted in the first binary sequence is less than 6 bits, 6 bits are complemented by 0 after the part which is not intercepted so as to form a last group obtained by dividing the first binary sequence;
a second conversion module configured to convert the binary data in the respective groups into decimal data;
the searching module is configured to search characters corresponding to the decimal data from a first character index comparison table by taking the decimal data as an index, wherein the first character index comparison table comprises 64 characters and an index corresponding to each character;
and the generating module is configured to generate first encrypted information corresponding to the first information according to the encrypted characters.
According to another aspect of the present application, there is provided a computer readable program medium storing computer program instructions which, when executed by a computer, cause the computer to perform the method as previously described.
According to another aspect of the present application, there is provided an electronic device including:
a processor;
a memory having computer readable instructions stored thereon which, when executed by the processor, implement the method as previously described.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the information encryption method provided by the application comprises the following steps: acquiring first information to be encrypted; sequentially converting each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information, wherein the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information; sequentially intercepting the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups, wherein when the part which is not intercepted in the first binary sequence is less than 6 bits, the 6 bits are complemented by 0 after the part which is not intercepted so as to form the last group obtained by dividing the first binary sequence; converting the binary data in each group into decimal data; searching characters corresponding to the decimal data from a first character index comparison table by taking the decimal data as an index, wherein the first character index comparison table comprises 64 characters and an index corresponding to each character; and generating first encrypted information corresponding to the first information according to the encrypted characters.
According to the method, characters to be encrypted in information are converted into binary data to obtain a binary sequence, the binary sequence is divided into a plurality of groups by taking 6-bit binary data as one group, after the binary data of each group are converted into decimal data, encrypted characters corresponding to the decimal data are found through table lookup, and finally the encrypted characters are used for generating encrypted information. Therefore, the information encryption method provided by the application is simple in calculation process and low in calculation complexity, the whole encryption process involves multiple data conversion, encryption is finally carried out according to the first character index comparison table comprising 64 characters, and the corresponding relation between the characters and the indexes in the first character index comparison table cannot be obtained by a third party, so that the encryption safety is high, encrypted data is not easy to crack, and the data safety is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is a system architecture diagram illustrating a method of encrypting information in accordance with an exemplary embodiment;
FIG. 2 is a flow chart illustrating a method of encrypting information in accordance with an example embodiment;
FIG. 3 is a schematic diagram illustrating a manner of byte conversion in accordance with an illustrative embodiment;
FIG. 4 is a detailed schematic diagram illustrating a manner of byte conversion in accordance with an illustrative embodiment;
FIG. 5 is a block diagram illustrating an apparatus for encrypting information in accordance with an illustrative embodiment;
FIG. 6 is a block diagram illustrating an example of an electronic device implementing the encryption method of the information described above, according to an example embodiment;
fig. 7 is a program product illustrating an implementation of the encryption method of the above information according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
Furthermore, the drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities.
The application firstly provides an information encryption method. Encryption is to change the original information data by a special algorithm, so that even if an unauthorized user obtains the encrypted information, the content of the information cannot be known because the unauthorized user does not know the decryption method. That is, the encrypted information can be generated by the encryption method of the information provided by the present application, and the encrypted information is distinct from the original information.
The implementation terminal of the present application may be any device having an operation function, which may be connected to an external device for receiving or sending data, and specifically may be a portable mobile device, such as a smart phone, a tablet computer, a notebook computer, a pda (personal Digital assistant), or the like, or may be a fixed device, such as a computer device, a field terminal, a desktop computer, a server, a workstation, or the like, or may be a set of multiple devices, such as a physical infrastructure of cloud computing or a server cluster.
Optionally, the implementation terminal of the present application may be a server or a physical infrastructure of cloud computing.
Fig. 1 is a system architecture diagram illustrating a method of encrypting information according to an example embodiment. As shown in fig. 1, the system architecture includes a server 110 and a user terminal 120 connected by a communication link. The server 110 may transmit data to the user terminal 120 and may receive data from the user terminal 120 via a communication link. The same character index comparison table is stored in both the server 110 and the user terminal 120, when the server 110 sends data to the user terminal 120, the server 110 encrypts the original data to be sent by using the locally stored character index comparison table, and then sends the encrypted data to the user terminal 120, after receiving the encrypted data sent by the server 110, the user terminal 120 decrypts the encrypted data by using the locally stored character index comparison table, so as to obtain the original data. Similarly, when the user terminal 120 sends data to the server 110, the original data is encrypted by using the locally stored character index comparison table and then sent to the server 110, and the server 110 decrypts the received data according to the locally stored character index comparison table.
It is worth mentioning that fig. 1 is only one embodiment of the present application. Although the terminal that performs encryption and decryption is the server in the present embodiment, in other embodiments, the terminal that performs encryption and decryption may be various terminals or devices as described above; although in the present embodiment, the same data is encrypted and decrypted by different terminals, in other embodiments or specific applications, the same data may be encrypted and decrypted by the same terminal; although in this embodiment, after data is encrypted by one terminal, the encrypted data is immediately sent to the terminal that needs to be decrypted, in other embodiments, after data is encrypted by one terminal, the encrypted data may not be immediately sent to the terminal that needs to be decrypted, for example, the encrypted data may be sent to one data storage terminal first, and then the other terminal that needs to be decrypted obtains data from the data storage terminal as needed to be decrypted in time. The present application is not limited in this respect, and the scope of protection of the present application should not be limited thereby.
Fig. 2 is a flow chart illustrating a method of encrypting information according to an example embodiment. The information encryption method provided in this embodiment may be executed by a server, as shown in fig. 2, and includes the following steps:
step 210, obtaining first information to be encrypted.
The first information is information to be encrypted by the encryption method of the information provided by the embodiment of the present application, that is, plaintext information. The first information may be various types of information, such as text, video, pictures, etc.
And step 220, sequentially converting each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information.
Binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information.
ASCII (American Standard Code for Information exchange Code, American Standard Code for Information Interchange) is a set of computer Code systems based on Latin letters. The ASCII code reference table includes at least characters and binary data corresponding to each character, but may also include other types of data, such as octal data, decimal data, hexadecimal data, etc. corresponding to each character.
By searching the ASCII code comparison table, binary data corresponding to the characters to be encrypted can be found, and the binary data corresponding to the characters to be encrypted is 8-bit binary data.
For example, if a character to be encrypted is an upper case letter a, the binary data corresponding to the character to be encrypted in the ASCII code comparison table is 01000001; if a character to be encrypted is capital letter E, the binary data corresponding to the character to be encrypted in the ASCII code lookup table is 01000101.
The binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information, that is, if the first character to be encrypted in the first information is the previous character of the second character to be encrypted, the binary data corresponding to the second character to be encrypted in the first binary sequence is located before the binary data corresponding to the first character to be encrypted and is close to the binary data corresponding to the first character to be encrypted.
If the number of the characters to be encrypted in the first information is N, the number of bits of the binary number in the first binary sequence is 8N.
And step 230, sequentially intercepting the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups.
Wherein, when the non-truncated part of the first binary sequence is less than 6 bits, the 6 bits are complemented by 0 after the non-truncated part to form a final group divided by the first binary sequence.
In one embodiment, after dividing the first binary sequence into a plurality of groups, the method further comprises:
for each group, two bits, 0, are added before the binary data in the group.
This embodiment complements each set of binary data with two 0's, which is advantageous in that each set of binary data can be stored in a one byte (8bit) manner.
Fig. 3 is a diagram illustrating a byte conversion manner according to an exemplary embodiment, where the upper half of fig. 3 is original data before conversion, and the lower half of fig. 3 is encoded data after conversion. Please refer to the upper part of fig. 3, which shows byte 1, byte 2, and byte 3, respectively, and the index number of the bit included in each byte, each byte is binary data corresponding to each character to be encrypted, the index number included in byte 1 is 01234567, which represents the index corresponding to the binary data of 8 bits in byte 1. Therefore, the original data includes 3 bytes, each byte is 8 bits, and the original data composed of byte 1, byte 2, and byte 3 corresponds to the first binary sequence.
After the original data is obtained, it is necessary to intercept the original data by using a 6-bit binary system as a group in order from the high order to the low order, so as to form encoded data, that is, multiple groups of binary data.
With continued reference to the lower half of fig. 3, byte 1, byte 2, byte 3, and byte 4 are shown, respectively, each byte being a set of binary data resulting from the truncation of the original data. These bytes also contain a string of numbers representing the corresponding index of the binary data divided into the group in the upper half of fig. 3, and 0 bits added before the binary data divided into the group. For example, for byte 1 in the lower half of fig. 3, it contains a string of numbers 00012345, where "012345" is the index corresponding to the binary data in byte 1 in the upper half of fig. 3, which means that the binary data in byte 1 in the lower half of fig. 3 contains the binary data corresponding to the index of "012345" in the upper half of fig. 3, and "00" is 0 bit added before the binary data, so that the binary data in byte 1 can reach 8 bits. The other bytes in the lower half of fig. 3 are similar. The binary data in the bytes in the lower half of fig. 3 may come from two bytes shown in the upper half of fig. 3 at the same time, the two bytes being adjacent. For example, for byte 2 in the lower half of FIG. 3, the binary data contained therein has an index "670123", where the index "67" is from byte 1 in the upper half of FIG. 3 and the index "0123" is from byte 2 in the upper half of FIG. 3, which represents that byte 2 in the lower half of FIG. 3 contains the following data: binary data corresponding to an index of "67" in byte 1 of the upper half of fig. 3, and binary data corresponding to an index of "0123" in byte 2 of the upper half of fig. 3.
And finally, intercepting the original data by taking 6-bit binary data as a group, and supplementing 0 before each group of intercepted binary data to form a new group of binary data, thereby finally obtaining encoded data, wherein the encoded data comprises four bytes, and each byte is 8 bits (bit).
FIG. 4 is a detailed schematic diagram illustrating a manner of byte conversion in accordance with an example embodiment. The process of intercepting and partitioning the raw data is further described below in conjunction with fig. 4. The original data comprises 3 bytes, byte 1, byte 2 and byte 3, each byte comprising 8-bit binary data, with indices of 0-7. Then, according to the sequence from the high order to the low order, taking a binary system of 6 bits as a group, intercepting the original data to form new data, which are respectively byte 1, byte 2, byte 3 and byte 4, wherein the data in byte 1 of the new data is the data corresponding to the indexes 0-5 in byte 1 of the original data, and so on. After the original data is intercepted, two 0's are added to the high bits of each group of 6-bit binary data to obtain new data.
Step 240, converting the binary data in each group into decimal data.
For example, when the binary data in a group is 00010100, the decimal data obtained by converting the binary data in the group is 20.
And step 250, taking the decimal data as an index, finding out characters corresponding to the decimal data from the first character index comparison table, and using the characters as encrypted characters.
Wherein, the first character index comparison table comprises 64 characters and an index corresponding to each character.
Numerical value Character(s) Numerical value Character(s) Numerical value Character(s) Numerical value Character(s)
0 A 16 Q 32 g 48 w
1 B 17 R 33 h 49 x
2 C 18 S 34 i 50 y
3 D 19 T 35 j 51 z
4 E 20 U 36 k 52 0
5 F 21 V 37 l 53 1
6 G 22 W 38 m 54 2
7 H 23 X 39 n 55 3
8 I 24 Y 40 o 56 4
9 J 25 Z 41 p 57 5
10 K 26 a 42 q 58 6
11 L 27 b 43 r 59 7
12 M 28 c 44 s 60 8
13 N 29 d 45 t 61 9
14 O 30 e 46 u 62 +
15 P 31 f 47 v 63 /
TABLE 1
Table 1 shows a first character index look-up table. Referring to table 1, the numerical value before each character represents the index corresponding to the character. It can be seen that the correspondence between the characters and the indexes in table 1 is regular, for example, a is arranged before B in the normal alphabet, and correspondingly, the index corresponding to the character a in table 1 is 1 smaller than the index corresponding to the character B.
In order to make the encryption method of the information provided by the embodiment of the present application safer, the corresponding relationship between the characters and the indexes in table 1 can be adjusted, even disturbed completely.
Figure BDA0003177761670000081
Figure BDA0003177761670000091
TABLE 2
Table 2 shows another first character index comparison table. Table 2 may be obtained by shuffling the correspondence between the characters and the index in table 1. Referring to table 2, it can be seen that the correspondence between the characters and the indexes is irregular, and therefore, the security of the encryption can be further improved by using table 2 as the first character index comparison table.
Step 260, generating first encrypted information corresponding to the first information according to the encrypted character.
In one embodiment, the generating first encrypted information corresponding to the first information according to the encrypted character includes:
and arranging the encrypted characters according to the arrangement sequence of the binary data corresponding to each encrypted character to obtain first encrypted information corresponding to the first information.
In an embodiment of the application, the generating, according to the encrypted character, first encrypted information corresponding to the first information includes:
and arranging the encrypted characters in a reverse order according to the arrangement order of the binary data corresponding to each encrypted character to obtain first encrypted information corresponding to the first information.
By arranging the encrypted characters in reverse order, the security of information encryption can be further improved.
In an embodiment of the application, the generating, according to the encrypted character, first encrypted information corresponding to the first information further includes:
arranging the encrypted characters according to the arrangement sequence of binary data corresponding to the encrypted characters to form an encrypted character sequence;
adding at least one preset character after the encrypted character sequence according to the condition that the number of the characters to be encrypted in the first information is not an integral multiple of 3, so that the number of the characters in the character sequence formed after the preset character is added is the minimum value of integral multiple of 4 in integers larger than the number of the characters in the encrypted character sequence;
and taking the character sequence as first encrypted information corresponding to the first information.
Figure BDA0003177761670000101
TABLE 3
The present embodiment will be described with reference to table 3. Table 3 shows the process of encrypting the text "JR" with text J corresponding to decimal ASCII encoding 74 and text R corresponding to decimal ASCII encoding 82. Firstly, converting J into corresponding binary data of 01001010 and converting R into corresponding binary data of 01010010 according to an ASCII code comparison table; then, using 6-bit binary as a group, dividing binary data corresponding to the text "JR" to form multiple groups of binary data, firstly intercepting the binary data to 010010, then intercepting to 100101, and finding that only 0010 is left in the part which is not intercepted, and the bit is less than 6, so that 6 bits need to be complemented; next, each set of binary data is converted into decimal data, and indexes 18, 37 and 8 are obtained; finally, searching a first character index comparison table to find encrypted characters corresponding to each index, wherein the encrypted characters are d, q and H respectively, and an encrypted character sequence is formed; since the number of characters to be encrypted in the text "JR" is 2 and not an integer multiple of 3, after the encrypted character sequence "dqH" is generated, the number of characters included in the character sequence "dqH" is increased by "dqH", the number of characters included in the character sequence "dqH" is 4, and the number of characters in the character sequence "dqH" is 3, so that the number of characters in the character sequence "dqH" is the minimum value of the integer multiple of 4 in an integer greater than 3.
Although the predetermined character is in the present embodiment, in other embodiments, the character may be in other various types.
By making the number of characters in the finally obtained character sequence "dqH ═ an integral multiple of 4, the computer can smoothly perform processing and transmission.
Figure BDA0003177761670000111
TABLE 4
The process of encrypting the text "JRJ" is described below in conjunction with table 4. Text J corresponds to a decimal ASCII code of 74 and text R corresponds to a decimal ASCII code of 82. Firstly, converting J into corresponding binary data of 01001010 and converting R into corresponding binary data of 01010010 according to an ASCII code comparison table; then, dividing binary data corresponding to the text "JRJ" into a group of 6-bit binary data to form a plurality of groups of binary data; next, each set of binary data is converted into decimal data to obtain indexes, wherein the indexes are respectively 18, 37, 9 and 10; and finally, searching a first character index comparison table to find the encrypted characters corresponding to each index, namely d, q, G and F, and finally obtaining the encrypted information of 'dqGF'.
In one embodiment, the method further comprises:
according to the received second encrypted information, searching an index corresponding to each encrypted character in the second encrypted information from the first character index comparison table;
converting each of the indices into corresponding sets of 6-bit binary data;
sequentially arranging the groups of 6-bit binary data according to the arrangement sequence of the encrypted characters in the second encrypted information to obtain a second binary sequence;
sequentially intercepting the second binary sequence by taking 8-bit binary data as a group according to a sequence so as to divide the second binary sequence into a plurality of groups, wherein when the part which is not intercepted in the second binary sequence is less than 8 bits and each bit is 0, the part which is not intercepted is removed;
converting each group of 8-bit binary data into corresponding decimal data;
determining characters corresponding to each decimal data according to an ASCII code comparison table, wherein the characters are used as decrypted characters;
and sequentially arranging the decrypted characters according to the arrangement sequence of the encrypted characters in the second encrypted information to obtain second information obtained by decrypting the second encrypted information.
In this embodiment, decryption processing of the second encrypted message is implemented, where the decryption processing is the reverse of the message encryption processing, and when the second encrypted message includes the added predetermined character, the predetermined character may be removed first, and then decryption processing is performed.
In one embodiment, the characters in the first character index lookup table are printable characters, and after generating first encrypted information corresponding to the first information according to the encrypted characters, the method further includes:
and sending the first encrypted information to a target terminal through a network so that the target terminal decrypts the first encrypted information based on the first character index comparison table stored in advance.
Because the characters in the first character index comparison table are printable characters, the encrypted first encrypted information is composed of printable characters, and thus the first encrypted information can be transmitted through a Hypertext Transfer Protocol (HTTP) network.
In one embodiment, the method further comprises:
adjusting the corresponding relation between the characters and the indexes in the first character index comparison table to obtain a second character index comparison table;
and sending the second character index comparison table to the target terminal.
The corresponding relation between one or more characters and the index in the first character index comparison table can be adjusted, and even the corresponding relation between the characters and the index in the first character index comparison table can be disturbed.
After the second character index comparison table is sent to the target terminal, the target terminal can start to communicate by using the second character index comparison table, so that data safety can be guaranteed even if other people obtain the first character index comparison table.
In one embodiment, the sending the second character index lookup table to the target terminal includes:
and encrypting the second character index comparison table based on the first character index comparison table, and sending the encrypted second character index comparison table to the target terminal, so that the target terminal decrypts the encrypted second character index comparison table based on the prestored first character index comparison table to obtain the second character index comparison table.
In this embodiment, the newly generated second character index comparison table is encrypted by using the first character index comparison table when being transmitted, so that the security of the second character index comparison table when being transmitted is ensured.
In one embodiment, the method further comprises: and adjusting the corresponding relation between the characters and the indexes in the character index comparison table regularly, and sending the character index comparison table generated after adjustment to the target terminal.
The embodiment ensures the security of information encryption by regularly updating the character index comparison table.
In one embodiment, the method further comprises: and periodically receiving the character index comparison table from the server, and replacing the locally stored character index comparison table with the character index comparison table from the server.
In the embodiment, the character index comparison table is updated and maintained by the server, so that the maintenance by a common terminal is avoided, and the security of information encryption is improved.
In one embodiment, the method further comprises:
sending identification information of a target terminal to a server so that the server can send a third character index comparison table to a home terminal and the target terminal respectively according to the identification information;
and carrying out encrypted communication with the target terminal based on the third character index comparison table.
In this embodiment, each time the current terminal needs to communicate with the target terminal, the request server sends the same character index comparison table to the current terminal and the target terminal, so that different character index comparison tables can be used for encryption each time the current terminal communicates with the external terminal, thereby further improving the security of data.
To sum up, the information encryption method provided by the embodiment of the application has the advantages that the calculation process is simple, the calculation complexity is low, the whole encryption process involves multiple data conversion, encryption is finally carried out according to the first character index comparison table comprising 64 characters, and the corresponding relation between the characters and the indexes in the first character index comparison table cannot be obtained by a third party, so that the encryption safety is high, encrypted data is not easy to crack, and the data safety is improved.
The application also provides an information encryption device, and the following device embodiments are provided.
Fig. 5 is a block diagram illustrating an apparatus for encrypting information according to an example embodiment. As shown in fig. 5, the apparatus 500 includes:
an obtaining module 510 configured to obtain first information to be encrypted;
a first conversion module 520, configured to sequentially convert each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table, so as to obtain a first binary sequence corresponding to the first information, where the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the order of the character to be encrypted in the first information;
a dividing module 530 configured to sequentially intercept the first binary sequence by using 6-bit binary data as a group according to the arrangement order of the binary data to divide the first binary sequence into a plurality of groups, wherein when the part of the first binary sequence that is not intercepted is less than 6 bits, the 6 bits are complemented by 0 after the part that is not intercepted to form a last group divided by the first binary sequence;
a second conversion module 540 configured to convert the binary data in the respective groups into decimal data;
a searching module 550 configured to search, as an encrypted character, a character corresponding to the decimal data from a first character index comparison table using the decimal data as an index, where the first character index comparison table includes 64 characters and an index corresponding to each character;
a generating module 560 configured to generate first encrypted information corresponding to the first information according to the encrypted character.
According to a third aspect of the present application, there is also provided an electronic device capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 600 according to this embodiment of the present application is described below with reference to fig. 6. The electronic device 600 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the electronic device 600 is embodied in the form of a general purpose computing device. The components of the electronic device 600 may include, but are not limited to: the at least one processing unit 610, the at least one memory unit 620, and a bus 630 that couples the various system components including the memory unit 620 and the processing unit 610.
Wherein the storage unit stores program code that can be executed by the processing unit 610, such that the processing unit 610 performs the steps according to various exemplary embodiments of the present application described in the section "example methods" above in this specification.
The storage unit 620 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)621 and/or a cache memory unit 622, and may further include a read only memory unit (ROM) 623.
The storage unit 620 may also include a program/utility 624 having a set (at least one) of program modules 625, such program modules 625 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 630 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 600 may also communicate with one or more external devices 800 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 600, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 600 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 650, such as with a display unit 640. Also, the electronic device 600 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 660. As shown, the network adapter 660 communicates with the other modules of the electronic device 600 over the bus 630. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiments of the present application.
According to a fourth aspect of the present application, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the present application may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the present application described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
Referring to fig. 7, a program product 700 for implementing the above method according to an embodiment of the present application is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the present application, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for encrypting information, the method comprising:
acquiring first information to be encrypted;
sequentially converting each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information, wherein the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information;
sequentially intercepting the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups, wherein when the part which is not intercepted in the first binary sequence is less than 6 bits, the 6 bits are complemented by 0 after the part which is not intercepted so as to form the last group obtained by dividing the first binary sequence;
converting the binary data in each group into decimal data;
searching characters corresponding to the decimal data from a first character index comparison table by taking the decimal data as an index, wherein the first character index comparison table comprises 64 characters and an index corresponding to each character;
and generating first encrypted information corresponding to the first information according to the encrypted characters.
2. The method according to claim 1, wherein the generating first encrypted information corresponding to the first information according to the encrypted character comprises:
and arranging the encrypted characters according to the arrangement sequence of the binary data corresponding to each encrypted character to obtain first encrypted information corresponding to the first information.
3. The method according to claim 2, wherein the generating first encrypted information corresponding to the first information according to the encrypted character further comprises:
arranging the encrypted characters according to the arrangement sequence of binary data corresponding to the encrypted characters to form an encrypted character sequence;
adding at least one preset character after the encrypted character sequence according to the condition that the number of the characters to be encrypted in the first information is not an integral multiple of 3, so that the number of the characters in the character sequence formed after the preset character is added is the minimum value of integral multiple of 4 in integers larger than the number of the characters in the encrypted character sequence;
and taking the character sequence as first encrypted information corresponding to the first information.
4. The method of claim 2, further comprising:
according to the received second encrypted information, searching an index corresponding to each encrypted character in the second encrypted information from the first character index comparison table;
converting each of the indices into corresponding sets of 6-bit binary data;
sequentially arranging the groups of 6-bit binary data according to the arrangement sequence of the encrypted characters in the second encrypted information to obtain a second binary sequence;
sequentially intercepting the second binary sequence by taking 8-bit binary data as a group according to a sequence so as to divide the second binary sequence into a plurality of groups, wherein when the part which is not intercepted in the second binary sequence is less than 8 bits and each bit is 0, the part which is not intercepted is removed;
converting each group of 8-bit binary data into corresponding decimal data;
determining characters corresponding to each decimal data according to an ASCII code comparison table, wherein the characters are used as decrypted characters;
and sequentially arranging the decrypted characters according to the arrangement sequence of the encrypted characters in the second encrypted information to obtain second information obtained by decrypting the second encrypted information.
5. The method according to claim 1, wherein the characters in the first character index lookup table are printable characters, and after generating first encrypted information corresponding to the first information according to the encrypted characters, the method further comprises:
and sending the first encrypted information to a target terminal through a network so that the target terminal decrypts the first encrypted information based on the first character index comparison table stored in advance.
6. The method of claim 5, further comprising:
adjusting the corresponding relation between the characters and the indexes in the first character index comparison table to obtain a second character index comparison table;
and sending the second character index comparison table to the target terminal.
7. The method according to claim 6, wherein the sending the second character index lookup table to the target terminal comprises:
and encrypting the second character index comparison table based on the first character index comparison table, and sending the encrypted second character index comparison table to the target terminal, so that the target terminal decrypts the encrypted second character index comparison table based on the prestored first character index comparison table to obtain the second character index comparison table.
8. An apparatus for encrypting information, the apparatus comprising:
an acquisition module configured to acquire first information to be encrypted;
the first conversion module is configured to sequentially convert each character to be encrypted in the first information into corresponding binary data according to an ASCII code comparison table to obtain a first binary sequence corresponding to the first information, wherein the binary data corresponding to each character to be encrypted in the first binary sequence are sequentially arranged according to the sequence of the character to be encrypted in the first information;
the dividing module is configured to sequentially intercept the first binary sequence by taking 6-bit binary data as a group according to the arrangement sequence of the binary data so as to divide the first binary sequence into a plurality of groups, wherein when the part which is not intercepted in the first binary sequence is less than 6 bits, 6 bits are complemented by 0 after the part which is not intercepted so as to form a last group obtained by dividing the first binary sequence;
a second conversion module configured to convert the binary data in the respective groups into decimal data;
the searching module is configured to search characters corresponding to the decimal data from a first character index comparison table by taking the decimal data as an index, wherein the first character index comparison table comprises 64 characters and an index corresponding to each character;
and the generating module is configured to generate first encrypted information corresponding to the first information according to the encrypted characters.
9. A computer-readable program medium, characterized in that it stores computer program instructions which, when executed by a computer, cause the computer to perform the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory having stored thereon computer readable instructions which, when executed by the processor, implement the method of any of claims 1 to 7.
CN202110837703.XA 2021-07-23 2021-07-23 Information encryption method, device, medium and electronic equipment Pending CN113486379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110837703.XA CN113486379A (en) 2021-07-23 2021-07-23 Information encryption method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110837703.XA CN113486379A (en) 2021-07-23 2021-07-23 Information encryption method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113486379A true CN113486379A (en) 2021-10-08

Family

ID=77943411

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110837703.XA Pending CN113486379A (en) 2021-07-23 2021-07-23 Information encryption method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113486379A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115761649A (en) * 2022-12-14 2023-03-07 北京数原数字化城市研究中心 Information processing method and device, electronic equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115761649A (en) * 2022-12-14 2023-03-07 北京数原数字化城市研究中心 Information processing method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
WO2019095416A1 (en) Information pushing method and apparatus, and terminal device and storage medium
WO2020233033A1 (en) Information interaction method, device and storage medium
US8769302B2 (en) Encrypting data and characterization data that describes valid contents of a column
US10521144B2 (en) Data block storage by splitting file content and file headers for independent storage
US8891760B2 (en) System for checking acceptance of string by automaton
CN115017107A (en) Data retrieval method and device based on privacy protection, computer equipment and medium
CN112016104B (en) Encryption method, device and system for financial sensitive data
CN113111341A (en) Account sharing and login method and device
CN113536327A (en) Data processing method, device and system
CA3061776A1 (en) Key information processing method and apparatus, electronic device and computer readable medium
CN113486379A (en) Information encryption method, device, medium and electronic equipment
CN114881247A (en) Longitudinal federal feature derivation method, device and medium based on privacy computation
CN116825259B (en) Medical data management method based on Internet of things
CN112436943B (en) Request deduplication method, device, equipment and storage medium based on big data
CN114329536A (en) Data encryption method and device, data decryption method and device, and electronic equipment
US8077868B2 (en) Mechanism for transport-safe codings for cryptographic use
CN110086633B (en) Ciphertext anti-tampering method in block chain technology
CN112953716A (en) Method and device for generating and verifying exchange code
CN115860768A (en) Tracing method and device based on block chain and electronic equipment thereof
CN116010984A (en) Multiple encryption storage method, device and equipment for relational database data
CN111931205A (en) Method and device for encrypting shader file
CN114840739A (en) Information retrieval method, information retrieval device, electronic equipment and storage medium
CN112242978B (en) Method and device for processing data
CN114357520A (en) File generation method and device and file coding information sending method and device
CN114611120A (en) Data encryption method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination