CN103873250A - Ciphertext generation method, ciphertext decryption method and encryption/ decryption device - Google Patents

Ciphertext generation method, ciphertext decryption method and encryption/ decryption device Download PDF

Info

Publication number
CN103873250A
CN103873250A CN201210553366.2A CN201210553366A CN103873250A CN 103873250 A CN103873250 A CN 103873250A CN 201210553366 A CN201210553366 A CN 201210553366A CN 103873250 A CN103873250 A CN 103873250A
Authority
CN
China
Prior art keywords
character
code table
ciphertext
appointment
string
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
CN201210553366.2A
Other languages
Chinese (zh)
Other versions
CN103873250B (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.)
China Mobile Group Henan Co Ltd
Original Assignee
China Mobile Group Henan 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 China Mobile Group Henan Co Ltd filed Critical China Mobile Group Henan Co Ltd
Priority to CN201210553366.2A priority Critical patent/CN103873250B/en
Publication of CN103873250A publication Critical patent/CN103873250A/en
Application granted granted Critical
Publication of CN103873250B publication Critical patent/CN103873250B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a ciphertext generation method, a ciphertext decryption method and an encryption/ decryption device, and is used for solving the problem of poor safety when a ground-up encryption algorithm of the Java language is used for carrying out encryption transmission on a cross-system password or information in the prior art. The ciphertext generation method comprises the following steps: according to a preset key file and an identification number generation method, obtaining an encrypted identification number, and randomly generating a code table comprising a plurality of characters; according to the obtained encrypted identification number and each plaintext character to be encrypted, looking up a code table character respectively corresponding to each plaintext character to be encrypted from the generated rate table along an appointed code table lookup direction; according to the found code table character, generating a ciphertext. Therefore, the safety of the ciphertext not only depends on the encryption algorithm but also depends on the preset key file and the randomly-generated code table, and the ciphertext can not be accurately decrypted even if a decryption algorithm is obtained only by using different key files and code tables to carry out encryption processing on the plaintext.

Description

A kind of ciphertext generation method, decrypt ciphertext method and encrypting and decrypting device
Technical field
The present invention relates to field of communication security, relate in particular to a kind of ciphertext generation method, decrypt ciphertext method and encrypting and decrypting device.
Background technology
In the communication network of multiple different coexistence of systems, for guaranteeing the communication security between system, under normal circumstances, the communication password between system and the communication information all need to be transmitted or preserve with the form of ciphertext.Password or information that the bottom cryptographic algorithm that at present conventional Java language carries realizes cross-system are encrypted, but this method exists some problems in the time that cross-system uses.For example, owing to utilizing this bottom cryptographic algorithm to being expressly encrypted the safety of the ciphertext the obtaining cryptographic algorithm that places one's entire reliance upon, so when when being sent to other system by the ciphertext that this cryptographic algorithm is encrypted, must provide decipherment algorithm to other system, and this decipherment algorithm can decipher cryptographic algorithm corresponding to useful this decipherment algorithm ciphertext of encrypting, once therefore obtain this decipherment algorithm, the ciphertext being encrypted by cryptographic algorithm corresponding to this decipherment algorithm in this system can be decrypted, so just brings very large potential safety hazard to system.
Summary of the invention
The embodiment of the present invention provides a kind of ciphertext generation method, decrypt ciphertext method and encrypting and decrypting device, the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art in order to solve.
The embodiment of the present invention is by the following technical solutions:
A kind of ciphertext generation method, comprising:
Obtain encryption string number according to default key file and string generation method, and generate at random code table, the character string that described code table is made up of the code table character of multiple random alignment;
According to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from described code table, search the code table character that corresponds respectively to each plaintext character to be encrypted; And
According to the code table character finding, generating ciphertext.
A kind of decrypt ciphertext method, comprising:
Obtain deciphering string number according to key file and string generation method;
The ciphertext obtaining according to the deciphering string number obtaining, in advance and the Codebook Lookup direction of appointment are searched the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext from the code table obtaining in advance; And
According to the code table character finding, generate declassified document.
A kind of encryption device, comprising:
Encrypt string number and obtain unit, for encrypting string number according to default key file and the acquisition of string generation method;
Code table generation unit, for random code table, the character string that described code table is made up of the code table character of multiple random alignment of generating;
Unit searched in character, for obtain encryption string that unit obtains number and each plaintext character to be encrypted according to described encryption string number, along the Codebook Lookup direction of specifying, the code table generating from described code table generation unit, search the character that corresponds respectively to each plaintext character to be encrypted;
Ciphertext generation unit, for searching the code table character that unit finds, generating ciphertext according to described character.
A kind of decryption device, comprising:
Deciphering string number obtains unit, for obtaining deciphering string number according to key file and string generation method;
Unit searched in deciphering character, for obtain deciphering string that unit obtains number, the in advance ciphertext that obtains and the Codebook Lookup direction of appointment according to described deciphering string number, from the code table obtaining in advance, search the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext;
Declassified document generation unit, for searching according to described deciphering character the code table character that unit finds, generates declassified document.
The beneficial effect of the embodiment of the present invention is as follows:
A kind of ciphertext generation method, decrypt ciphertext method and encrypting and decrypting device that the embodiment of the present invention provides, obtain encryption string number according to default key file and string generation method, and the random code table that comprises multiple characters that generates; According to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from the code table generating, search the code table character that corresponds respectively to each plaintext character to be encrypted, and according to the character of choosing, generating ciphertext.Visible, the ciphertext generation method that the embodiment of the present invention provides, the safety of ciphertext not only depends on cryptographic algorithm, also depend on default key file and the random code table generating, as long as use different key files and code table to being expressly encrypted, even if want a side of deciphering to obtain decipherment algorithm, the key file and code table using while encryption in the unknown, also can not accurately be decrypted this ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
Accompanying drawing explanation
The method flow diagram of a kind of ciphertext generation method that Fig. 1 provides for the embodiment of the present invention;
A kind of code table method flow diagram of searching the character that corresponds respectively to each plaintext character to be encrypted from the code table generating that Fig. 2 provides for the embodiment of the present invention;
The method flow diagram of a kind of decrypt ciphertext method that Fig. 3 provides for the embodiment of the present invention.
Embodiment
The not high problem of fail safe existing while utilizing in prior art password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission for solving, the embodiment of the present invention provides a kind of ciphertext generation method, decrypt ciphertext method and encrypting and decrypting device.Obtain encryption string number according to default key file and string generation method, and generate at random code table; According to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from the code table generating, search the code table character that corresponds respectively to each plaintext character to be encrypted, and according to the code table character finding, generating ciphertext.Visible, the ciphertext generation method that the embodiment of the present invention provides, the safety of ciphertext not only depends on cryptographic algorithm, also depend on default key file and the random code table generating, as long as use different key files and code table to being expressly encrypted, even if want a side of deciphering to obtain decipherment algorithm, the key file and code table using while encryption in the unknown, also can not accurately be decrypted this ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
Below in conjunction with Figure of description, embodiments of the invention are described, should be appreciated that embodiment described herein, only for description and interpretation the present invention, is not limited to the present invention.And in the situation that not conflicting, the feature in embodiment and implementation column in this explanation can be interosculated.
Embodiment 1
Based on above-mentioned basic thought, a kind of ciphertext that the embodiment of the present invention provides generates method flow diagram as shown in Figure 1, specifically comprises the following steps:
Step 11, obtain and encrypt string number according to default key file and string generation method, and generate at random code table, the character string that this code table is made up of the code table character of above-mentioned multiple random alignment.
Wherein, default key file can be text, and the content of this file can be by the numeral of a uncertain length and/or the character string of monogram, as long as length is no less than 8, is no more than 65535.
The method that string number generates has a variety of, for example can be using the character number comprising in key file as encrypting string number; Can be using the digital number comprising in key file as encrypting string number; Also can be by the character number comprising in corresponding key file MD5 file (Message Digest Algorithm, message digest algorithm the 5 five edition) as encrypting string number; Can also be by the character number comprising in key file is done to a series of mathematical operation, and using operation result as a string number.For example, suppose that the character number Key comprising in key file represents, the Key of the key file that hypothesis is obtained is again 32, thereby can do following computing to this Key and obtain encryption string number: first Key be carried out to computing 32*13-7=409, do complementation computing to 409 with parameter 100 again, the remainder 9 obtaining can be just to encrypt string number.Wherein, 13,7,100 is all some variable parameter value of being scheduled to.Above-mentioned several string generation methods of enumerating are all relatively simple; in actual applications; conventionally can adopt the mathematical operation bunchiness number in next life of more complicated; but because string number itself is an insignificant numeral; the generation method of this numeral has been a kind of technology of comparative maturity in prior art; and it is not the improvements of the present invention for prior art, therefore in the embodiment of the present invention, this technology is repeated no more.
For code table, the character string that code table is generally made up of the multiple character random alignment that generate at random.Suppose that plaintext character to be encrypted is only letter and distinguishes alphabetical capital and small letter, code table just can be made up of 26 upper and lower case letter random alignment, the letter that code table has comprised 52 random alignment.
Optionally, code table can comprise all characters except control character in ASCII character (American Standard Code for Information Interchange, ASCII), and the code table character comprising in code table is different.
Step 12, according to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from the code table generating, search the code table character that corresponds respectively to each plaintext character to be encrypted.
The code table character that step 13, basis find, generating ciphertext.
Optionally, respectively for each plaintext character to be encrypted, the implementation method of step 12 can as shown in Figure 2, specifically comprise following sub-step:
Step 121, according to this character expressly, from code table, determine code table character consistent with this plaintext character match.
Step 122, position according to the code table character determined in code table, determine the number of the character between the first designated ends position that is positioned at this position and code table in code table.
The end of the code table that the Codebook Lookup direction that wherein, the first designated ends of code table is specified for edge is determined.
Step 123, judge whether the number of execution step 122 determined characters is less than appointment number, in judged result while being no, execution step 124; In judged result when being, execution step 125.
Wherein, specifying number is the number that encryption string code deducts a gained.
Step 124, according to the first default search rule, from code table, search the character corresponding to this plaintext character along the Codebook Lookup direction of specifying.
Wherein, this first search rule can be: between the position of the code table character finding in code table and the code table character position determined, the number of character apart equals to specify number;
Step 125, determine that above-mentioned appointment number deducts the difference of number gained of execution step 122 determined characters, and according to the second default search rule, from described code table, search the code table character corresponding to this plaintext character along the Codebook Lookup direction of specifying.
Wherein, the second search rule can be: between the position of the code table character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The head end of the code table that described the second designated ends is determined for the Codebook Lookup direction along described appointment.
For step 12, optional, this step can also realize by the following method equally:
According to obtain encrypt string number and each plaintext character to be encrypted, each plaintext character to be encrypted is resequenced, and expressly character is reset in acquisition, and then according to encrypting string number and resetting expressly character, from the code table generating, search the character that corresponds respectively to each plaintext character to be encrypted along the Codebook Lookup direction of specifying.For instance, suppose that plaintext character string to be encrypted is: asdf, encrypting string number is 2, the random code table generating is: qwertyauiopzxcvsbndmghfjkl.Encrypt string number and each plaintext character to be encrypted according to obtaining, obtaining and reset expressly character string can be dfas; The Codebook Lookup direction that hypothesis is specified is again for to turn left from the right side, from the code table generating, searching corresponding to the code table character of character d along the Codebook Lookup direction of specifying is b, be g corresponding to the code table character of character f, be t corresponding to the code table character of character a, be c corresponding to the code table character of character s, so for the each character in plaintext character string asdf to be encrypted, from the code table generating, choose correspond respectively to character a, s, d, f are code table character b, g, t, c.
It should be noted that, except above-mentioned two kinds of methods, step 12 can also realize by a variety of methods, will not enumerate here.
In sum, a kind of ciphertext generation method that the embodiment of the present invention provides, the safety of ciphertext not only depends on cryptographic algorithm, also depend on default key file and the random code table generating, as long as use different key files and code table to being expressly encrypted, even if want a side of deciphering to obtain decipherment algorithm, the key file and code table using while encryption in the unknown, also can not accurately be decrypted this ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
A kind of ciphertext generation method providing corresponding to the embodiment of the present invention, the embodiment of the present invention also provides a kind of decrypt ciphertext method, and the method flow diagram of this decrypt ciphertext method as shown in Figure 3, can specifically comprise the following steps:
Step 21, obtain deciphering string number according to key file and string generation method.
Wherein, this string generation method is identical with " the string generation method " that use in ciphertext generation method.
Step 22, according to the deciphering string number obtaining, the in advance ciphertext that obtains and the Codebook Lookup direction of appointment are searched the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext from the code table obtaining in advance.
Wherein, the Codebook Lookup direction of appointment can be identical with " the Codebook Lookup direction of appointment " that use in ciphertext generation method, also can be contrary.
The code table character that step 23, basis find, generates declassified document.
Concrete, if the Codebook Lookup direction of specifying is identical with " the Codebook Lookup direction of appointment " that use in ciphertext generation method, respectively for each ciphertext character, step 22 can specifically comprise following sub-step:
First,, according to this ciphertext character, from the described code table obtaining in advance, determine the code table character consistent with this ciphertext character match;
Secondly, the position according to the code table character of determining in code table, determines and in described code table, is positioned at the character number comprising between the first designated ends position of described position and code table; The head end of the code table that the Codebook Lookup direction that wherein, the first designated ends of code table is specified for edge is determined;
Then, judge whether described character number is less than appointment number; This appointment number is the number that described deciphering string code deducts a gained;
Finally, in judged result while being no, according to the first default search rule, along searching the code table character corresponding to this plaintext character with the direction of the Codebook Lookup opposite direction of specifying from code table, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described in the number of character between the code table character position determined equal described appointment number;
In judged result when being, determine the difference of specifying number to deduct the number gained of described character, and according to the second default search rule, along searching the code table character corresponding to this plaintext character with the direction of the Codebook Lookup opposite direction of specifying from code table, wherein, the second search rule comprises: between the position of the code table character finding in code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The end of the code table that the second designated ends is determined for the Codebook Lookup direction along described appointment.
If the Codebook Lookup direction of specifying is contrary with " the Codebook Lookup direction of appointment " that use in ciphertext generation method, respectively for each ciphertext character, step 22 can specifically comprise following sub-step:
First,, according to this ciphertext character, from the described code table obtaining in advance, determine the code table character consistent with this ciphertext character match;
Secondly, the position according to the code table character of determining in code table, determines and in described code table, is positioned at the character number comprising between the first designated ends position of described position and code table; The end of the code table that the Codebook Lookup direction that wherein, the first designated ends of code table is specified for edge is determined;
Then, judge whether described character number is less than appointment number; This appointment number is the number that described deciphering string code deducts a gained;
Finally, in judged result while being no, according to the first default search rule, from code table, search the code table character corresponding to this plaintext character along the Codebook Lookup direction of specifying, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described in the number of character between the code table character position determined equal described appointment number;
In judged result when being, determine the difference of specifying number to deduct the number gained of described character, and according to the second default search rule, from code table, search the code table character corresponding to this plaintext character along the Codebook Lookup direction of specifying, wherein, the second search rule comprises: between the position of the code table character finding in code table and the second designated ends position of code table, the number of character apart equals above-mentioned difference and deduct the number of a gained; The head end of the code table that the second designated ends is determined for the Codebook Lookup direction along described appointment.
In sum, a kind of decrypt ciphertext method that the embodiment of the present invention provides, decrypting ciphertext not only depends on decipherment algorithm, the code table that also depends on default key file and obtain in advance, therefore want a side of deciphering in the situation that not knowing key file and code table, even if obtained decipherment algorithm, also can not accurately be decrypted ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
Embodiment 2
Below in conjunction with example, illustrate ciphertext generation method and decrypt ciphertext method that the embodiment of the present invention provides.
First,, for code table, suppose that the random code table generating is:
SboJU9#dL,O+a&sh:c/mpIj;*FE_V64]Dvz0uf7yCnM.~)t\rKxA<$NT=Rg`!B|PGZ{Yl"Hq'i[@?^-%3}185we2X(QWk>
This code table has comprised all characters except control character in ASCII character, and the character comprising in code table is different.
By one " ring code " of code table composition of above-mentioned random generation, be connected with end code table character by the head end code table character of code table, the character in code table is just arranged in annular according to former orderliness like this.
Secondly,, for key file, it can be the text of a UTF-8 coding (the elongated character code of one of UNICODE, claims again ten thousand country codes).The content of this file can be by the numeral of a uncertain length and/or the character string of monogram, as long as length is no less than 8, is no more than 65535.For example default key file can be: 1DB43E81B589B2DCAD9EB2821343F176, this key file is only generated by communicating pair agreement conventionally.
It should be noted that, each key file has one for being different from the MD5 value of other key files, this MD5 value and key file are relations one to one, if certain key file has been modified, the MD5 value that amended key file is corresponding from revise before MD5 value corresponding to key file be different.
Then, obtain and encrypt string number according to default key file and string generation method, and in conjunction with above-mentioned " ring code " being formed by code table, the Codebook Lookup direction of the encryption string of acquisition number and appointment, each plaintext character in this plaintext character string is encrypted, and this ciphering process can be:
First on " ring code ", find the residing position of plaintext character to be encrypted; Take this position as starting point, encrypt the character of string number corresponding number along the Codebook Lookup direction skew of specifying again; Then using the character obtaining after skew as the corresponding ciphertext character of plaintext character to be encrypted.
For instance, suppose that according to this key file and string generation method acquisition encryption string number be 55, plaintext character string to be encrypted is " l1A90Oopx%#*^ $ ", the Codebook Lookup direction that hypothesis is specified is again clockwise direction,, for plaintext character " l ", as starting point, be offset along clockwise direction 55 characters in " ring code " upper residing position take it, the code table character obtaining is " 6 ", and code table character " 6 " is chosen for to expressly ciphertext character corresponding to character " l "; For plaintext character " 1 ", as starting point, be offset along clockwise direction 55 characters in " ring code " upper residing position take it, the code table character of acquisition is ". ", and code table character ". " is chosen for to expressly ciphertext character corresponding to character " 1 "; For plaintext character " A ", as starting point, be offset along clockwise direction 55 characters in " ring code " upper residing position take it, the code table character of acquisition is " a ", and code table character " a " is chosen for to expressly ciphertext character corresponding to character " A "; The rest may be inferred, the final ciphertext corresponding to plaintext character string to be encrypted obtaining be " 6.a! QZR@+CB%7s ".
Suppose that Party A is encrypted after generating ciphertext plaintext character string to be encrypted, this ciphertext to be transferred to Party B, Party A will first will comprise ciphertext generation method, encrypt code table used, the function library of the Codebook Lookup direction of string generation method and appointment and encrypt the MD5 file verification code that key file used is corresponding and send to Party B, and then send to Party B by encrypting key file and ciphertext used.Party B obtains after key file, first read the MD5 value that this key file is corresponding, and verify this MD5 value and whether receive before MD5 file verification code consistent, if checking is consistent, illustrate that key file was not modified in transmitting procedure, this key file is exactly key file used in ciphertext generative process.Under normal circumstances, after having verified the validity of key file, communicating pair can be preserved key file safely.After having verified the validity of key file, Party B first obtains deciphering string number according to the string generation method comprising in key file and the function library that receives; According to the deciphering string number obtaining, the ciphertext generation method comprising in the function library receiving, Codebook Lookup direction and the ciphertext of encrypting code table used, appointment, determine respectively the deciphering character corresponding to the each ciphertext character comprising in ciphertext again; Last according to each deciphering character of determining, generate declassified document.
Concrete, suppose the ciphertext that Party B receives be " 6.a! QZR+CB%7s "; the Codebook Lookup direction that " the Codebook Lookup direction of appointment " comprising in function library used when encrypting; be clockwise direction; suppose that again Party B verify after the validity of key file; obtaining deciphering string number according to key file is 55; the code table used according to the encryption comprising in function library (i.e. " ring code "), ciphertext generation method and deciphering goes here and there numbers 55, the each ciphertext character comprising in this ciphertext is decrypted, and this decrypting process is: first on " ring code ", find the residing position of each ciphertext character; Again take this position as starting point, along the character of the direction contrary with " the Codebook Lookup direction of appointment " (counterclockwise) skew deciphering string number corresponding number; Then using the code table character obtaining after skew as the corresponding deciphering character of each ciphertext character.For example, for ciphertext character " 6 ", as starting point, be offset in the counterclockwise direction 55 characters in " ring code " upper residing position take it, the code table character obtaining is " l ", code table character " l " is chosen for to the deciphering character that ciphertext character " 6 " is corresponding; For ciphertext character ". ", as starting point, be offset in the counterclockwise direction 55 characters in " ring code " upper residing position take it, the code table character of acquisition is " 1 ", code table character " 1 " is chosen for to the deciphering character that ciphertext character ". " is corresponding; For ciphertext character " a ", as starting point, be offset in the counterclockwise direction 55 characters in " ring code " upper residing position take it, the code table character of acquisition is " A ", code table character " A " is chosen for to the deciphering character that ciphertext character " a " is corresponding; The rest may be inferred, final obtain corresponding to ciphertext " 6.a! QZR@+CB%7s " declassified document be " l1A90Oopx%#*^ $ ".
From above-mentioned example, a kind of ciphertext generation method that the embodiment of the present invention provides and decrypt ciphertext method, the safety of ciphertext not only depends on cryptographic algorithm, also depend on default key file and the random code table generating, as long as use different key files and code table to being expressly encrypted, even if want a side of deciphering to obtain decipherment algorithm, the key file and code table using while encryption in the unknown, also can not accurately be decrypted this ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
In addition, the embodiment of the present invention also provides the algorithmic code, cryptographic algorithm code and the decipherment algorithm code that generate code table, and the algorithmic code that wherein generates code table is as follows:
Figure BDA00002609055200121
Cryptographic algorithm code is as follows:
Figure BDA00002609055200122
Decipherment algorithm code is as follows:
Figure BDA00002609055200123
Figure BDA00002609055200131
A kind of ciphertext generation method, the decrypt ciphertext method that provide corresponding to the embodiment of the present invention, the embodiment of the present invention also provides a kind of encryption, decryption device, and wherein, encryption device can comprise with lower unit:
Encrypt string number and obtain unit, for encrypting string number according to default key file and the acquisition of string generation method;
Code table generation unit, for random code table, the character string that this code table is made up of the code table character of multiple random alignment of generating;
Unit searched in character, for obtaining according to encrypting string number encryption string number and the each plaintext character to be encrypted that unit obtains, along the Codebook Lookup direction of specifying, the code table generating from code table generation unit, search the code table character that corresponds respectively to each plaintext character to be encrypted; And
Ciphertext generation unit, the code table character finding for search unit according to character, generating ciphertext.
Wherein, character is searched unit and can specifically be comprised:
Character match subelement,, is determined and this code table character that expressly character match is consistent according to this plaintext character for each plaintext character to be encrypted for respectively from code table;
Number is determined subelement, in the position of code table, determines the number of the character between the first designated ends position that is positioned at above-mentioned position and code table in code table for the code table character determined according to character match subelement; The end of the code table that the Codebook Lookup direction that wherein, the first designated ends of code table is specified for edge is determined;
Judgment sub-unit, for judging that number determines whether the number of the definite character of subelement is less than appointment number; Wherein, specifying number is the number that described encryption string code deducts a gained;
First searches subelement, for in judgment sub-unit judged result while being no, according to the first default search rule, from code table, search the code table character corresponding to this plaintext character along the Codebook Lookup direction of specifying, wherein, the first search rule comprises: between the position of the code table character finding in code table and the code table character position determined, the number of character apart equals described appointment number;
Second searches subelement, for in judgment sub-unit judged result when being, determine the difference of specifying number to deduct the number gained of above-mentioned character, and according to the second default search rule, from described code table, search the code table character corresponding to this plaintext character along the Codebook Lookup direction of specifying, wherein, the second search rule comprises: between the position of the code table character finding in code table and the second designated ends position of code table, the number of character apart equals above-mentioned difference and deduct the number of a gained; The head end of the code table that the second designated ends is determined for the Codebook Lookup direction along described appointment.
Optionally, code table specifically comprises: all characters in ASCII character except control character; And the code table character comprising in code table is different.
Decryption device can comprise with lower unit:
Deciphering string number obtains unit, for obtaining deciphering string number according to key file and string generation method;
Unit searched in deciphering character, for obtain deciphering string that unit obtains number, the in advance ciphertext that obtains and the Codebook Lookup direction of appointment according to deciphering string number, from the code table obtaining in advance, search the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext;
Declassified document generation unit, for searching according to deciphering character the code table character that unit finds, generates declassified document.
Wherein, deciphering character is searched unit and can specifically be comprised:
Character match subelement for the each ciphertext character comprising for ciphertext respectively, according to this ciphertext character, is determined the character consistent with this ciphertext character match from the code table obtaining in advance;
Number is determined subelement, and the position of the code table character of determining according to character match subelement in code table determined and in code table, be positioned at the character number comprising between the first designated ends position of above-mentioned position and code table; The head end of the code table that the Codebook Lookup direction that wherein, the first designated ends of described code table is specified for edge is determined;
Judgment sub-unit, for judging that number determines whether the definite character number of subelement is less than appointment number; This appointment number is the number that deciphering string code deducts a gained;
First searches subelement, in judgment sub-unit judged result while being no, according to the first default search rule, along searching the code table character corresponding to this plaintext character with the direction of the Codebook Lookup opposite direction of specifying from code table, wherein, the first search rule comprises: the position of the code table character finding in described code table and described between the code table character position determined the number of character apart equal described appointment number;
Second searches subelement, for in judgment sub-unit judged result when being, determine the difference of specifying number to deduct the number gained of described character, and according to the second default search rule, along searching the code table character corresponding to this plaintext character with the direction of the Codebook Lookup opposite direction of specifying from code table, wherein, the second search rule comprises: between the position of the code table character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The end of the code table that this second designated ends is determined for the Codebook Lookup direction along described appointment.
In sum, the one that the embodiment of the present invention provides is encrypted, decryption device, the safety of ciphertext not only depends on cryptographic algorithm, also depend on default key file and the random code table generating, as long as use different key files and code table to being expressly encrypted, even if want a side of deciphering to obtain decipherment algorithm, the key file and code table using while encryption in the unknown, also can not accurately be decrypted this ciphertext, thereby efficiently solve the not high problem of fail safe existing while utilizing password to cross-system of bottom cryptographic algorithm that Java language carries or information to be encrypted transmission in prior art.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt complete hardware implementation example, completely implement software example or the form in conjunction with the embodiment of software and hardware aspect.And the present invention can adopt the form at one or more upper computer programs of implementing of computer-usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) that wherein include computer usable program code.
The present invention is with reference to describing according to flow chart and/or the block diagram of the method for the embodiment of the present invention, equipment (system) and computer program.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or the combination of square frame.Can provide these computer program instructions to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, the instruction that makes to carry out by the processor of computer or other programmable data processing device produces the device for realizing the function of specifying at flow process of flow chart or multiple flow process and/or square frame of block diagram or multiple square frame.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, the instruction that makes to be stored in this computer-readable memory produces the manufacture that comprises command device, and this command device is realized the function of specifying in flow process of flow chart or multiple flow process and/or square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make to carry out sequence of operations step to produce computer implemented processing on computer or other programmable devices, thereby the instruction of carrying out is provided for realizing the step of the function of specifying in flow process of flow chart or multiple flow process and/or square frame of block diagram or multiple square frame on computer or other programmable devices.
Although described the preferred embodiments of the present invention, once those skilled in the art obtain the basic creative concept of cicada, can make other change and modification to these embodiment.So claims are intended to be interpreted as comprising preferred embodiment and fall into all changes and the modification of the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification and not depart from the spirit and scope of the present invention the present invention.Like this, if within of the present invention these are revised and modification belongs to the scope of the claims in the present invention and equivalent technologies thereof, the present invention is also intended to comprise these changes and modification interior.

Claims (10)

1. a ciphertext generation method, is characterized in that, comprising:
Obtain encryption string number according to default key file and string generation method, and generate at random code table, the character string that described code table is made up of the code table character of multiple random alignment;
According to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from described code table, search the code table character that corresponds respectively to each plaintext character to be encrypted; And
According to the code table character finding, generating ciphertext.
2. the method for claim 1, it is characterized in that, according to the encryption string number obtaining and each plaintext character to be encrypted, along the Codebook Lookup direction of specifying, from described code table, search the code table character that corresponds respectively to each plaintext character to be encrypted, specifically comprise:
For each plaintext character to be encrypted, carry out following step respectively:
According to this plaintext character, from described code table, determine and this code table character that expressly character match is consistent;
Position according to the code table character of determining in code table, determines the number of the character between the first designated ends position that is positioned at described position and code table in described code table, and judges whether the number of described character is less than appointment number; The end of the code table that the Codebook Lookup direction that wherein, the first designated ends of described code table is specified for edge is determined; Described appointment number is the number that described encryption string code deducts a gained;
In judged result while being no, according to the first default search rule, Codebook Lookup direction along described appointment is searched the code table character corresponding to this plaintext character from described code table, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described between the code table character position determined the number of character apart equal described appointment number;
In judged result when being, determine that described appointment number deducts the difference of the number gained of described character, and according to the second default search rule, Codebook Lookup direction along described appointment is searched the code table character corresponding to this plaintext character from described code table, wherein, described the second search rule comprises: between the position of the character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The head end of the code table that described the second designated ends is determined for the Codebook Lookup direction along described appointment.
3. the method for claim 1, is characterized in that, described code table specifically comprises: all characters in ASCII character except control character; And
The code table character comprising in code table is different.
4. a decrypt ciphertext method, is characterized in that, comprising:
Obtain deciphering string number according to key file and string generation method;
The ciphertext obtaining according to the deciphering string number obtaining, in advance and the Codebook Lookup direction of appointment are searched the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext from the code table obtaining in advance; And
According to the code table character finding, generate declassified document.
5. method as claimed in claim 4, it is characterized in that, the ciphertext obtaining according to the deciphering string number obtaining, in advance and the Codebook Lookup direction of appointment are searched the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext from the code table obtaining in advance, specifically comprise:
For the each ciphertext character comprising in ciphertext, carry out following step respectively:
According to this ciphertext character, from the described code table obtaining in advance, determine the code table character consistent with this ciphertext character match;
Position according to the code table character of determining in code table, determines and in described code table, is positioned at the character number comprising between the first designated ends position of described position and code table, and judge whether described character number is less than appointment number; The head end of the code table that the Codebook Lookup direction that wherein, the first designated ends of described code table is specified for edge is determined; Described appointment number is the number that described deciphering string code deducts a gained;
In judged result while being no, according to the first default search rule, the code table character corresponding to this plaintext character is searched with the direction of the Codebook Lookup opposite direction of described appointment in edge from described code table, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described between the code table character position determined apart the number of character equal described appointment number;
In judged result when being, determine that described appointment number deducts the difference of the number gained of described character, and according to the second default search rule, the code table character corresponding to this plaintext character is searched with the direction of the Codebook Lookup opposite direction of described appointment in edge from described code table, wherein, described the second search rule comprises: between the position of the character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The end of the code table that described the second designated ends is determined for the Codebook Lookup direction along described appointment.
6. an encryption device, is characterized in that, comprising:
Encrypt string number and obtain unit, for encrypting string number according to default key file and the acquisition of string generation method;
Code table generation unit, for random code table, the character string that described code table is made up of the code table character of multiple random alignment of generating;
Unit searched in character, for obtain encryption string that unit obtains number and each plaintext character to be encrypted according to described encryption string number, along the Codebook Lookup direction of specifying, the code table generating from described code table generation unit, search the code table character that corresponds respectively to each plaintext character to be encrypted;
Ciphertext generation unit, for searching the code table character that unit finds, generating ciphertext according to described character.
7. device as claimed in claim 6, is characterized in that, character is searched unit and specifically comprised:
Character match subelement,, carries out according to this code table character that expressly character is determined from described code table and this plaintext character match is consistent for each plaintext character to be encrypted for respectively;
Number is determined subelement, in the position of code table, determines the number of the character between the first designated ends position that is positioned at described position and code table in described code table for the code table character determined according to described character match subelement; The end of the code table that the Codebook Lookup direction that wherein, the first designated ends of described code table is specified for edge is determined;
Judgment sub-unit, for judging that described number determines whether the number of the definite character of subelement is less than appointment number; Described appointment number is the number that described encryption string code deducts a gained;
First searches subelement, for in described judgment sub-unit judged result while being no, according to the first default search rule, Codebook Lookup direction along described appointment is searched the code table character corresponding to this plaintext character from described code table, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described between the code table character position determined the number of character apart equal described appointment number;
Second searches subelement, for in described judgment sub-unit judged result when being, determine that described appointment number deducts the difference of the number gained of described character, and according to the second default search rule, Codebook Lookup direction along described appointment is searched the code table character corresponding to this plaintext character from described code table, wherein, described the second search rule comprises: between the position of the code table character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The head end of the code table that described the second designated ends is determined for the Codebook Lookup direction along described appointment.
8. device as claimed in claim 6, is characterized in that, described code table specifically comprises: all characters in ASCII character except control character; And
The code table character comprising in code table is different.
9. a decryption device, is characterized in that, comprising:
Deciphering string number obtains unit, for obtaining deciphering string number according to key file and string generation method;
Unit searched in deciphering character, for obtain deciphering string that unit obtains number, the in advance ciphertext that obtains and the Codebook Lookup direction of appointment according to described deciphering string number, from the code table obtaining in advance, search the code table character that corresponds respectively to the each ciphertext character comprising in ciphertext;
Declassified document generation unit, for searching according to described deciphering character the code table character that unit finds, generates declassified document.
10. device as claimed in claim 9, is characterized in that, described deciphering character is searched unit and specifically comprised:
Character match subelement for the each ciphertext character comprising for ciphertext respectively, according to this ciphertext character, is determined the character consistent with this ciphertext character match from the described code table obtaining in advance;
Number is determined subelement, and the position of the code table character of determining according to described character match subelement in code table determined and in described code table, be positioned at the character number comprising between the first designated ends position of described position and code table; The head end of the code table that the Codebook Lookup direction that wherein, the first designated ends of described code table is specified for edge is determined;
Judgment sub-unit, for judging that described number determines whether the definite character number of subelement is less than appointment number; Described appointment number is the number that described deciphering string code deducts a gained;
First searches subelement, in described judgment sub-unit judged result while being no, according to the first default search rule, the code table character corresponding to this plaintext character is searched with the direction of the Codebook Lookup opposite direction of described appointment in edge from described code table, wherein, described the first search rule comprises: the position of the code table character finding in described code table and described between the code table character position determined the number of character apart equal described appointment number;
Second searches subelement, for in described judgment sub-unit judged result when being, determine that described appointment number deducts the difference of the number gained of described character, and according to the second default search rule, the code table character corresponding to this plaintext character is searched with the direction of the Codebook Lookup opposite direction of described appointment in edge from described code table, wherein, described the second search rule comprises: between the position of the code table character finding in described code table and the second designated ends position of code table, the number of character apart equals described difference and deduct the number of a gained; The end of the code table that described the second designated ends is determined for the Codebook Lookup direction along described appointment.
CN201210553366.2A 2012-12-18 2012-12-18 A kind of ciphertext generation method, ciphertext decryption method and encrypting and decrypting device Active CN103873250B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210553366.2A CN103873250B (en) 2012-12-18 2012-12-18 A kind of ciphertext generation method, ciphertext decryption method and encrypting and decrypting device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210553366.2A CN103873250B (en) 2012-12-18 2012-12-18 A kind of ciphertext generation method, ciphertext decryption method and encrypting and decrypting device

Publications (2)

Publication Number Publication Date
CN103873250A true CN103873250A (en) 2014-06-18
CN103873250B CN103873250B (en) 2017-06-20

Family

ID=50911400

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210553366.2A Active CN103873250B (en) 2012-12-18 2012-12-18 A kind of ciphertext generation method, ciphertext decryption method and encrypting and decrypting device

Country Status (1)

Country Link
CN (1) CN103873250B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104113410A (en) * 2014-07-04 2014-10-22 北京思特奇信息技术股份有限公司 Method and device for data encryption transmission based on multi-table encryption method
CN105005733A (en) * 2015-06-11 2015-10-28 天地融科技股份有限公司 Character display method, character display system and intelligent secret key equipment
CN105812146A (en) * 2016-05-26 2016-07-27 王云鹏 MD5-based two-way encryption data protection method
CN107634832A (en) * 2017-09-12 2018-01-26 云南撇捺势信息技术有限公司 Character string encryption, verification method, device, computer-readable recording medium
CN111222151A (en) * 2019-12-31 2020-06-02 北京指掌易科技有限公司 Mobile terminal application directory protection method and device
CN112368973A (en) * 2018-07-04 2021-02-12 I&G科技阿玛迪奥吉安卡罗股份有限公司 Method for encoding, transmitting and/or storing and decoding digital information in a non-breakable manner
CN115085924A (en) * 2022-08-22 2022-09-20 锐创软件技术(启东)有限公司 Computer information transmission encryption system based on Huffman coding

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1633070A (en) * 2004-10-29 2005-06-29 徐子杰 A data encryption/decryption method and encryption/decryption apparatus
CN1863042A (en) * 2005-12-13 2006-11-15 华为技术有限公司 Method for information encryption
CN101826961A (en) * 2010-05-25 2010-09-08 上海复旦天臣新技术有限公司 Method, device and system for data transmission encryption and decryption
US20100332732A1 (en) * 2009-06-29 2010-12-30 Mediatek Inc. Memory systems and mapping methods thereof
CN102096789A (en) * 2011-02-23 2011-06-15 上海帝埃碧化学科技有限公司 Electronic document security device
CN102254125A (en) * 2010-05-21 2011-11-23 腾讯科技(北京)有限公司 ELF (element list file) encrypting method and system
CN102456108A (en) * 2011-06-22 2012-05-16 中标软件有限公司 Encryption method for ibus pinyin code table

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1633070A (en) * 2004-10-29 2005-06-29 徐子杰 A data encryption/decryption method and encryption/decryption apparatus
CN1863042A (en) * 2005-12-13 2006-11-15 华为技术有限公司 Method for information encryption
US20100332732A1 (en) * 2009-06-29 2010-12-30 Mediatek Inc. Memory systems and mapping methods thereof
CN102254125A (en) * 2010-05-21 2011-11-23 腾讯科技(北京)有限公司 ELF (element list file) encrypting method and system
CN101826961A (en) * 2010-05-25 2010-09-08 上海复旦天臣新技术有限公司 Method, device and system for data transmission encryption and decryption
CN102096789A (en) * 2011-02-23 2011-06-15 上海帝埃碧化学科技有限公司 Electronic document security device
CN102456108A (en) * 2011-06-22 2012-05-16 中标软件有限公司 Encryption method for ibus pinyin code table

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104113410A (en) * 2014-07-04 2014-10-22 北京思特奇信息技术股份有限公司 Method and device for data encryption transmission based on multi-table encryption method
CN105005733A (en) * 2015-06-11 2015-10-28 天地融科技股份有限公司 Character display method, character display system and intelligent secret key equipment
CN105812146A (en) * 2016-05-26 2016-07-27 王云鹏 MD5-based two-way encryption data protection method
CN107634832A (en) * 2017-09-12 2018-01-26 云南撇捺势信息技术有限公司 Character string encryption, verification method, device, computer-readable recording medium
CN107634832B (en) * 2017-09-12 2018-11-09 云南撇捺势信息技术有限公司 Character string encryption, verification method, device, computer readable storage medium
CN112368973A (en) * 2018-07-04 2021-02-12 I&G科技阿玛迪奥吉安卡罗股份有限公司 Method for encoding, transmitting and/or storing and decoding digital information in a non-breakable manner
CN111222151A (en) * 2019-12-31 2020-06-02 北京指掌易科技有限公司 Mobile terminal application directory protection method and device
CN115085924A (en) * 2022-08-22 2022-09-20 锐创软件技术(启东)有限公司 Computer information transmission encryption system based on Huffman coding
CN115085924B (en) * 2022-08-22 2022-12-27 锐创软件技术(启东)有限公司 Computer information transmission encryption system based on Huffman coding

Also Published As

Publication number Publication date
CN103873250B (en) 2017-06-20

Similar Documents

Publication Publication Date Title
CN103873250A (en) Ciphertext generation method, ciphertext decryption method and encryption/ decryption device
CN106599723B (en) File encryption method and device and file decryption method and device
US9397830B2 (en) Method and apparatus for encrypting and decrypting data
CN103927357A (en) Data encryption and retrieval method for database
CN105827582B (en) A kind of communication encrypting method, device and system
CN115051798B (en) Random number generation method and device, electronic equipment and storage medium
CN103095449B (en) A kind of dynamic encryption decryption method based on stream cipher
GB2520861A (en) Block encryption/decryption apparatus and method
CN110704854B (en) Stream type encryption method aiming at text data reserved format
Limbong et al. Testing the classic caesar cipher cryptography using of matlab
CN111670443B (en) Integrated circuit personalization
CN115795514A (en) Private information retrieval method, device and system
CN106789058B (en) Proxy re-encryption algorithm description and analysis method
CN112887297B (en) Privacy-protecting differential data determining method, device, equipment and system
EP3104548B1 (en) Method and system for facilitating secure communication
US20160241387A1 (en) System and method for manipulating both the plaintext and ciphertext of an encryption process prior to dissemination to an intended recipient
CN111859435B (en) Data security processing method and device
WO2017142563A1 (en) Encryption methods
CN103457721B (en) A kind of method and device of Mass production password
US20180316512A1 (en) Authenticating a secondary device based on encrypted tables
CN109002698B (en) Safe input method and device for user password
CN108512657B (en) Password generation method and device
KR101148560B1 (en) Apparatus and method for encryption using mixture of bit data
CN115361198A (en) Decryption method, encryption method, device, computer equipment and storage medium
CN103984973A (en) Quality testing anti-fake control method based on two-dimensional bar code application

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