CN106788993A - A kind of encryption communication method, device and electronic equipment - Google Patents
A kind of encryption communication method, device and electronic equipment Download PDFInfo
- Publication number
- CN106788993A CN106788993A CN201611109701.4A CN201611109701A CN106788993A CN 106788993 A CN106788993 A CN 106788993A CN 201611109701 A CN201611109701 A CN 201611109701A CN 106788993 A CN106788993 A CN 106788993A
- Authority
- CN
- China
- Prior art keywords
- character
- result
- password information
- codes
- splicing
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000004891 communication Methods 0.000 title claims abstract description 52
- 238000012163 sequencing technique Methods 0.000 claims description 7
- 239000013589 supplement Substances 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 8
- 238000005336 cracking Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 4
- 230000003993 interaction Effects 0.000 description 3
- 238000010295 mobile communication Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
- H04L9/0822—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using key encryption key
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/088—Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the present invention discloses a kind of encryption communication method, device and electronic equipment, in the method, obtains one or more encrypted messages used in each preset time period;The number of times that each character that counting one or more of encrypted messages includes occurs, and the corresponding encoded radio of each character according to the number of times acquisition that described each character occurs;It is determined that the corresponding encoded radio of each character occurred in needing the encrypted message encrypted, and the appearance order according to each character in the encrypted message, the corresponding encoded radio of described each character is spliced, encrypted result is determined according to splicing result and is stored.Encrypted message is encrypted by scheme disclosed in the embodiment of the present invention, the encrypted result of acquisition is difficult to be cracked with time cyclically-varying, so as to the encryption method for solving prior art use has great risk, the relatively low problem of security.
Description
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to an encrypted communication method, an encrypted communication device and electronic equipment.
Background
With the development of internet technology, the number of things that people can accomplish through internet technology is increasing. In order to meet the application requirements of users, in some internet projects, a plurality of electronic devices are usually connected to a target device (e.g., a server) through the internet, and the plurality of electronic devices can meet various requirements of users by performing information interaction with the target device. For example, electronic devices such as mobile phones, computers, smart televisions and the like can access the server through the internet to obtain information resources provided by the server, so that the requirements of users on the information resources are met.
In addition, the electronic device usually needs to register to perform various information interactions with the target device. In the registration process, the electronic equipment transmits the self account information and the password information to the target equipment. The target device receives the account information and the password information, encrypts the password information in sequence based on safety consideration, and stores the encrypted password information into a database.
However, in the process of implementing the embodiment of the present invention, the inventor finds that the target device mostly encrypts each piece of password information in the MD5 manner at present, in this case, the result obtained after encryption of each piece of password information is fixed, for example, if the password information to be encrypted is 123456, the result after encryption is e10adc3949ba59abbe56e057f20f883 e; if the password information to be encrypted is qazwsx, the result after encryption is 76419C58630D9F35DE7AC538C2FD 6737. The encryption mode is easy to crack, even a plurality of hackers make a rainbow table according to the MD5 encryption result of the common character string, and then directly perform reverse check according to the rainbow table. Therefore, the encryption method adopted by the target device at present has great risk and lower security.
Disclosure of Invention
The embodiment of the invention provides an encryption communication method, an encryption communication device and electronic equipment, and aims to solve the problems of great risk and low safety of an encryption method adopted in the prior art
The embodiment of the invention discloses the following technical scheme:
in a first aspect, an embodiment of the present invention provides an encrypted communication method, including:
acquiring one or more password information used in each preset time period;
counting the occurrence frequency of each character included in the one or more pieces of password information, and acquiring a code value corresponding to each character according to the occurrence frequency of each character;
determining a coded value corresponding to each character appearing in the password information to be encrypted, splicing the coded values corresponding to the characters according to the appearance sequence of the characters in the password information, and determining an encryption result according to a splicing result;
and storing the encryption result.
The method disclosed by the embodiment of the invention is used for encrypting the password information, and the obtained encryption result changes periodically along with time, so that the password information is not easy to crack, and the problems of great risk and low safety of the encryption method adopted by the prior art are solved.
Optionally, the counting the occurrence frequency of each character included in the one or more pieces of password information, and obtaining the code value corresponding to each character according to the occurrence frequency of each character includes:
after counting the occurrence times of each character included in the one or more password information, sorting each character according to the occurrence times of each character;
and performing binary-heap coding on each character according to the sequencing result, and acquiring a coding value corresponding to each character according to the coding result.
Optionally, the performing binary-heap coding on each character according to the sorting result, and acquiring a coding value corresponding to each character according to the coding result includes:
performing maximum stack coding on each character according to a sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and determining the code value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
Optionally, the determining an encryption result according to the splicing result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises m numbers, 0 or 1 is supplemented in a group of codes which is less than the m numbers, m is a preset positive integer, and a character string formed by each divided group of codes containing the m numbers is determined as the encryption result.
Through the steps, the splicing result can be further processed to obtain an encryption result, the cracking difficulty is improved, and therefore the safety can be improved.
Optionally, the determining an encryption result according to the splicing result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes with less than 4 numbers;
and respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
Through the steps, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, the safety can be improved, and in addition, each group of codes is respectively converted into a 16-system code, so the encryption result is simplified, and the occupation of a storage space is reduced.
In a second aspect, an embodiment of the present invention provides an encrypted communication apparatus, including:
the password information acquisition module is used for acquiring one or more password information used in each preset time period;
the code value acquisition module is used for counting the occurrence frequency of each character included in the one or more pieces of password information and acquiring the code value corresponding to each character according to the occurrence frequency of each character;
the encryption result determining module is used for determining the code value corresponding to each character appearing in the password information to be encrypted, splicing the code value corresponding to each character according to the appearance sequence of each character in the password information, and determining the encryption result according to the splicing result;
and the encryption result storage module is used for storing the encryption result.
The device disclosed by the embodiment of the invention is used for encrypting the password information, and the obtained encryption result changes periodically along with time, so that the password information is not easy to crack, and the problems of great risk and low safety of the encryption method adopted by the prior art are solved.
Optionally, the code value obtaining module includes:
the character sorting unit is used for sorting each character according to the occurrence frequency of each character after counting the occurrence frequency of each character included in the one or more password information;
and the binary heap coding unit is used for performing binary heap coding on each character according to the sequencing result and acquiring a coding value corresponding to each character according to the coding result.
Optionally, the binary heap encoding unit includes:
a maximum pile coding subunit, configured to perform maximum pile coding on each character according to the sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and the coded value determining subunit is used for determining the coded value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
Optionally, the encryption result determining module includes:
the first determining unit is used for dividing the splicing result after the splicing result is obtained, wherein each divided group of codes comprises m numbers, a group of codes which is less than m numbers supplements 0 or 1, m is a preset positive integer, and a character string formed by each divided group of codes containing m numbers is determined as the encryption result.
Through the first determining unit, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, and therefore the safety can be improved.
Optionally, the encryption result determining module includes:
the splicing unit is used for splicing the data, and acquiring a splicing result, wherein each group of divided codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes less than 4 numbers;
and the second determining unit is used for respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
Through dividing the unit and the second determination unit, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, and therefore the safety can be improved, and moreover, because each group of codes is respectively converted into a 16-system code, the encryption result is simplified, and the occupation of a storage space is reduced.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to:
acquiring one or more password information used in each preset time period;
counting the occurrence frequency of each character included in the one or more pieces of password information, and acquiring a code value corresponding to each character according to the occurrence frequency of each character;
determining a coded value corresponding to each character appearing in the password information to be encrypted, splicing the coded values corresponding to the characters according to the appearance sequence of the characters in the password information, and determining an encryption result according to a splicing result;
and storing the encryption result.
In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions for causing the computer to execute the encrypted communication method provided in any one of the embodiments of the first aspect.
In a fifth aspect, the present invention further provides a computer program product, where the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, when executed by a computer, cause the computer to execute the encrypted communication method provided in any one of the above embodiments of the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the embodiment of the invention discloses an encrypted communication method, an encrypted communication device and electronic equipment. In the method disclosed by the embodiment of the invention, the password information is encrypted once every preset time period, and in the encryption process, the code value corresponding to each character is determined according to the occurrence frequency of each character, and because the acquired password information is not fixed in each time period, the occurrence frequency of each character is not fixed, and correspondingly, the code value corresponding to each character is also not fixed, the splicing result of splicing the code values is not fixed, and the acquired encryption result also changes along with the time period. That is to say, the scheme disclosed by the embodiment of the invention is used for encrypting the password information, and the obtained encryption result is changed periodically, so that the password information is not easy to crack, and the problems of great risk and low safety of the encryption method adopted by the prior art are solved.
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 invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
Fig. 1 is a schematic view of an application scenario of an encrypted communication method according to an embodiment of the present invention;
fig. 2 is a schematic workflow diagram of an encrypted communication method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a workflow of acquiring an encoded value corresponding to each character in an encrypted communication method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of maximum heap encoding in an encryption communication method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an encrypted communication apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
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 invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The embodiment of the invention discloses an encryption communication method, an encryption communication device and electronic equipment, and aims to solve the problems of great risk and low safety of an encryption method adopted in the prior art.
The embodiment of the invention discloses an encryption communication method, which is applied to electronic equipment, wherein the electronic equipment can be a server and the like. Referring to an application scenario diagram shown in fig. 1, fig. 1 includes an electronic device 10 that executes the encrypted communication method disclosed in the embodiment of the present invention, and the electronic device 10 is connected to a plurality of other electronic devices 20 (for example, a mobile phone, a smart television, a vehicle-mounted terminal, and the like) through a network and is capable of receiving password information transmitted by the plurality of other electronic devices 20.
Referring to a work flow diagram shown in fig. 2, an encrypted communication method disclosed in the embodiment of the present invention includes the following steps:
and step S11, acquiring one or more password information used in each preset time period.
In the encryption communication method disclosed by the embodiment of the invention, encryption is carried out on the received password information at intervals of a preset time period.
The specific duration of the preset time period may be set according to actual requirements, which is not limited in the embodiments of the present invention. For example, the preset time period may be one week. Generally, the higher the safety requirement, the shorter the specific duration of the preset time period.
Step S12, counting the occurrence frequency of each character included in the one or more password information, and obtaining the code value corresponding to each character according to the occurrence frequency of each character.
The electronic equipment executing the encryption communication method disclosed by the embodiment of the invention can acquire the password information of a plurality of electronic equipment connected with the electronic equipment through a network. Each password information is composed of characters, so that the times of the characters in each password information can be accumulated, and the total times of the characters can be obtained.
And step S13, determining the code value corresponding to each character appearing in the password information needing to be encrypted, splicing the code value corresponding to each character according to the appearance sequence of each character in the password information, and determining the encryption result according to the splicing result.
In this step, the coded value corresponding to each character is spliced according to the occurrence order of each character, that is, if a certain character is located at the nth bit in the password information, that is, the occurrence order of the character is N, in this case, during splicing, the coded value corresponding to the character is also located at the nth bit. Wherein N is a positive integer.
And step S14, storing the encryption result.
The embodiment of the invention discloses an encryption communication method, in the method disclosed by the embodiment of the invention, password information is encrypted once every a preset time period, in addition, in the encryption process, the code value corresponding to each character is determined according to the occurrence frequency of each character, and because the acquired password information is not fixed in each time period, the occurrence frequency of each character is not fixed, correspondingly, the code value corresponding to each character is also not fixed, therefore, the splicing result of splicing the code values is not fixed, and the acquired encryption result also changes along with the time period. That is to say, the method disclosed by the embodiment of the invention is used for encrypting the password information, and the obtained encryption result changes periodically, so that the password information is not easy to crack, and the problems of great risk and low safety of the encryption method adopted by the prior art are solved.
As a refinement of the method of fig. 2, in another embodiment of the present invention, as shown in fig. 3, the step S12 of counting the occurrence number of each character included in the one or more pieces of password information and obtaining the encoded value corresponding to each character according to the occurrence number of each character generally includes the following steps:
step S121, after counting the occurrence frequency of each character included in the one or more pieces of password information, sorting each character according to the occurrence frequency of each character.
For example, each character may be sorted by the number of times it occurs, from large to small.
And step S122, performing binary-heap coding on each character according to the sequencing result, and acquiring a coding value corresponding to each character according to the coding result.
By the scheme from step S121 to step S122, the encoding value corresponding to each character can be acquired according to the binary heap encoding mode.
Further, the binary-heap coding is performed on each character according to the sorting result, and a coding value corresponding to each character is obtained through the coding result, including the following steps:
firstly, according to the sorting result, maximum pile coding is carried out on each character.
Each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are respectively the characters with the occurrence times which are only inferior to the two characters with the occurrence times of the father node, the characters with more occurrence times in the two child nodes are the children on the left side of the father node, the characters with less occurrence times in the two child nodes are the children on the right side of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1.
And then, determining the code value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
In the above scheme, the code value corresponding to each character can be obtained by maximum heap coding in the binary heap.
To elaborate how to obtain the encoding value corresponding to each character according to the maximum pile encoding, the following description is made by an example.
In this example, it is assumed that, after counting the number of occurrences of each character included in each password information by step S12, it is determined that a is 100 times in total, b is 80 times in total, C is 50 times in total, D is 20 times in total, f is 16 times in total, 8 is 12 times in total, and 3 is 10 times in total.
In this case, the maximum heap is constructed as shown in fig. 4, and since this character occurs the most frequently, a is the root node. Because two child nodes of each father node are respectively two characters with the occurrence frequency only second to the occurrence frequency of the father node, the character with more occurrence frequency in the two child nodes is the left child of the father node, the character with less occurrence frequency in the two child nodes is the right child of the father node, and a is taken as the father node, the two child nodes of a are respectively b and C, and because the occurrence frequency of b is more, the occurrence frequency of C is less, b is the left child of a, and C is the right child of a. Correspondingly, when b is taken as a parent node, two child nodes of b are respectively D and f, D is the left child of b, and f is the right child of b. Taking C as the parent, the two children nodes of C are 8 and 3, respectively, and 8 is the left child of C and 3 is the right child of C.
In addition, since the key value of the root node is 1, the key value of each left child node is 0, and the key value of each right child node is 1, the key value of the root node a is 1, the key value of b is 0, the key value of C is 1, the key value of D is 0, the key value of f is 1, the key value of 8 is 0, and the key value of 3 is 1.
According to the maximum heap and the key value of the node corresponding to each character, it can be determined that the code value corresponding to a is 1, the code value corresponding to b is 10, the code value corresponding to C is 11, the code value corresponding to D is 100, the code value corresponding to f is 101, the code value corresponding to 8 is 110, and the code value corresponding to 3 is 111.
In addition, in the encryption communication method disclosed in the embodiment of the present invention, a step of splicing the coded values corresponding to each character according to the occurrence order of each character in the password information and determining the encryption result according to the splicing result is also disclosed. In practical applications, the encryption result can be obtained in various ways.
In one mode, the determining an encryption result according to the splicing result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises m numbers, 0 or 1 is supplemented in a group of codes which is less than the m numbers, m is a preset positive integer, and a character string formed by each divided group of codes containing the m numbers is determined as the encryption result.
For example, according to the above example, it is determined that a corresponds to a code value of 1, b corresponds to a code value of 10, C corresponds to a code value of 11, D corresponds to a code value of 100, f corresponds to a code value of 101, 8 corresponds to a code value of 110, and 3 corresponds to a code value of 111. In this case, if the password information to be encrypted is apdcbf 83, the concatenation result of the encoded value corresponding to each character in the password information after concatenation is 11001110101110111. Assuming that m is 4, a group of codes with less than m numbers is supplemented with 0, the splicing result is divided into 1,1001,1101,0111,0111, and since the number of the first group of codes is less than four, three 0 s are supplemented before the first group of codes, so that 0001,1001,1101,0111,0111 is obtained. 0001,1001,1101,0111,0111 is the encryption result.
Through the steps, the splicing result can be further processed to obtain an encryption result, the cracking difficulty is improved, and therefore the safety can be improved.
In another mode, the determining an encryption result according to the splicing result includes the following steps:
firstly, after a splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes with less than 4 numbers.
Then, each divided group of codes is converted into a 16-system code, the converted number of each group of codes is obtained, and a character string formed by the converted number of each group of codes is determined as the encryption result.
For example, in the above example, after obtaining 0001,1001,1101,0111,0111 groups of codes, each group may be converted into 16-ary code, so as to obtain 19b77, and the character string is the final encryption result.
Through the steps, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, the safety can be improved, and in addition, each group of codes is respectively converted into a 16-system code, so the encryption result is simplified, and the occupation of a storage space is reduced.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.
The embodiment of the invention discloses an encryption communication device, which is shown in a schematic structural diagram shown in fig. 5 and comprises: a password information acquisition module 100, an encoding value acquisition module 200, an encryption result determination module 300, and an encryption result storage module 400.
The password information obtaining module 100 is configured to obtain one or more password information used in each preset time period.
The specific duration of the preset time period may be set according to actual requirements, which is not limited in the embodiments of the present invention. For example, the preset time period may be one week. Generally, the higher the safety requirement, the shorter the specific duration of the preset time period.
The code value obtaining module 200 is configured to count the occurrence frequency of each character included in the one or more pieces of password information, and obtain a code value corresponding to each character according to the occurrence frequency of each character.
The encryption result determining module 300 is configured to determine an encoded value corresponding to each character appearing in the password information to be encrypted, splice the encoded values corresponding to each character according to an appearance sequence of each character in the password information, and determine an encryption result according to a splicing result.
In the module, according to the occurrence order of each character, the coded value corresponding to each character is spliced, that is, if a certain character is located at the nth bit in the password information, that is, the occurrence order of the character is N, in this case, during splicing, the coded value corresponding to the character is also located at the nth bit. Wherein N is a positive integer.
The device disclosed by the embodiment of the invention is used for encrypting the password information, and the obtained encryption result changes periodically along with time, so that the encryption result is not easy to crack, and the problems of great risk and low safety of the encryption method adopted by the prior art are solved.
Further, in the encryption communication apparatus disclosed in the embodiment of the present invention, the code value acquiring module includes:
the character sorting unit is used for sorting each character according to the occurrence frequency of each character after counting the occurrence frequency of each character included in the one or more password information;
and the binary heap coding unit is used for performing binary heap coding on each character according to the sequencing result and acquiring a coding value corresponding to each character according to the coding result.
Further, the binary heap encoding unit includes:
a maximum pile coding subunit, configured to perform maximum pile coding on each character according to the sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and the coded value determining subunit is used for determining the coded value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
In the encryption communication apparatus disclosed in the embodiment of the present invention, the encryption result determining module may be implemented in various forms. In one form thereof, the encryption result determination module comprises:
the first determining unit is used for dividing the splicing result after the splicing result is obtained, wherein each divided group of codes comprises m numbers, a group of codes which is less than m numbers supplements 0 or 1, m is a preset positive integer, and a character string formed by each divided group of codes containing m numbers is determined as the encryption result.
Through the first determining unit, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, and therefore the safety can be improved.
In another form the encryption result determination module includes:
the splicing unit is used for splicing the data, and acquiring a splicing result, wherein each group of divided codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes less than 4 numbers;
and the second determining unit is used for respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
Through dividing the unit and the second determination unit, the splicing result can be further processed to obtain an encryption result, the difficulty of cracking is improved, and therefore the safety can be improved, and moreover, because each group of codes is respectively converted into a 16-system code, the encryption result is simplified, and the occupation of a storage space is reduced.
In another embodiment of the present invention, an electronic device is disclosed, the electronic device including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to:
acquiring one or more password information used in each preset time period;
counting the occurrence frequency of each character included in the one or more pieces of password information, and acquiring a code value corresponding to each character according to the occurrence frequency of each character;
determining a coded value corresponding to each character appearing in the password information to be encrypted, splicing the coded values corresponding to the characters according to the appearance sequence of the characters in the password information, and determining an encryption result according to a splicing result;
and storing the encryption result.
Further, the counting the occurrence frequency of each character included in the one or more password information, and obtaining the code value corresponding to each character according to the occurrence frequency of each character includes:
after counting the occurrence times of each character included in the one or more password information, sorting each character according to the occurrence times of each character;
and performing binary-heap coding on each character according to the sequencing result, and acquiring a coding value corresponding to each character according to the coding result.
Further, the performing binary-heap encoding on each character according to the sorting result, and acquiring an encoded value corresponding to each character according to the encoding result includes:
performing maximum stack coding on each character according to a sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and determining the code value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
Further, the determining an encryption result according to the splicing result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises m numbers, 0 or 1 is supplemented in a group of codes which is less than the m numbers, m is a preset positive integer, and a character string formed by each divided group of codes containing the m numbers is determined as the encryption result.
Further, the determining an encryption result according to the splicing result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes with less than 4 numbers;
and respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
Embodiments of the present invention provide a non-transitory computer storage medium storing computer-executable instructions that can perform the encryption communication method in any of the above method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Accordingly, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to execute the encrypted communication method provided in any one of the above embodiments.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device for executing an encrypted communication method according to an embodiment of the present invention, where as shown in fig. 6, the electronic device includes:
one or more processors 610 and a memory 620, with one processor 610 being an example in fig. 6.
The apparatus for performing the encryption communication method may further include: an input device 630 and an output device 640.
The processor 610, the memory 620, the input device 630, and the output device 640 may be connected by a bus or other means, such as the bus connection in fig. 6.
The memory 620, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the encryption communication method in the embodiment of the present invention (for example, the cryptographic information acquisition module 100, the encoded value acquisition module 200, the encryption result determination module 300, and the encryption result storage module 400 shown in fig. 5). The processor 610 executes various functional applications of the server and data processing, i.e., implements the encryption communication method in any of the above-described method embodiments, by executing the nonvolatile software program, instructions, and modules stored in the memory 620.
The memory 620 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the encryption communication apparatus, and the like. Further, the memory 620 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 620 optionally includes memory located remotely from processor 610, which may be connected to the encrypted communications device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 630 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the encryption communication apparatus. The output device 640 may include a display device such as a display screen.
The one or more modules are stored in the memory 620 and, when executed by the one or more processors 610, perform the encrypted communication method of any of the method embodiments described above.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
The electronic device of embodiments of the present invention exists in a variety of forms, including but not limited to:
(1) mobile communication devices, which are characterized by mobile communication capabilities and are primarily targeted at providing voice and data communications. Such terminals include smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) The ultra-mobile personal computer equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include PDA, MID, and UMPC devices, etc., such as ipad.
(3) Portable entertainment devices such devices may display and play multimedia content. Such devices include audio and video players (e.g., ipods), handheld game consoles, electronic books, as well as smart toys and portable car navigation devices.
(4) The server is similar to a general computer architecture, but has higher requirements on processing capability, stability, reliability, safety, expandability, manageability and the like because of the need of providing highly reliable services.
(5) And other electronic devices with data interaction functions.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions substantially or contributing to the related art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (11)
1. An encrypted communication method, comprising:
acquiring one or more password information used in each preset time period;
counting the occurrence frequency of each character included in the one or more pieces of password information, and acquiring a code value corresponding to each character according to the occurrence frequency of each character;
determining a coded value corresponding to each character appearing in the password information to be encrypted, splicing the coded values corresponding to the characters according to the appearance sequence of the characters in the password information, and determining an encryption result according to a splicing result;
and storing the encryption result.
2. The encrypted communication method according to claim 1, wherein the counting the number of occurrences of each character included in the one or more pieces of password information, and obtaining the encoded value corresponding to each character according to the number of occurrences of each character includes:
after counting the occurrence times of each character included in the one or more password information, sorting each character according to the occurrence times of each character;
and performing binary-heap coding on each character according to the sequencing result, and acquiring a coding value corresponding to each character according to the coding result.
3. The encrypted communication method according to claim 2, wherein the performing binary-heap encoding on each character according to the sorting result, and obtaining the encoded value corresponding to each character according to the encoding result includes:
performing maximum stack coding on each character according to a sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and determining the code value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
4. The encrypted communication method according to claim 1, wherein the determining the encryption result based on the concatenation result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises m numbers, 0 or 1 is supplemented in a group of codes which is less than the m numbers, m is a preset positive integer, and a character string formed by each divided group of codes containing the m numbers is determined as the encryption result.
5. The encrypted communication method according to claim 1, wherein the determining the encryption result based on the concatenation result includes:
after the splicing result is obtained, the splicing result is divided, wherein each divided group of codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes with less than 4 numbers;
and respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
6. An encrypted communication apparatus, comprising:
the password information acquisition module is used for acquiring one or more password information used in each preset time period;
the code value acquisition module is used for counting the occurrence frequency of each character included in the one or more pieces of password information and acquiring the code value corresponding to each character according to the occurrence frequency of each character;
the encryption result determining module is used for determining the code value corresponding to each character appearing in the password information to be encrypted, splicing the code value corresponding to each character according to the appearance sequence of each character in the password information, and determining the encryption result according to the splicing result;
and the encryption result storage module is used for storing the encryption result.
7. The encrypted communication apparatus according to claim 6, wherein the code value acquisition module includes:
the character sorting unit is used for sorting each character according to the occurrence frequency of each character after counting the occurrence frequency of each character included in the one or more password information;
and the binary heap coding unit is used for performing binary heap coding on each character according to the sequencing result and acquiring a coding value corresponding to each character according to the coding result.
8. The encrypted communication device according to claim 7, wherein the binary heap encoding unit includes:
a maximum pile coding subunit, configured to perform maximum pile coding on each character according to the sorting result;
each node of the maximum heap formed by encoding is the character, the root node is the character with the most occurrence times, two child nodes of each father node are the characters with the occurrence times only second to the occurrence times of the father node, the character with the more occurrence times in the two child nodes is the left child of the father node, the character with the less occurrence times in the two child nodes is the right child of the father node, the key value of the root node is 1, the key value of each child node on the left side is 0, and the key value of each child node on the right side is 1;
and the coded value determining subunit is used for determining the coded value corresponding to each character according to the maximum heap and the key value of the node corresponding to each character.
9. The encrypted communication apparatus according to claim 6, wherein the encryption result determination module includes:
the first determining unit is used for dividing the splicing result after the splicing result is obtained, wherein each divided group of codes comprises m numbers, a group of codes which is less than m numbers supplements 0 or 1, m is a preset positive integer, and a character string formed by each divided group of codes containing m numbers is determined as the encryption result.
10. The encrypted communication apparatus according to claim 6, wherein the encryption result determination module includes:
the splicing unit is used for splicing the data, and acquiring a splicing result, wherein each group of divided codes comprises 4 numbers, and 0 or 1 is supplemented in a group of codes less than 4 numbers;
and the second determining unit is used for respectively converting each group of divided codes into a 16-system code, acquiring the converted numbers of each group of codes, and determining a character string formed by the converted numbers of each group of codes as the encryption result.
11. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to:
acquiring one or more password information used in each preset time period;
counting the occurrence frequency of each character included in the one or more pieces of password information, and acquiring a code value corresponding to each character according to the occurrence frequency of each character;
determining a coded value corresponding to each character appearing in the password information to be encrypted, splicing the coded values corresponding to the characters according to the appearance sequence of the characters in the password information, and determining an encryption result according to a splicing result;
and storing the encryption result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611109701.4A CN106788993A (en) | 2016-12-02 | 2016-12-02 | A kind of encryption communication method, device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611109701.4A CN106788993A (en) | 2016-12-02 | 2016-12-02 | A kind of encryption communication method, device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106788993A true CN106788993A (en) | 2017-05-31 |
Family
ID=58878254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611109701.4A Pending CN106788993A (en) | 2016-12-02 | 2016-12-02 | A kind of encryption communication method, device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106788993A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109428603A (en) * | 2017-08-30 | 2019-03-05 | 前海中科芯片控股(深圳)有限公司 | A kind of data-encoding scheme, device and storage medium |
CN114124465A (en) * | 2021-10-28 | 2022-03-01 | 济南浪潮数据技术有限公司 | Data transmission method, system, equipment and computer readable storage medium |
CN114297693A (en) * | 2021-12-30 | 2022-04-08 | 北京海泰方圆科技股份有限公司 | Model pre-training method and device, electronic equipment and storage medium |
CN114978560A (en) * | 2021-02-24 | 2022-08-30 | 中国联合网络通信集团有限公司 | Plaintext cipher encryption and decryption method, device, equipment, medium and product |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1994023385A2 (en) * | 1993-03-30 | 1994-10-13 | Adrian Stafford Lewis | Data compression and decompression |
CN103702133A (en) * | 2013-12-19 | 2014-04-02 | Tcl集团股份有限公司 | Image compression display method and image compression display device |
CN104219228A (en) * | 2014-08-18 | 2014-12-17 | 四川长虹电器股份有限公司 | User registration and user identification method and user registration and user identification system |
-
2016
- 2016-12-02 CN CN201611109701.4A patent/CN106788993A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1994023385A2 (en) * | 1993-03-30 | 1994-10-13 | Adrian Stafford Lewis | Data compression and decompression |
CN103702133A (en) * | 2013-12-19 | 2014-04-02 | Tcl集团股份有限公司 | Image compression display method and image compression display device |
CN104219228A (en) * | 2014-08-18 | 2014-12-17 | 四川长虹电器股份有限公司 | User registration and user identification method and user registration and user identification system |
Non-Patent Citations (3)
Title |
---|
康洪波: "静态哈夫曼编码的原理及应用", 《河北建筑工程学院学报》 * |
江忠: "哈夫曼树Hufferman构成原理应用及其数学证明", 《科技广场》 * |
王防修: "多元哈夫曼编码在加密技术中的应用", 《计算机安全》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109428603A (en) * | 2017-08-30 | 2019-03-05 | 前海中科芯片控股(深圳)有限公司 | A kind of data-encoding scheme, device and storage medium |
CN114978560A (en) * | 2021-02-24 | 2022-08-30 | 中国联合网络通信集团有限公司 | Plaintext cipher encryption and decryption method, device, equipment, medium and product |
CN114978560B (en) * | 2021-02-24 | 2023-07-18 | 中国联合网络通信集团有限公司 | Plaintext cipher encryption and decryption method, device, equipment and medium |
CN114124465A (en) * | 2021-10-28 | 2022-03-01 | 济南浪潮数据技术有限公司 | Data transmission method, system, equipment and computer readable storage medium |
CN114297693A (en) * | 2021-12-30 | 2022-04-08 | 北京海泰方圆科技股份有限公司 | Model pre-training method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7138726B2 (en) | Blockchain consensus methods, accounting nodes and nodes | |
CN106788993A (en) | A kind of encryption communication method, device and electronic equipment | |
CN102981627A (en) | Password inputting method and password inputting device | |
CN107846289B (en) | Method, electronic equipment and system for supporting artificial participation block chain decision | |
US10579837B2 (en) | Method, device and electronic apparatus for testing capability of analyzing a two-dimensional code | |
CN104143068A (en) | Password authentication method and system | |
CN104866601A (en) | Serial number generating method and device | |
CN106896933B (en) | method and device for converting voice input into text input and voice input equipment | |
CN107182042B (en) | Short message channel quality evaluation method, device, medium and system | |
CN103379206A (en) | Handheld device and data sharing achieving method thereof | |
CN109033285A (en) | Information-pushing method and device | |
CN112380510A (en) | Information verification method and device, electronic equipment and storage medium | |
CN105141627A (en) | Data sending and receiving method, device and equipment | |
CN106971296B (en) | Method for processing information object, electronic equipment and storage medium | |
CN109741756B (en) | Method and system for transmitting operation signal based on USB external equipment | |
CN110022327B (en) | Short message authentication test method and device | |
CN108882239B (en) | Information sending method and device | |
CN106815741A (en) | A kind of advertisement placement method, device and electronic equipment | |
CN111494956B (en) | Task data acquisition method and device and electronic equipment | |
US10565366B2 (en) | Numerical verification code generation method and device | |
CN104376481B (en) | A kind of method and device obtaining service authority | |
US10553062B2 (en) | Method for generating winning numbers and apparatus | |
CN104281792A (en) | Methods and systems for logging into electronic account and generating electronic login credential | |
CN102005001A (en) | Login method, device and system of internet bank | |
CN107665293B (en) | Multi-user account switching method and mobile terminal |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170531 |