CN105100085A - Information encryption and decryption methods and devices - Google Patents

Information encryption and decryption methods and devices Download PDF

Info

Publication number
CN105100085A
CN105100085A CN201510394602.4A CN201510394602A CN105100085A CN 105100085 A CN105100085 A CN 105100085A CN 201510394602 A CN201510394602 A CN 201510394602A CN 105100085 A CN105100085 A CN 105100085A
Authority
CN
China
Prior art keywords
character
character string
string
ascii
prime number
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.)
Granted
Application number
CN201510394602.4A
Other languages
Chinese (zh)
Other versions
CN105100085B (en
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.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software Co 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 Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN201510394602.4A priority Critical patent/CN105100085B/en
Publication of CN105100085A publication Critical patent/CN105100085A/en
Application granted granted Critical
Publication of CN105100085B publication Critical patent/CN105100085B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation

Abstract

The invention provides information encryption and decryption methods and devices. The information encryption method comprises the steps of determining a first character string corresponding to original information; converting each character in the first character string into an American standard code for information interchange (ASCII) code corresponding to the character; performing prime number quotient processing on each ASCII code in a second character string; and replacing corresponding ASCII code in the second character string with the prime number quotient result and corresponding prime number, so as to obtain encrypted information of a third character string form. Through adoption of the method, the security of the character string can be improved.

Description

A kind of method and apparatus that information is encrypted and decrypted
Technical field
The present invention relates to the network communications technology, particularly a kind of method and apparatus that information is encrypted and decrypted.
Background technology
Along with the development of the network communications technology, amount of information magnanimity increases.Transmission information between frequent needs two equipment in a network.In order to the fail safe of guarantee information transmission, need to be encrypted information in encryption side, and in decryption side, information is decrypted.
At present, the method for information encryption and deciphering is comprised: generate encryption key and corresponding decruption key in advance; Use encryption key to be encrypted information in encryption side, then the information after encryption is sent to decryption side by encryption side; Decryption side uses decruption key to be decrypted the information received.
In prior art, use cipher key pair information to carry out the mode of encryption and decryption too simply, cause Information Security not high.
Summary of the invention
The invention provides a kind of method and apparatus that information is encrypted and decrypted, can Information Security be improved.
A kind of information ciphering method, comprising:
Determine the first character string that raw information is corresponding;
Each character in first character string is converted to ASCII character corresponding to this character respectively, obtains the second character string;
Carrying out prime number respectively to each ASCII character in the second character string asks business to process;
Asked by prime number the result of business and the prime number of correspondence to replace ASCII character corresponding in the second character string, obtain the information after the encryption of three-character doctrine string form.
First character string corresponding to described raw information is: the character string after utilizing the first PKI pre-set to be encrypted original character string.
Describedly prime number carried out respectively to each ASCII character in the second character string ask business to process to comprise:
For each ASCII character described, perform one by one by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, until obtain first business of dividing exactly;
Described prime number asks the result of business to comprise: described first business of dividing exactly;
Described prime number asks prime number corresponding to the result of business to comprise: obtain described first divide exactly business time, as the prime number of current divisor.
Described each character in first character string is converted to ASCII character corresponding to this character respectively before, comprise further: determine that M is replaced position; The original character that M that determines described in first character string is replaced on position is replaced with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string;
Then, described the ASCII character that each character in first character string is converted to this character corresponding respectively to be comprised: each character in revised first character string is converted to ASCII character corresponding to this character respectively.
Replace position for the described M of determination to comprise:
According to a described default M substitute character, determine M the ASCII character that this M substitute character is corresponding respectively, determine that described M is replaced position according to this M ASCII character.
A kind of information decryption method, comprising:
For the information after the encryption of the three-character doctrine string form received, be that a unit splits described three-character doctrine string often to set a character;
The each unit split out is carried out prime number and ask the inverse process of business, obtain the ASCII character that each unit is corresponding;
Replace each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtain the second character string;
ASCII character each in second character string is converted to corresponding character, obtains the raw information that the first character string is corresponding.
Described ASCII character each in second character string is converted to corresponding character after, obtain the first character string after utilizing the first public key encryption; The raw information obtaining the first character string then corresponding comprises: utilize the first private key corresponding to the first PKI pre-set to be decrypted the first character string, obtain the raw information of character string forms.
A described setting character is three characters;
The described prime number that carried out by each unit split out asks the inverse process of business to comprise:
The first two character string in each unit split out is converted to numeral and ask product with the 3rd numeral that character string converts to.
Described ASCII character each in second character string is converted to corresponding character after, and described obtain raw information corresponding to the first character string before, comprise further:
For revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string.
A kind of information encryption device, comprising:
Raw information character string determining unit, for determining the first character string that raw information is corresponding;
ASCII character converting unit, for each character of the first character string is converted to ASCII character corresponding to this character respectively, obtains the second character string;
Prime number asks business's processing unit, carrying out prime number respectively for each ASCII character in the second character string of obtaining ASCII character converting unit asks business to process, ASCII character corresponding in the second character string that the prime number being asked by prime number business's processing unit to obtain asks the prime number of the result of business and correspondence replacement ASCII character converting unit to obtain, obtains the information after the encryption of three-character doctrine string form.
Described prime number asks business's processing unit to comprise: the first computation subunit and ASCII replace subelement,
First computation subunit, for when performing described prime number and asking business to process, for each ASCII character described, performs by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, one by one until obtain first business of dividing exactly;
ASCII replaces subelement, for for each ASCII character, first business of dividing exactly of the correspondence obtained by the first computation subunit and obtain described first divide exactly business time as the prime number of current divisor, replace corresponding ASCII character;
And/or,
Preset characters replacement unit is connected with, for determining that M is replaced position between described raw information character string determining unit and described ASCII character converting unit; M that determined described in the first character string described raw information character string determining unit the obtained original character replaced on position replaces with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string, revised first character string is inputted described ASCII character converting unit; Then,
Each character of revised first character string is converted to ASCII character corresponding to this character by described ASCII character converting unit respectively.
A kind of decrypts information device, comprising:
Split cells, for the information after the encryption for the three-character doctrine string form received, is that a unit splits described three-character doctrine string often to set a character;
Prime number asks business against processing unit, asking the inverse process of business, obtaining the ASCII character that each unit is corresponding, replacing each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtaining the second character string for each unit split out being carried out prime number;
Character conversion unit, in the second character string obtained against processing unit for prime number being asked business, each ASCII character is converted to corresponding character, obtains the raw information that the first character string is corresponding.
Described split cells is that a unit splits described three-character doctrine string with every three characters; Then described prime number asks business to comprise against processing unit: the second computation subunit,
Second computation subunit, asks product for the first two character string in each unit split out being converted to numeral with the 3rd numeral that character string converts to.
Described character conversion unit comprises further: preset characters is inverse replaces subelement, for for revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string.
Visible, method and apparatus information being carried out to encryption and decryption that the embodiment of the present invention proposes, can carry out the conversion of character to ASCII character based on ASCII character to raw information, and the character string after changing is carried out to prime number and asked business to process, this kind of cipher mode makes information safer, not easily cracks.
Accompanying drawing explanation
Fig. 1 is to the flow chart that information is encrypted in one embodiment of the invention.
Fig. 2 is to the flow chart that information is decrypted in one embodiment of the invention.
Fig. 3 is that in one embodiment of the invention, encryption side and decryption side coordinate the flow chart realizing information encryption and decryption.
Fig. 4 is the structural representation of the side of encryption in one embodiment of the invention.
Fig. 5 is the another kind of structural representation of the side of encryption in one embodiment of the invention.
Fig. 6 is the structural representation of decryption side in one embodiment of the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described.Obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
One embodiment of the invention proposes a kind of information ciphering method, see Fig. 1, comprising:
Step 101: determine the first character string that raw information is corresponding.
Step 102: each character in the first character string is converted to ASCII character corresponding to this character respectively, obtains the second character string.
Step 103: prime number is carried out respectively to each ASCII character in the second character string and asks business to process.
Step 104: asked by prime number the result of business and the prime number of correspondence to replace ASCII character corresponding in the second character string, obtain the information after the encryption of three-character doctrine string form.
In an embodiment of the invention, for raw information to be encrypted, in order to improve the fail safe of encryption, the raw information of the first PKI to character string forms pre-set can also be first utilized to be encrypted further, thus obtain the first character string, that is, the first character string that described raw information is corresponding is: the character string after utilizing the first PKI pre-set to be encrypted original character string.
In an embodiment of the invention, in step 103, describedly prime number carried out respectively to each ASCII character in the second character string ask business to process can to comprise:
For each ASCII character described, perform one by one by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, until obtain first business of dividing exactly;
Described prime number asks the result of business to comprise: described first business of dividing exactly;
Described prime number asks prime number corresponding to the result of business to comprise: obtain described first divide exactly business time, as the prime number of current divisor.
Certainly, in other embodiments of the invention, other the mode prime number performed in step 103 also can be adopted to ask business to process.Such as, by obtain second business of dividing exactly instead of first business of dividing exactly, ask the result of business as prime number, meanwhile, obtain described second divide exactly business time, using the prime number etc. that the prime number of current divisor asks the result of business corresponding as described prime number.
In an embodiment of the invention, in order to improve the fail safe of information further, before each character in first character string being converted to ASCII character corresponding to this character respectively described in step 102, character can being carried out further and replace process, comprise: determine that M is replaced position; The original character that M that determines described in first character string is replaced on position is replaced with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string;
Then, described in step 102, the ASCII character that each character in first character string is converted to this character corresponding is respectively comprised: each character in revised first character string is converted to ASCII character corresponding to this character respectively.
In an embodiment of the invention, the described M of determination replacement position comprises:
According to a described default M substitute character, determine M the ASCII character that this M substitute character is corresponding respectively, determine that described M is replaced position according to this M ASCII character.
One embodiment of the invention also proposed a kind of information decryption method, see Fig. 2, comprising:
Step 201: for the information after the encryption of the three-character doctrine string form received is that a unit splits described three-character doctrine string often to set a character.
Step 202: each unit split out is carried out prime number and ask the inverse process of business, obtain the ASCII character that each unit is corresponding.
Step 203: replace each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtains the second character string.
Step 204: ASCII character each in the second character string is converted to corresponding character, obtains the raw information that the first character string is corresponding.
In an embodiment of the invention, step 204 described ASCII character each in second character string is converted to corresponding character after, utilized the first character string after the first public key encryption in advance; The raw information obtaining the first character string then corresponding comprises: utilize the first private key corresponding to the first PKI pre-set to be decrypted the first character string, obtain the raw information of character string forms.
In an embodiment of the invention, in step 201, a described setting character is three characters;
In an embodiment of the invention, in step 202, the described prime number that carried out by each unit split out asks the inverse process of business to comprise:
The first two character string in each unit split out is converted to numeral and ask product with the 3rd numeral that character string converts to.
In an embodiment of the invention, in step 204, described ASCII character each in second character string is converted to corresponding character after, and described obtain raw information corresponding to the first character string before, inverse process can be replaced by execution character further, comprise:
For revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string.
Below in conjunction with the cooperation handling process of encryption side with decryption side, and use double-encryption mode (secret key encryption and the encryption based on ASCII character) to be example, the process of in the embodiment of the present invention, information being carried out to encryption and decryption be described, see Fig. 3, comprise:
Step 301: generate public private key pair in advance, will wherein be kept in encryption side by the first PKI, and be kept in decryption side by the first private key corresponding to the first PKI.
Step 302: pre-set M substitute character, and M is replaced position, wherein, M is positive integer.
Such as, M the substitute character pre-set is 6 letters, is respectively I, N, S, P, U, R.
M is replaced position can be the fixed position preset, the 1st, 3,5,7,9,11 position in such as character string.
Preferably, replacing position for M can also determine according to substitute character, such as, according to described 6 default substitute characters, determines 6 ASCII character that these 6 substitute characters are corresponding respectively, the value of these 6 ASCII character is defined as described M and replaces position.
Step 303: encryption policy, to current raw information to be encrypted, determines the first character string that this raw information is corresponding.
Here, raw information to be encrypted can be exactly character string forms, such as video flowing, the various request msgs transmitted in the Internet.
Certainly, raw information to be encrypted may not be character string forms, now, in this step, according to the rule preset, the raw information of non-character string form can be converted to character string forms, thus performs subsequent treatment.
In addition, in this step, in order to improve cryptographic security further, the first PKI pre-set first can also be utilized to be encrypted to current raw information to be encrypted, the character string obtained after encryption is the first character string.
Following execution step 304 is to the process of replacing based on character of step 305.
Step 304: the original character preset on M position in the first character string is replaced with M substitute character by encryption side respectively.
Step 305: the described original character that M is replaced is added the end of the character string after character replacement by encryption side, obtains revised first character string.
In conjunction with the example of above-mentioned steps 302, in step 304 and step 305, M described substitute character is the character string of preset six bit lengths, is all made up of capitalization: INSPUR.The decimal system ASCII corresponding to these six alphabetical INSPUR obtains, and obtains 73,78,83,80,85,82 6 numerals.Therefore, by the 73rd in the first character string, 78,83,80,85, the original character (being such as OPQRST) on 82 positions replaces with I, N, S, P, U, R respectively; Further, original character OPQRST is added the end of character string.
Such as, the first character string comprises: AB ... O ... U.So, revised first character string that this step obtains comprises:
AB…I…N…S…P…U…R…UOPQRST。
Step 306: each character in the first character string after amendment is just converted to ASCII character corresponding to this character by encryption side respectively, obtains the second character string.
Such as, revised first character string comprises: AB ... I ... N ... S ... P ... U ... R ... UOPQRST.Then A is wherein converted to the ASCII character 65 of its correspondence, B is wherein converted to the ASCII character 66 of its correspondence, I is wherein converted to the ASCII character 73 of its correspondence, T is wherein converted to the ASCII character 84 of its correspondence, like this, the second character string obtained comprises: 6566 ... 73 ... 84 (below for ease of describing, being designated as the second character string and comprising: 6566 ... 84).
Below, execution step 307 asks business to process to the prime number of step 308.
Step 307: encryption policy, to each ASCII character in the second character string, performs by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, one by one until obtain first business of dividing exactly.
Such as, the second character string comprises: 6566 ... 84.
So, for first ASCII character 65, from the prime number 3 being greater than 1, use 65 ÷ 3 successively, indivisible, then 65 ÷ 5=13, can eliminate, then obtaining first business of dividing exactly is 13, and corresponding prime number is 5.In like manner, for next ASCII character 66, from the prime number 3 being greater than 1, use 66 ÷ 3=22 successively, can eliminate, then obtaining first business of dividing exactly is 22, and corresponding prime number is 3.By that analogy, until for last ASCII character 84 in the second character string, first business of dividing exactly obtaining its correspondence is 28, and corresponding prime number is 3.
Step 308: encryption policy is to each ASCII character in the second character string, prime number is asked the prime number of the result of business (i.e. first business of dividing exactly) and correspondence (namely obtain described first divide exactly business time, prime number as current divisor) replace ASCII character corresponding in the second character string, obtain three-character doctrine string.
Such as, can by the second character string: 6566 ... 84, generate three-character doctrine string after replacing: 135223 ... 283.
Step 309: encryption side sends the information of three-character doctrine string form.
Step 310: decryption side, for the information of the three-character doctrine string form received, is that a unit splits described three-character doctrine string with every 3 characters.
Such as, three-character doctrine string: 135223 ... 283.Split three-character doctrine string, split out 135,223 ... 283.
Step 311: the first two character string in each unit split out is converted to numeral and asks product with the 3rd numeral that character string converts to by decryption side, obtains the ASCII character that each unit is corresponding.
Here, for split out 135, use 13 × 5=65, obtain the ASCII character 65 that first unit is corresponding, for split out 223, use 22 × 3=66, obtain the ASCII character 66 that first unit is corresponding.By that analogy, until obtain ASCII character corresponding to last unit 84.
Step 312: the decryption side ASCII character that each unit is corresponding replaces this each unit, obtains the second character string.
Here, obtain the second character string to comprise: 6566 ... 84.
Step 313: ASCII character each in the second character string is converted to corresponding character by decryption side, obtains amended first character string.
Here, because the second character string comprises: 6566 ... 84, will wherein 65,66 ... 84 replace with corresponding character respectively, obtain revised first character string and comprise: AB ... T (the i.e. AB of step 306 place description ... I ... N ... S ... P ... U ... R ... UOPQRST).
Step 314: decryption side by the character on default M position in revised first character string respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string, thus obtain raw information corresponding to the first character string.
Corresponding to the process of step 304 and step 305, in this step 314, such as can comprise: by revised first character string the 73rd, 78,83, I on 80,85,82 these 6 positions, N, S, P, U, R replace with last M position character O respectively, P, Q, R, S, T, and, delete the O of the 6th last M position of character string, P, Q, R, S, T.
Here, if in step 303, raw information to be encrypted is not character string forms, then, in this step 314, according to the rule preset, the first character string can be converted to the raw information of non-character string form.
In addition, if in step 303, use the first PKI to encrypt raw information, then in a step 314, need to use the first private key pre-set to be decrypted, thus obtain raw information.
One embodiment of the invention also proposed a kind of information encryption device, see Fig. 4, comprising:
Raw information character string determining unit 401, for determining the first character string that raw information is corresponding;
ASCII character converting unit 402, each character for the first character string described raw information character string determining unit 401 determined is converted to ASCII character corresponding to this character respectively, obtains the second character string;
Prime number asks business's processing unit 403, carrying out prime number respectively for each ASCII character in the second character string of obtaining ASCII character converting unit 402 asks business to process, ASCII character corresponding in the second character string that the prime number being asked by prime number business's processing unit to obtain asks the prime number of the result of business and correspondence replacement ASCII character converting unit to obtain, obtains the information after the encryption of three-character doctrine string form.
In an embodiment of the invention, described prime number asks business's processing unit 403 to comprise: the first computation subunit and ASCII replace subelement,
First computation subunit, for when performing described prime number and asking business to process, for each ASCII character described, performs by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, one by one until obtain first business of dividing exactly;
ASCII replaces subelement, for for each ASCII character, first business of dividing exactly of the correspondence obtained by the first computation subunit and obtain described first divide exactly business time as the prime number of current divisor, replace corresponding ASCII character.
See Fig. 5, in an embodiment of the invention, between described raw information character string determining unit 401 and described ASCII character converting unit 402, be connected with preset characters replacement unit 501, for determining that M is replaced position; M that determined described in the first character string described raw information character string determining unit 401 the obtained original character replaced on position replaces with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string, revised first character string is inputted described ASCII character converting unit 402; Then,
Each character of revised first character string is converted to ASCII character corresponding to this character by described ASCII character converting unit 402 respectively.
One embodiment of the invention also proposed a kind of decrypts information device, see Fig. 6, comprising:
Split cells 601, for the information after the encryption for the three-character doctrine string form received, is that a unit splits described three-character doctrine string often to set a character;
Prime number asks business against processing unit 602, each unit for being split out by split cells 601 carries out prime number and asks the inverse process of business, obtain the ASCII character that each unit is corresponding, replace each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtain the second character string;
Character conversion unit 603, in the second character string obtained against processing unit 602 for prime number being asked business, each ASCII character is converted to corresponding character, obtains the raw information that the first character string is corresponding.
In an embodiment of the invention, described split cells 601 can be that a unit splits described three-character doctrine string with every three characters; Then described prime number asks business to comprise against processing unit 602: the second computation subunit,
Second computation subunit, asks product for the first two character string in each unit split out being converted to numeral with the 3rd numeral that character string converts to.
In an embodiment of the invention, described character conversion unit 603 comprises further: preset characters is inverse replaces subelement, for for revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string, thus obtain raw information corresponding to the first character string.
Also proposed a kind of information transmission system in an embodiment of the invention, comprise any one encryption side that the embodiment of the present invention proposes, and any one decryption side that the embodiment of the present invention proposes.
It should be noted that, in various embodiments of the present invention, can be the information of any one form by the information of encryption and decryption, such as Media Stream, the message transmitted between each server in mobile communication for another example.In addition, by the information of encryption and decryption can also be specifically need use software time, need send application code or when needing to collect software application, need send active coding etc.
Each embodiment of the present invention at least has following beneficial effect:
1, the embodiment of the present invention can carry out the conversion of character to ASCII character based on ASCII character to raw information, and the character string after conversion is carried out to prime number and asked business to process, and this kind of cipher mode makes information safer, not easily cracks.
2, in the embodiment of the present invention, on basis information is encrypted based on ASCII character, public private key pair can also be utilized further to carry out encryption and decryption process, further increase the fail safe of information.
3, in the embodiment of the present invention, in order to improve the fail safe of information interaction further, M substitute character can be replaced with respectively further to the original character of a default M position, and M described original character is added character string end, corresponding inverse process is then carried out in deciphering, thus further increases the fail safe of information.
It should be noted that, in this article, the relational terms of such as first and second and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element " being comprised a 〃 〃 〃 〃 〃 〃 " limited by statement, and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical factor.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.

Claims (10)

1. an information ciphering method, is characterized in that, comprising:
Determine the first character string that raw information is corresponding;
Each character in first character string is converted to ASCII character corresponding to this character respectively;
Carrying out prime number respectively to each ASCII character in the second character string asks business to process;
Asked by prime number the result of business and the prime number of correspondence to replace ASCII character corresponding in the second character string, obtain the information after the encryption of three-character doctrine string form.
2. method according to claim 1, is characterized in that,
First character string corresponding to described raw information is: the character string after utilizing the first PKI pre-set to be encrypted original character string;
And/or,
Describedly prime number carried out respectively to each ASCII character in the second character string ask business to process to comprise:
For each ASCII character described, perform one by one by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, until obtain first business of dividing exactly;
Described prime number asks the result of business to comprise: described first business of dividing exactly;
Described prime number asks prime number corresponding to the result of business to comprise: obtain described first divide exactly business time, as the prime number of current divisor.
3. method according to claim 1 and 2, is characterized in that,
Described each character in first character string is converted to ASCII character corresponding to this character respectively before, comprise further: determine that M is replaced position; The original character that M that determines described in first character string is replaced on position is replaced with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string;
Then, described the ASCII character that each character in first character string is converted to this character corresponding respectively to be comprised: each character in revised first character string is converted to ASCII character corresponding to this character respectively.
4. an information decryption method, is characterized in that, comprising:
For the information after the encryption of the three-character doctrine string form received, be that a unit splits described three-character doctrine string often to set a character;
The each unit split out is carried out prime number and ask the inverse process of business, obtain the ASCII character that each unit is corresponding;
Replace each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtain the second character string;
ASCII character each in second character string is converted to corresponding character, obtains the raw information that the first character string is corresponding.
5. method according to claim 4, is characterized in that,
Described ASCII character each in second character string is converted to corresponding character after, obtain the first character string after utilizing the first public key encryption; The raw information obtaining the first character string then corresponding comprises: utilize the first private key corresponding to the first PKI pre-set to be decrypted the first character string, obtain the raw information of character string forms;
And/or,
A described setting character is three characters;
The described prime number that carried out by each unit split out asks the inverse process of business to comprise:
The first two character string in each unit split out is converted to numeral and ask product with the 3rd numeral that character string converts to.
6. the method according to claim 4 or 5, is characterized in that, described ASCII character each in second character string is converted to corresponding character after, and described obtain raw information corresponding to the first character string before, comprise further:
For revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string.
7. an information encryption device, is characterized in that, comprising:
Raw information character string determining unit, for determining the first character string that raw information is corresponding;
ASCII character converting unit, for each character of the first character string is converted to ASCII character corresponding to this character respectively, obtains the second character string;
Prime number asks business's processing unit, carrying out prime number respectively for each ASCII character in the second character string of obtaining ASCII character converting unit asks business to process, ASCII character corresponding in the second character string that the prime number being asked by prime number business's processing unit to obtain asks the prime number of the result of business and correspondence replacement ASCII character converting unit to obtain, obtains the information after the encryption of three-character doctrine string form.
8. device according to claim 7, is characterized in that,
Described prime number asks business's processing unit to comprise: the first computation subunit and ASCII replace subelement,
First computation subunit, for when performing described prime number and asking business to process, for each ASCII character described, performs by this ASCII character divided by the prime number being greater than natural number 1 according to prime number order from small to large, one by one until obtain first business of dividing exactly;
ASCII replaces subelement, for for each ASCII character, first business of dividing exactly of the correspondence obtained by the first computation subunit and obtain described first divide exactly business time as the prime number of current divisor, replace corresponding ASCII character;
And/or,
Preset characters replacement unit is connected with, for determining that M is replaced position between described raw information character string determining unit and described ASCII character converting unit; M that determined described in the first character string described raw information character string determining unit the obtained original character replaced on position replaces with a described default M substitute character respectively; And M described original character is added the end of the character string after character replacement, obtain revised first character string, revised first character string is inputted described ASCII character converting unit; Then,
Each character of revised first character string is converted to ASCII character corresponding to this character by described ASCII character converting unit respectively.
9. a decrypts information device, is characterized in that, comprising:
Split cells, for the information after the encryption for the three-character doctrine string form received, is that a unit splits described three-character doctrine string often to set a character;
Prime number asks business against processing unit, asking the inverse process of business, obtaining the ASCII character that each unit is corresponding, replacing each unit in three-character doctrine string by the ASCII character that each unit is corresponding, obtaining the second character string for each unit split out being carried out prime number;
Character conversion unit, in the second character string obtained against processing unit for prime number being asked business, each ASCII character is converted to corresponding character, obtains the raw information that the first character string is corresponding.
10. device according to claim 9, is characterized in that,
Described split cells is that a unit splits described three-character doctrine string with every three characters; Then described prime number asks business to comprise against processing unit: the second computation subunit,
Second computation subunit, asks product for the first two character string in each unit split out being converted to numeral with the 3rd numeral that character string converts to;
And/or,
Described character conversion unit comprises further: preset characters is inverse replaces subelement, for for revised first character string obtained after ASCII character each in the second character string being converted to corresponding character, by the character preset in this revised first character string on M position respectively correspondence replace with last M position character in revised first character string, and delete this last M position character, obtain the first character string.
CN201510394602.4A 2015-07-07 2015-07-07 A kind of method and apparatus that information is encrypted and decrypted Active CN105100085B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510394602.4A CN105100085B (en) 2015-07-07 2015-07-07 A kind of method and apparatus that information is encrypted and decrypted

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510394602.4A CN105100085B (en) 2015-07-07 2015-07-07 A kind of method and apparatus that information is encrypted and decrypted

Publications (2)

Publication Number Publication Date
CN105100085A true CN105100085A (en) 2015-11-25
CN105100085B CN105100085B (en) 2018-03-02

Family

ID=54579632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510394602.4A Active CN105100085B (en) 2015-07-07 2015-07-07 A kind of method and apparatus that information is encrypted and decrypted

Country Status (1)

Country Link
CN (1) CN105100085B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375083A (en) * 2016-09-30 2017-02-01 广东网金控股股份有限公司 Encryption-decryption method based on Base64 and device thereof
CN108809779A (en) * 2018-06-19 2018-11-13 北京上中元科技有限公司 A kind of method of fresh-air purifying equipment automatic identification/verification
CN110837649A (en) * 2019-10-23 2020-02-25 特瓦特能源科技有限公司 Data encryption method and system
CN111007736A (en) * 2019-12-20 2020-04-14 阮振荣 Intelligent home system
CN112788051A (en) * 2021-01-25 2021-05-11 高新兴讯美科技股份有限公司 Https dynamic encryption transmission method
CN115296887A (en) * 2022-08-02 2022-11-04 中国电子科技集团公司信息科学研究院 Data transmission method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1201545A (en) * 1995-09-18 1998-12-09 艾利森电话股份有限公司 Method and apparatus for user authentication
US20040228485A1 (en) * 2003-05-09 2004-11-18 Abu Nor Azman Bin Method and apparatus for the generation of public key based on a user-defined ID in a cryptosystem
CN101996298A (en) * 2009-08-14 2011-03-30 鸿富锦精密工业(深圳)有限公司 Encrypting method and decrypting method corresponding to same
CN102904711A (en) * 2011-07-25 2013-01-30 深圳市金溢科技有限公司 Information encrypting method
CN103684758A (en) * 2013-11-05 2014-03-26 广东全通教育股份有限公司 User password mixing encryption method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1201545A (en) * 1995-09-18 1998-12-09 艾利森电话股份有限公司 Method and apparatus for user authentication
US20040228485A1 (en) * 2003-05-09 2004-11-18 Abu Nor Azman Bin Method and apparatus for the generation of public key based on a user-defined ID in a cryptosystem
CN101996298A (en) * 2009-08-14 2011-03-30 鸿富锦精密工业(深圳)有限公司 Encrypting method and decrypting method corresponding to same
CN102904711A (en) * 2011-07-25 2013-01-30 深圳市金溢科技有限公司 Information encrypting method
CN103684758A (en) * 2013-11-05 2014-03-26 广东全通教育股份有限公司 User password mixing encryption method and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375083A (en) * 2016-09-30 2017-02-01 广东网金控股股份有限公司 Encryption-decryption method based on Base64 and device thereof
CN106375083B (en) * 2016-09-30 2019-10-01 广东网金控股股份有限公司 A kind of encipher-decipher method and its device based on Base64
CN108809779A (en) * 2018-06-19 2018-11-13 北京上中元科技有限公司 A kind of method of fresh-air purifying equipment automatic identification/verification
CN110837649A (en) * 2019-10-23 2020-02-25 特瓦特能源科技有限公司 Data encryption method and system
CN111007736A (en) * 2019-12-20 2020-04-14 阮振荣 Intelligent home system
CN112788051A (en) * 2021-01-25 2021-05-11 高新兴讯美科技股份有限公司 Https dynamic encryption transmission method
CN115296887A (en) * 2022-08-02 2022-11-04 中国电子科技集团公司信息科学研究院 Data transmission method and device, electronic equipment and storage medium
CN115296887B (en) * 2022-08-02 2023-11-17 中国电子科技集团公司信息科学研究院 Data transmission method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN105100085B (en) 2018-03-02

Similar Documents

Publication Publication Date Title
CN105100085A (en) Information encryption and decryption methods and devices
CN106712946B (en) Data safety transmission method
CN103684760A (en) Method, device and system for encryption and decryption of communication
CN105376261B (en) Encryption method and system for instant messaging message
CN107196926A (en) A kind of cloud outsourcing privacy set comparative approach and device
CN102377564A (en) Method and device for encrypting private key
CN105406960A (en) Information encrypting and decrypting method
CN105160210A (en) Software authorization method and system, software terminal and software management party
CN110704854B (en) Stream type encryption method aiming at text data reserved format
CN104378198A (en) Voice encryption method based on block cipher system
CN110505054B (en) Data processing method, device and equipment based on dynamic white box
CN104394144A (en) Secure transmission method for medical data of cloud storage
CN111884802B (en) Media stream encryption transmission method, system, terminal and electronic equipment
CN104038336A (en) Data encryption method based on 3DES
Joshy et al. Text to image encryption technique using RGB substitution and AES
CN114443718A (en) Data query method and system
CN113098675B (en) Binary data encryption system and method based on polynomial complete homomorphism
Nurdiyanto et al. Secure a transaction activity with base64 algorithm and word auto key encryption algorithm
CN102222188A (en) Information system user password generation method
CN115567308A (en) Data encryption transmission method based on key expansion
CN113300842B (en) Method for improving security of symmetric encryption algorithm
CN112889240A (en) Server device, communication terminal, communication system, and program
CN105141631A (en) Terminal, server and account security login method, device and system
CN106452754B (en) Multi-user online dynamic encryption method and device
CN112953716A (en) Method and device for generating and verifying exchange code

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant