CN109981246B - Encryption method and decryption method for character string - Google Patents
Encryption method and decryption method for character string Download PDFInfo
- Publication number
- CN109981246B CN109981246B CN201910215951.3A CN201910215951A CN109981246B CN 109981246 B CN109981246 B CN 109981246B CN 201910215951 A CN201910215951 A CN 201910215951A CN 109981246 B CN109981246 B CN 109981246B
- Authority
- CN
- China
- Prior art keywords
- sequence
- chaotic
- numerical
- low
- order
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/001—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Complex Calculations (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses an encryption method and a decryption method of character strings, which comprise the following steps: converting a certain string into a high-order numerical sequence and a low-order numerical sequence; then, generating chaotic signals by using a chaotic system, and scrambling the high-digit numerical value sequence according to the position change scrambling rule before and after the chaotic sequence is sequenced; generating chaotic signals by using a chaotic system, and carrying out forward and reverse diffusion encryption on the low-bit value sequence; finally, the numerical value and the character are converted to obtain the encrypted ciphertext of the character string, and the ciphertext can be decrypted by a similar method to restore the original character string of a certain section. The invention adopts the scrambling rule of the chaotic sequence to scramble or descramble the high-digit value sequence converted from the character string, and simultaneously utilizes the cryptographic property of the chaotic sequence to carry out bidirectional diffusion encryption or decryption on the low-digit value sequence converted from the character string, thereby having good performance of resisting known/selected plaintext attack and ciphertext-only attack and ensuring the safety and feasibility of character string encryption and decryption.
Description
Technical Field
The invention relates to the technical field of information security, in particular to an encryption method and a decryption method of a character string.
Background
With the rapid development of Internet technology and multimedia technology, data communication is becoming an important means for people to communicate information. The data transmission by Internet is convenient and fast without being limited by regions, but because of the particularity of some data, both sending parties do not want the data transmitted on the network to be browsed or processed by an unauthorized person. The information not only relates to personal privacy, but also relates to national security, and has a great relationship with politics, military affairs, foreign exchange and the like of the country, so that the security and confidentiality of the data are more and more important. In these special areas where data security is required or when the owner of the data needs to protect his or her own interests, reliable data encryption techniques are needed.
The traditional character string encryption is usually carried out by DES and RAS encryption methods, the encryption operation is relatively complex, the requirements on the safety and the convenience of the character string encryption are gradually increased along with the development of network communication technology, and the adoption of a safe and reliable password technology for carrying out the character data encryption is urgent. The chaotic cipher technology is a new technology for encrypting a required object by using a chaotic signal. The chaotic system has sensitive dependence on initial conditions and structural parameters, and can provide a plurality of uncorrelated and random-like and determined reproducible chaotic sequences. Because the chaos encryption has the characteristics of continuous wide-band spectrum and impulse sharp autocorrelation, the chaos has a great application prospect in the fields of digital information encryption, secret communication and the like, and has attracted extensive research interest. Chaos was studied in the field of cryptography, originating at the end of the 80 s, and a modified Logistic-based mapping was first proposed by mathews, a british mathematician, as a sequential cryptographic scheme. Since the introduction of Matthews' chaotic cipher, chaotic encryption has begun to receive attention from researchers in different fields.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to solve the defects in the prior art and provides an encryption method and a decryption method for a character string, which are characterized in that a high-order numerical value sequence converted from a certain character string is scrambled by utilizing a position change rule before and after the sequence of a chaotic sequence generated by a chaotic system, a low-order numerical value sequence converted from the certain character string is subjected to bidirectional diffusion encryption by utilizing the password characteristic of the chaotic sequence generated by the chaotic system, and then the high-order numerical value sequence and the low-order numerical value sequence are converted to generate a ciphertext, so that the safety and the feasibility of encryption and decryption of the character string are ensured.
The technical scheme is as follows: the invention relates to a character string encryption method, which comprises the following steps:
(1) transcoding: converting a certain character string into numerical data one by one to obtain a high-order numerical sequence P1 ═ P11,P21,...,Pi1,....,PL1And a low order value sequence P2 ═ P12,P22,...,Pi2,....,PL2The length of the numerical value sequences P1 and P2 is consistent with the length of the character string, and is marked as L;
(2) scrambling of high-bit value sequences:
firstly, respectively calculating initial iteration step numbers m of the chaotic system by using external encryption keys (alpha and beta) according to a formula (1) shown below1And an extraction interval n1,
Then let the initial value x1The tilt tent chaotic system shown in the following formula (2) is iterated with α and μ as β, k denotes the number of iterations, and x denotes the number of iterationsk+1Denotes the chaotic signal obtained in the k-th iteration, where k is 1, 2.,
obtaining a chaotic sequence X from m1Element start every n1Taking 1 element to form a chaotic sequence Y with the length of L,
and finally, sequencing the chaotic sequence Y in an ascending order, and according to the position change scrambling rule before and after sequencing the sequence Y, setting the high-digit value sequence P1 as { P }11,P21,...,Pi1,....,PL1Scrambling to obtain a scrambled high-digit value sequence
(3) Bidirectional diffusion encryption of low-bit value sequences:
firstly, forward diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number m of the chaotic system by using external encryption keys (alpha and beta) according to the following formula (3)2,
Extracting mth from chaos sequence X2An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameter mu of the chaos system of the inclined tent1I.e. byμ1=β,
For low bit value sequence P2 ═ { P12,P22,...,Pi2,....,PL2Each element P ini2Wherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu1Performing single iteration on the chaos system of the inclined tent shown in the formula (2) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (4) to obtain chaotic signal Y1i,
② using chaotic signal Y1iFor data Pi2Forward diffusion encryption is performed according to the following formula (5) to obtain a forward diffusion encrypted ciphertext C1i,
Wherein, Y10And C10In order to forward-spread the encryption key,
③ encrypt the ciphertext C1 according to the forward diffusioniAnd C1i-1And Y1i-1For the parameter mu of the chaos system of the inclined tent1The adjustment is made according to the following equation (6),
thereby obtaining forward diffusion encrypted lowBit value sequence C1 ═ C11,C12,...,C1i,...,C1L};
Then, reverse diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number m of the chaotic system by using external encryption keys (alpha and beta) according to the following formula (7)3,
Extracting mth from chaos sequence X3An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameter mu of the chaos system of the inclined tent2I.e. mu2=β,
The sequence of low bit values C1 ═ C1 after forward diffusion encryption1,C12,...,C1i,...,C1LEach element C1 iniWherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu2Performing single iteration on the chaos system of the inclined tent shown in the formula (2) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (8) to obtain chaotic signal Y2i,
② using chaotic signal Y2iFor data C1iPerforming reverse diffusion encryption according to the following formula (9) to obtain a bidirectional diffusion encrypted ciphertext C2i,
Wherein, Y20And C20In order to spread the encryption key in the reverse direction,
③ encrypt the ciphertext C2 according to the bidirectional diffusioniAnd C2i-1And Y2i-1For the parameter mu of the chaos system of the inclined tent2The adjustment is made according to the following equation (10),
thereby obtaining the low-bit value sequence C2 ═ { C2 ═ C2 after bidirectional diffusion encryption1,C22,...,C2i,...,C2L};
(4) Transcoding: the scrambled high-bit numerical sequence is processedAnd carrying out conversion of numerical values and characters on the low-order numerical value sequence C2 subjected to bidirectional diffusion encryption to obtain a character sequence C, namely an encrypted ciphertext of the character string, wherein the length of the sequence C isAnd is
Further, converting a certain character string into numerical data character by character in the step (1), wherein a certain character string comprises displayable ASCII characters except for blank spaces and 6763 double-byte coded Chinese characters in the GB2312 character set; the conversion of characters into numerical data one by one means that a unicode2native (-) function is adopted to convert a single Chinese character into zone bit code numerical data which are expressed as [ zone numerical data, numerical bit data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ Pi1,Pi2]Indicating that the corresponding data combination results in a high bit value sequence P1 ═ { P ═ P11,P21,...,Pi1,....,PL1And a low order value sequence P2 ═ P12,P22,...,Pi2,....,PL2}。
Further, the scrambled high-bit value sequence in step (4)And the low-order digit value sequence C2 after the two-way diffusion encryption carries out the conversion of the numerical value and the character, and the conversion relation is expressed as follows:
setting a null character sequence C, and sequencing the scrambled high-digit numerical valuesAnd the low bit value sequence C2 ═ C2 after the bidirectional diffusion encryption1,C22,...,C2i,...,C2LThe following operations are sequentially carried out on each corresponding element in the structure,
First, if it is determinedAnd (C2)i+161) ≧ 250, then 1 space is added in the character sequence C, i.e. C ═ C, "]Are combined with
Then using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence C, i.e.
Directly using char (·) function to convert numerical data (C2)i+33) into a single ASCII code character and added to the character sequence C, i.e. C ═ C, char (C2)i+33)]。
The invention also discloses a character string decryption method, which is characterized by comprising the following steps:
(1) transcoding: a certain segment of character string cryptograph to be decryptedConverting the characters one by one into numerical data to obtain a high-order numerical sequenceAnd low bit number value sequenceWherein the length of the numerical sequences R1, R2 isSome segment of character string cryptograph to be decryptedHas a length of
(2) Descrambling of high-bit numerical sequences:
first using an external decryption keyRespectively calculating to obtain initial iteration steps of the chaotic system according to a formula (11) shown belowAnd an extraction interval
Then order the initial valueAnd parametersThe tilt tent chaotic system shown in the following formula (12) is iterated, k represents the number of iterations,denotes the chaotic signal obtained in the k-th iteration, where k is 1, 2.,
obtaining a chaotic sequenceFrom the firstElement start every otherEach element is 1, thereby forming a length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting in ascending order, according to sequenceThe position change scrambling rule before and after sorting is used for high-digit value sequencePerforming inverse scrambling to obtain an inverse-scrambled high-bit value sequence
(3) Bidirectional diffusion decryption of low-bit value sequences:
firstly, the reverse diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (13) to obtain the initial iteration step number of the chaotic system
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
For low-order bit value sequenceEach of the elements Ri2WhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersPerforming single iteration on the chaos system of the inclined tent shown as the formula (12) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (14) to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption according to the following formula (15) to obtain reverse diffusion decrypted data
Wherein the content of the first and second substances,and R'02In order to spread the decryption key in the reverse direction,
thirdly, according to the element R in the low-order numerical value sequencei2、Ri-12Corresponding numerical value R'i2、R′i-12And anTo the parameters of the chaos system of the inclined tentThe adjustment is made in accordance with the following equation (16),
Then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (17) to obtain the initial iteration step number of the chaotic system
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
Decrypting a sequence of reverse diffusion decrypted low-bit valuesEach element of D1iWhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersPerforming single iteration on the chaos system of the inclined tent shown as the formula (12) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (18) to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is performed according to the following formula (19) to obtain bidirectional diffusion decrypted data D2i,
Wherein the content of the first and second substances,and D10In order to spread the decryption key in the forward direction,
③ decrypting the data D1 according to the forward diffusioniAnd D1i-1Andto the parameters of the chaos system of the inclined tentThe adjustment is made according to the following equation (20),
(4) Transcoding: the high-order digit value sequence after the reverse scrambling is carried outAnd the low-bit numerical sequence D2 after bidirectional diffusion decryption is carried out, the numerical value and the character are converted to obtain a character sequence PP, namely the character string recovered after the decryption of the character string to be decrypted, wherein the length of the character sequence PP is
Further, the step (1) is to encrypt a certain segment of character string to be decryptedConverting into numerical data one by one to obtain high-order numerical sequenceAnd low bit number value sequenceThe conversion relationship is expressed as follows:
firstly, a certain section of character string cryptograph to be decrypted is obtainedIn the method, characters are converted into numerical data one by one, namely, a unicode2native () function is adopted to convert a single Chinese character into zone bit code numerical data which are expressed as [ zone numerical data, bit numerical data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ R ]i1,Ri2]Represents;
then the numerical data [ Ri1,Ri2]Correspondingly combining to obtain high-order numerical value sequenceAnd low bit number value sequenceWherein
Then check the low-order numerical value sequence R2 one by one to see if there is Ri2An element of 32, if so, would correspond to the last element R in the high-order numerical sequence R1i+11Adding 1 to the value and deleting the element R with the value of 32i2And its element R in the corresponding high-order numerical sequence R1i1;
Further, the high-order digit value sequence after the inverse scrambling in the step (4) is carried outAnd the low-order digit value sequence D2 after bidirectional diffusion decryption is used for converting the numerical value and the character, and the conversion relation is expressed as follows:
setting a null character string PP, and carrying out reverse scrambling on the high-digit numerical sequenceAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the sequence are operated as follows,
If it is notAnd D2i≧ 250, then 1 space is added in the character sequence PP, i.e., PP ═ PP, "](ii) a Otherwise, using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence PP, i.e.
Directly using char (·) function to convert numerical data (D2)i) Converted into a single ASCII code character and added to the character sequence PP, i.e. PP ═ PP, char (D2)i)]。
Has the advantages that: the invention uses the position change rule before and after the chaos sequence generated by the chaos system to scramble the high-digit value sequence converted from a certain segment of character string, and simultaneously uses the password characteristic of the chaos sequence generated by the chaos system to perform bidirectional diffusion encryption on the low-digit value sequence converted from a certain segment of character string, so that the high-digit value sequence and the low-digit value sequence are converted to generate a ciphertext, thereby ensuring the safety and feasibility of character string encryption and decryption.
Drawings
Fig. 1 is a schematic diagram of an encryption and decryption process of a character string according to the present invention.
Detailed Description
The method for encrypting the character string shown in fig. 1 comprises the following steps:
(1) transcoding: converting a certain character string into numerical data one by one, wherein the character string comprises displayable ASCII code characters except blank spaces and 6763 Chinese characters of double-byte encoding in a GB2312 character set; the conversion of characters into numerical data one by one means that a unicode2native (-) function is adopted to convert a single Chinese character into zone bit code numerical data which are expressed as [ zone numerical data, numerical bit data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ Pi1,Pi2]Indicating that the corresponding data combination results in a high bit value sequence P1 ═ { P ═ P11,P21,...,Pi1,....,PL1And a low order value sequence P2 ═ P12,P22,...,Pi2,....,PL2The length of the numerical value sequences P1 and P2 is consistent with the length of the character string and is marked as L,
(2) scrambling of high-bit value sequences:
firstly, respectively calculating the initial iteration step number (m) of the chaotic system by using external encryption keys (alpha and beta) according to the following formula1) And an extraction interval (n)1),
Then let the initial value x1Iterating the tilt tent chaotic system (formula as below), wherein k represents iteration number, and x represents iteration numberk+1Denotes the chaotic signal obtained in the k-th iteration, where k is 1, 2.,
obtaining a chaotic sequence X from m1Element start every n1Taking 1 element to form a chaotic sequence Y with the length of L,
and finally, sequencing the chaotic sequence Y in an ascending order, and according to the position change scrambling rule before and after sequencing the sequence Y, setting the high-digit value sequence P1 as { P }11,P21,...,Pi1,....,PL1Scrambling to obtain a scrambled high-digit value sequence
(3) Bidirectional diffusion encryption of low-bit value sequences:
firstly, forward diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number (m) of the chaotic system by using external encryption keys (alpha and beta) according to the following formula2),
Extracting mth from chaos sequence X2An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent1) I.e. mu1=β,
For low bit value sequence P2 ═ { P12,P22,...,Pi2,....,PL2Each element P ini2Wherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu1Performing single iteration on the chaos system of the inclined tent to obtain a chaos signalFor chaotic signals simultaneouslyThe following integer processing is carried out to obtain a chaotic signal Y1i,
② using chaotic signal Y1iFor data Pi2Forward diffusion encryption is carried out to obtain a forward diffusion encrypted ciphertext C1i,
Wherein, Y10And C10In order to forward-spread the encryption key,
③ encrypt the ciphertext C1 according to the forward diffusioniAnd C1i-1And Y1i-1For the parameter mu of the chaos system of the inclined tent1The following adjustment is made as follows,
thereby obtaining the forward diffusion encrypted low-bit value sequence C1 ═ C11,C12,...,C1i,...,C1L};
Then, reverse diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number (m) of the chaotic system by using external encryption keys (alpha and beta) according to the following formula3),
Extracting mth from chaos sequence X3An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent2) I.e. mu2=β,
The sequence of low bit values C1 ═ C1 after forward diffusion encryption1,C12,...,C1i,...,C1LEach element C1 iniWherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu2Performing single iteration on the chaos system (formula below) of the inclined tent to obtain a chaos signalFor chaotic signals simultaneouslyThe following integer processing is carried out to obtain a chaotic signal Y2i,
② using chaotic signal Y2iFor data C1iPerforming reverse diffusion encryption to obtain bidirectional diffusion encrypted ciphertext C2i,
Wherein, Y20And C20In order to spread the encryption key in the reverse direction,
③ encrypt the ciphertext C2 according to the bidirectional diffusioniAnd C2i-1And Y2i-1For the parameter mu of the chaos system of the inclined tent2The following adjustment is made as follows,
thereby obtaining the low-bit value sequence C2 ═ { C2 ═ C2 after bidirectional diffusion encryption1,C22,...,C2i,...,C2L};
(4) Transcoding: setting a null character sequence C, and sequencing the scrambled high-digit numerical valuesAnd the low bit value sequence C2 ═ C2 after the bidirectional diffusion encryption1,C22,...,C2i,...,C2LThe following operations are sequentially carried out on each corresponding element in the structure,
First, if it is determinedAnd (C2)i+161) ≧ 250, then 1 space is added in the character sequence C, i.e. C ═ C, "]Are combined with
Then using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence C, i.e.
Directly using char (·) function to convert numerical data (C2)i+33) into a single ASCII code character and added to the character sequence C, i.e. C ═ C, char (C2)i+33)]
Thereby obtaining a character sequence C, namely the encrypted ciphertext of the character string, wherein the length of the sequence C isAnd is
As shown in fig. 1, a method for decrypting a string includes the following steps:
(1) transcoding: a certain segment of character string cryptograph to be decryptedConverting the characters one by one into numerical data to obtain a high-order numerical sequenceAnd low bit number value sequenceThe specific conversion relationship is expressed as follows:
firstly, a certain section of character string cryptograph to be decrypted is obtainedIn the method, characters are converted into numerical data one by one, namely, a unicode2native () function is adopted to convert a single Chinese character into zone bit code numerical data which are expressed as [ zone numerical data, bit numerical data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ R ]i1,Ri2]Represents;
then the numerical data [ Ri1,Ri2]Correspondingly combining to obtain high-order numerical value sequenceAnd low bit number value sequenceWherein
Then check the low-order numerical value sequence R2 one by one to see if there is Ri2An element of 32, if so, would correspond to the last element R in the high-order numerical sequence R1i+11Adding 1 to the value and deleting the element R with the value of 32i2And its element R in the corresponding high-order numerical sequence R1i1;
Finally obtaining a high-order numerical sequenceAnd low bit number value sequenceWherein the length of the numerical sequences R1, R2 isSome segment of character string cryptograph to be decryptedHas a length of
(2) Descrambling of high-bit numerical sequences:
first using an external decryption keyRespectively calculating to obtain initial iteration steps of the chaotic system according to the formula shown in the specificationAnd an extraction interval
Then order the initial valueAnd parametersIteration is carried out on the tilting tent chaotic system (the formula is shown as follows), k represents the iteration number,represents the kth iterationThe resulting chaotic signal, where k is 1, 2.,
obtaining a chaotic sequenceFrom the firstElement start every otherEach element is 1, thereby forming a length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting in ascending order, according to sequenceThe position change scrambling rule before and after sorting is used for high-digit value sequencePerforming inverse scrambling to obtain an inverse-scrambled high-bit value sequence
(3) Bidirectional diffusion decryption of low-bit value sequences:
firstly, the reverse diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating to obtain the initial iteration step number of the chaotic system according to the following formula
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
For low-order bit value sequenceEach of the elements Ri2WhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersA single iteration is performed on the tilt tent chaotic system,obtaining a chaotic signalFor chaotic signals simultaneouslyPerforming the following integer processing to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption according to the following formula (15) to obtain reverse diffusion decrypted data
Wherein the content of the first and second substances,and R'02In order to spread the decryption key in the reverse direction,
thirdly, according to the element R in the low-order numerical value sequencei2、Ri-12Corresponding numerical value R'i2、R′i-12And anTo the parameters of the chaos system of the inclined tentThe adjustment is made in accordance with the following equation (16),
Then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating to obtain the initial iteration step number of the chaotic system according to the following formula
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
Decrypting a sequence of reverse diffusion decrypted low-bit valuesEach element of D1iWhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersPerforming single iteration on the chaos system of the inclined tent shown as the formula (12) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming the following integer processing to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is carried out to obtain bidirectional diffusion decrypted data D2i,
Wherein the content of the first and second substances,and D10In order to spread the decryption key in the forward direction,
③ decrypting the data D1 according to the forward diffusioniAnd D1i-1Andto the parameters of the chaos system of the inclined tentThe following adjustment is made as follows,
(4) Transcoding: setting a null character string PP, and carrying out reverse scrambling on the high-digit numerical sequenceAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the Chinese character data are sequentially converted into numerical values and characters, and the specific conversion relation is expressed as follows,
If it is notAnd D2i≧ 250, then 1 space is added in the character sequence PP, i.e., PP ═ PP, "](ii) a Otherwise, using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence PP, i.e.
Directly using char (·) function to convert numerical data (D2)i) Converted into a single ASCII code character and added to the character sequence PP, i.e. PP ═ PP, char (D2)i)]。
Thereby obtaining a character sequence PP, namely a character string recovered after the decryption of the segment of ciphertext, wherein the length of the character sequence PP is
The invention is further illustrated by the following specific examples:
example 1
According to the method for encrypting the character string in the above embodiment, the steps are as follows:
(1) converting a certain character string 'character string encryption and decryption 111111 aaaaaaa' into numerical data character by character to obtain a high-order numerical value sequence P1 ═ {215,183,180,188,189,195,0,0,0,0,0,0,0,0, 0} and a low-order numerical value sequence P2 ═ {214,251,174,211,226,220,49,49,49,49,49,49,97,97,97,97,97 }, wherein the lengths of the numerical value sequences P1 and P2 are consistent with the length of the character string and are marked as L18;
(2) first, using an external encryption key (α is 0.12345, β is 0.75), calculating according to the formula in step (2) of the encryption method for a character string in the above embodiment, to obtain an initial iteration step number (m) of the chaotic system1) And an extraction interval (n)1),
m1=513+25=538
n1=9+1=10
Then let the initial value x1α ═ 0.12345 and μ ═ β ═ 0.75, the tilt tent chaotic system shown in step (2) of the encryption method for a character string in the above embodiment iterates to obtain a chaotic sequence X, which is then calculated from the second place538 elements are taken as 1 element every other 10 elements to form a chaotic sequence Y with the length L of 18, wherein the chaotic sequence Y is {0.722203285427244,0.890875205023236,0.074566505410670,0.027605142635845,0.490204576614745,0.736737938553961,0.706512185278734,0.160908579611954,0.909369772129020,0.010038655637092,0.178263702574469,0.045578446993861,0.809369602110701,0.830644585500888,0.781903572849237,0.654761047957817,0.428568530673860,0.790729026121181},
and finally, sorting the chaotic sequence Y in an ascending order, and scrambling the high-order numerical value sequence P1 ═ 215,183,180,188,189,195,0,0,0,0,0,0,0,0,0,0,0 and 0 according to the position change scrambling rule {10,4,12,3,8,11,17,5,16,7,1,6,15,18,13,14,2 and 9} before and after sorting the sequence Y to obtain the scrambled high-order numerical value sequence
(3) Firstly, forward diffusion encryption of low-order numerical value sequence is carried out
Using the external encryption key (α ═ 0.12345, β ═ 0.75), calculating according to the formula in step (3) of the encryption method for a character string in the above embodiment, to obtain the initial iteration step number (m) of the chaotic system2),
m2=432+48=480
Extracting the 480 th element from the chaotic sequence X as an initial value of the chaotic system of the inclined tentSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent1=0.75),
For low bit value sequence P2 ═ { P12,P22,...,Pi2,....,P182Each element P in {214,251,174,211,226,220,49,49,49,49,49, 97,97,97,97,97} ═ Pi2The chaos of the tilt tent shown in the formula in step (3) of the encryption method for the character string in the above embodiment is sequentially performedSystem single iteration, integral processing, forward diffusion encryption and inclined tent chaotic system parameter mu1Adjustment, etc., wherein forward diffusion encryption key Y1 is taken046 and C1026, so as to obtain the forward diffusion encrypted low bit value sequence C1 ═ {59,32,0,6,86,62,52,43,12,42,44,26,18,93,34,39,16,71 };
then, reverse diffusion encryption of low-order numerical value sequence is carried out
Using the external encryption key (α ═ 0.12345, β ═ 0.75), calculating according to the formula in step (3) of the encryption method for a character string in the above embodiment, to obtain the initial iteration step number (m) of the chaotic system3),
m3=543+50=593
Extracting 593 th element from the chaos sequence X as an initial value of the tilting tent chaos systemSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent2=0.75),
For low bit value sequence C1 ═ { C11,C12,...,C1i,....,C118Each element C1 in {59,32,0,6,86,62,52,43,12,42,44,26,18,93,34,39,16,71}iSequentially performing single iteration, integer processing, reverse diffusion encryption and tilt tent chaotic system parameter mu shown in formula in step (3) of the encryption method for the character string in the above specific embodiment2Adjustment, etc., in which the reverse diffusion encryption key Y2 is taken056 and C2036, so as to obtain the low-order bit value sequence C2 after the bidirectional diffusion encryption, which is {82,71,64,49,26,63,31,10,61,26,18,6,67,63,33,22,22,3 };
(4) the scrambled high-bit numerical sequence is processed And the low bit after bidirectional diffusion encryptionConverting each corresponding element in the numerical value sequence C2 ═ 82,71,64,49,26,63,31,10,61,26,18,6,67,63,33,22,22,3 into a numerical value and a character in turn, so as to obtain a character string ciphertext C of "stoke s" (stoke); "will ^ will; zhuangshikimic d' B7.
According to the method for decrypting the character string in the above embodiment, the steps are as follows:
(1) hasty a certain section of ciphertext to be decrypted; "will ^ will; zhuangshikimic d 'B7' is converted into numerical data character by character, and a high-order numerical sequence R1 ═ {0,188,0,180,0,0,0,189,0,0,215,195,0,0, 183,0} and a low-order numerical sequence R2 ═ 115,232,97,210,59,96,64,171,94,59,179,167,100,96,66,55,183,36} are obtained;
(2) first using an external decryption keyCalculating according to the formula in step (2) of the decryption method for the character string in the above specific embodiment to obtain the initial iteration step number of the tilt tent chaotic systemAnd an extraction interval
Then order the initial valueAnd parametersThe oblique tent shown in step (2) of the decryption method for the character string in the above embodimentThe chaotic system is iterated to obtain a chaotic sequenceTake 1 every 10 elements starting with the 538 th element, resulting in a length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting in ascending order, according to sequenceThe position change scrambling rule {10,4,12,3,8,11,17,5,16,7,1,6,15,18,13,14,2,9} before and after the sorting is carried out, and the high-order bit value sequence R1 is subjected to inverse scrambling to {0,188,0,180,0,0,0,189,0,0,215,195,0,0, 183,0} to obtain an inverse-scrambled high-order bit value sequence
(3) Firstly, the reverse diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the formula in step (3) of the decryption method for the character string in the above specific embodiment to obtain the initial iteration step number of the chaotic system
From chaotic sequencesExtracting 593 th element as initial value of the chaos system of the inclined tentObtaining parameters of the chaos system of the inclined tent at the same time
For low bit value sequences R2 ═ { R12,R22,...,Ri2,....,R182Each element R of {115,232,97,210,59,96,64,171,94,59,179,167,100,96,66,55,183,36 })i2Wherein i is 1,2, 3.. times, 18, the single iteration, the integer processing, the inverse diffusion decryption and the tilt tent chaotic system parameter shown in the formula in step (3) of the decryption method for the character string in the above embodiment are sequentially performedAdjustment, etc., in which the decryption key is fetched in the reverse directionAnd R'0236, so as to obtain the bidirectional diffusion decrypted low-bit value sequence D1 ═ {59,32,0,6,86,62,52,43,12,42,44,26,18,93,34,39,16,71 };
then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysAccording to the formula in step (3) of the decryption method for character strings in the above embodimentPerforming calculation to obtain the initial iteration step number of the chaotic system
From chaotic sequencesExtracting the 480 th element as the initial value of the chaos system of the tilt tentObtaining parameters of the chaos system of the inclined tent at the same time
Decrypting the sequence of low-bit values D1 ═ D1 after the back diffusion1,D12,...,D1i,...,D118Each element D1 in {59,32,0,6,86,62,52,43,12,42,44,26,18,93,34,39,16,71}iIn the above embodiment, the single iteration, the integer processing, the forward diffusion decryption and the tilt tent chaotic system parameter shown in the formula in step (3) of the decryption method for the character string in the above embodiment are sequentially performedAdjustment, etc., in which forward diffusion decryption keys are fetchedAnd D1026, so as to obtain a bidirectional diffusion decrypted low-bit value sequence D2 ═ {214,251,174,211,226,220,49,49,49,49,49,49,97,97,97,97,97 };
(4) the high-order digit value sequence after the reverse scrambling is carried outAnd carrying out numerical value and character conversion on the low-digit numerical value sequence D2 subjected to bidirectional diffusion decryption to obtain a character sequence PP, namely the character string recovered after decryption of the section of ciphertext is 'character string encryption and decryption 111111 aaaaaa'.
Example 2
According to the above method for encrypting a string, a certain string to be encrypted is "string encryption/decryption 111111 aaaaaaaa", and the encryption procedure of a string is similar to that in embodiment 1, only a slight change occurs in the encryption key: 0.12345000000001; or β 0.75000000000001; or Y1045, percent; or C1027; or Y2055; or C20The string encryption results are shown in table 1, 37. As can be seen from table 1, a small change in the encryption key causes a large change in the encryption text of the character string, and thus it can be seen that the encryption method for the character string provided in this patent is sensitive to the encryption key.
TABLE 1 encryption result of character string when the external encryption key is changed slightly
Example 3
According to the above method for encrypting a string, the encryption procedure is similar to that of embodiment 1, and only a certain segment of the string to be encrypted ("string encryption/decryption 111111 aaaaaaaa") is slightly changed: "substring encryption/decryption 111111 aaaaaaa"; or "string solving honey 111111 aaaaaaa"; or "string encryption/decryption 211111 aaaaaaaa"; or "string encryption/decryption 111112 aaaaaaa"; or "string encryption/decryption 111111 baaaaa"; or "string encryption/decryption 111111 aaaaaaab", the string encryption results are shown in table 2. As can be seen from table 2: the subtle change of the plain text information of the character string to be encrypted can cause 'all-face-nothing' of the encrypted ciphertext, so that the character string encryption method provided by the patent has sensitivity to the plain text information of the character string to be encrypted.
TABLE 2 encryption result of character string when the character string to be encrypted is slightly changed
As can be seen from the above specific embodiments 2 and 3, the character string ciphertext generated by the character string encryption method provided by the present invention is not only closely related to the encryption key, but also depends on the plaintext information of the character string to be encrypted, so that the character string encryption method provided by the present invention can resist known/selected plaintext attacks, and has strong security.
Example 4
According to the decryption method of the character string, a certain section of ciphertext to be decrypted is's hard a hurry; "will ^ will; zhuangshikim d' B7 vendor $ ", a string decryption procedure similar to embodiment 1, only with slight changes in decryption key:orOrOr D1027; orOr R'02The string ciphertext decryption result is shown in table 3, 37. As can be seen from Table 3, the small change of the decryption key causes the result of decryption of the ciphertext to be very largeThe recovered character string is useless information, so that the decryption method of the character string has sensitivity to the decryption key.
TABLE 3 ciphertext decipher result when external decipher key is changed slightly
Example 5
According to the above method for decrypting a string, the decryption steps are similar to those in embodiment 1, and only a certain segment of string ciphertext to be decrypted ("s diffa hasty; '@ will ^; zhuyu d' B7 vendor") is slightly changed: "S diffa hurry; "will ^ will; zhuangshikimic d' B7 dealer $; or "s diffa:," @ will ^; zhuangshikimic d' B7 dealer $; or "s diffa hurry; "said ^ a,; zhuangshikimic d' B7 dealer $; or "s diffa hurry; "will ^ will; zhuangshikimic c' B7 dealer $; or "s diffa hurry; "will ^ will; zhuangshikimic d' B7 meal $; or "s diffa hurry; "will ^ will; zhuangshikimic acid d' B7 vendor & "; or "hard sa hurry; "will ^ will; zhuangshikimic d' B7 dealer $; or "s diffa hurry; "will ^ will; zhuangshikimic d' B7$ vendor ", the string decryption result is shown in Table 4. As can be seen from table 4, the small change of the ciphertext of the character string to be decrypted causes a large change of the decryption result of the ciphertext, and it is difficult to recover the original character string, so that the character string decryption method provided in this patent can resist ciphertext-only attack.
TABLE 4 ciphertext decryption result when the ciphertext of the string to be decrypted has a slight change
Claims (6)
1. A method for encrypting character strings is characterized by comprising the following steps:
(1) transcoding: converting a certain character string into numerical data one by one to obtain a high-order numerical sequence P1 ═ P11,P21,...,Pi1,....,PL1And a low order value sequence P2 ═ P12,P22,...,Pi2,....,PL2The length of the numerical value sequences P1 and P2 is consistent with the length of the character string, and is marked as L;
(2) scrambling of high-bit value sequences:
firstly, respectively calculating initial iteration step numbers m of the chaotic system by using external encryption keys (alpha and beta) according to a formula (1) shown below1And an extraction interval n1,
Then let the initial value x1The tilt tent chaotic system shown in the following formula (2) is iterated with α and μ as β, k denotes the number of iterations, and x denotes the number of iterationsk+1Denotes the chaotic signal obtained in the k-th iteration, where k is 1, 2.,
obtaining a chaotic sequence X from m1Element start every n1Taking 1 element to form a chaotic sequence Y with the length of L,
and finally, sequencing the chaotic sequence Y in an ascending order, and according to the position change scrambling rule before and after sequencing the sequence Y, setting the high-digit value sequence P1 as { P }11,P21,...,Pi1,....,PL1Scrambling to obtainScrambled high bit number sequence
(3) Bidirectional diffusion encryption of low-bit value sequences:
firstly, forward diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number m of the chaotic system by using external encryption keys (alpha and beta) according to the following formula (3)2,
Extracting mth from chaos sequence X2An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameter mu of the chaos system of the inclined tent1I.e. mu1=β,
For low bit value sequence P2 ═ { P12,P22,...,Pi2,....,PL2Each element P ini2Wherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu1Performing single iteration on the chaos system of the inclined tent shown in the formula (2) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (4) to obtain chaotic signal Y1i,
② using chaotic signal Y1iFor data Pi2Forward diffusion encryption is performed according to the following formula (5) to obtain a forward diffusion encrypted ciphertext C1i,
Wherein, Y10And C10In order to forward-spread the encryption key,
③ encrypt the ciphertext C1 according to the forward diffusioniAnd C1i-1And Y1i-1For the parameter mu of the chaos system of the inclined tent1The adjustment is made according to the following equation (6),
thereby obtaining the forward diffusion encrypted low-bit value sequence C1 ═ C11,C12,...,C1i,...,C1L};
Then, reverse diffusion encryption of low-order numerical value sequence is carried out
Calculating the initial iteration step number m of the chaotic system by using external encryption keys (alpha and beta) according to the following formula (7)3,
Extracting mth from chaos sequence X3An element as an initial value of a chaos system of a tilt tentSimultaneously obtaining the parameter mu of the chaos system of the inclined tent2I.e. mu2=β,
The sequence of low bit values C1 ═ C1 after forward diffusion encryption1,C12,...,C1i,...,C1LEach element C1 iniWherein i 1,2,3, L, in this order:
from the initial valueAnd the parameter mu2Performing single iteration on the chaos system of the inclined tent shown in the formula (2) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (8) to obtain chaotic signal Y2i,
② using chaotic signal Y2iFor data C1iPerforming reverse diffusion encryption according to the following formula (9) to obtain a bidirectional diffusion encrypted ciphertext C2i,
Wherein, Y20And C20In order to spread the encryption key in the reverse direction,
③ encrypt the ciphertext C2 according to the bidirectional diffusioniAnd C2i-1And Y2i-1For the parameter mu of the chaos system of the inclined tent2The adjustment is made according to the following equation (10),
thereby obtaining the low-bit value sequence C2 ═ { C2 ═ C2 after bidirectional diffusion encryption1,C22,...,C2i,...,C2L};
(4) Transcoding: the scrambled high-bit numerical sequence is processedAnd carrying out conversion of numerical values and characters on the low-order numerical value sequence C2 subjected to bidirectional diffusion encryption to obtain a character sequence C, namely an encrypted ciphertext of the character string, wherein the length of the sequence C isAnd is
2. The method for encrypting a character string according to claim 1, wherein: converting a certain character string into numerical data one by one in the step (1), wherein the certain character string comprises displayable ASCII characters except for blank spaces and 6763 double-byte coded Chinese characters in a GB2312 character set; the conversion of characters into numerical data one by one means that a unicode2native (-) function is adopted to convert a single Chinese character into zone bit code numerical data which are expressed as [ zone numerical data, numerical bit data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ Pi1,Pi2]Indicating that the corresponding data combination results in a high bit value sequence P1 ═ { P ═ P11,P21,...,Pi1,....,PL1And a low order value sequence P2 ═ P12,P22,...,Pi2,....,PL2}。
3. The method for encrypting a character string according to claim 1, wherein: the high-order digit value sequence after scrambling in the step (4)And the low-order digit value sequence C2 after the two-way diffusion encryption carries out the conversion of the numerical value and the character, and the conversion relation is expressed as follows:
setting a null character sequence C, and sequencing the scrambled high-digit numerical valuesAnd the low bit value sequence C2 ═ C2 after the bidirectional diffusion encryption1,C22,...,C2i,...,C2LThe following operations are sequentially carried out on each corresponding element in the structure,
First, if it is determinedAnd (C2)i+161) ≧ 250, then 1 space is added to character sequence C, i.e., C ═ C, '']Are combined with
Then using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence C, i.e.
Directly using char (·) function to convert numerical data (C2)i+33) into a single ASCII code character and added to the character sequence C, i.e. C ═ C, char (C2)i+33)]。
4. A decryption method of character strings is characterized by comprising the following steps:
(1) transcoding: a certain segment of character string cryptograph to be decryptedConverting the characters one by one into numerical data to obtain a high-order numerical sequenceAnd low bit number value sequenceWherein the length of the numerical sequences R1, R2 isSome segment of character string cryptograph to be decryptedHas a length of
(2) Descrambling of high-bit numerical sequences:
first using an external decryption keyRespectively calculating to obtain initial iteration steps of the chaotic system according to a formula (11) shown belowAnd an extraction interval
Then order the initial valueAnd parametersThe tilt tent chaotic system shown in the following formula (12) is iterated, k represents the number of iterations,denotes the chaotic signal obtained in the k-th iteration, where k is 1, 2.,
obtaining a chaotic sequenceFrom the firstElement start every otherEach element is 1, thereby forming a length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting in ascending order, according to sequenceThe position change scrambling rule before and after sorting is used for high-digit value sequencePerforming inverse scrambling to obtain an inverse-scrambled high-bit value sequence
(3) Bidirectional diffusion decryption of low-bit value sequences:
firstly, the reverse diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (13) to obtain the initial iteration step number of the chaotic system
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
For low-order bit value sequenceEach of the elements Ri2WhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersPerforming single iteration on the chaos system of the inclined tent shown as the formula (12) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (14) to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption according to the following formula (15) to obtain a reverse diffusion solutionSecret data
Wherein the content of the first and second substances,and R'02In order to spread the decryption key in the reverse direction,
thirdly, according to the element R in the low-order numerical value sequencei2、Ri-12Corresponding numerical value R'i2、R′i-12And anTo the parameters of the chaos system of the inclined tentThe adjustment is made in accordance with the following equation (16),
Then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (17) to obtain the initial iteration step number of the chaotic system
From chaotic sequencesTo extractAn element as an initial value of a chaos system of a tilt tentObtaining parameters of the chaos system of the inclined tent at the same timeNamely, it is
Decrypting a sequence of reverse diffusion decrypted low-bit valuesEach element of D1iWhereinThe following operations are sequentially carried out:
from the initial valueAnd parametersPerforming single iteration on the chaos system of the inclined tent shown as the formula (12) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (18) to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is performed according to the following formula (19) to obtain bidirectional diffusion decrypted data D2i,
Wherein the content of the first and second substances,and D10In order to spread the decryption key in the forward direction,
③ decrypting the data D1 according to the forward diffusioniAnd D1i-1Andto the parameters of the chaos system of the inclined tentThe adjustment is made according to the following equation (20),
(4) Transcoding: the high-order digit value sequence after the reverse scrambling is carried outAnd the low-bit numerical sequence D2 after bidirectional diffusion decryption is carried out, the numerical value and the character are converted to obtain a character sequence PP, namely the character string recovered after the decryption of the character string to be decrypted, wherein the length of the character sequence PP is
5. The method for decrypting character string according to claim 4, wherein: the step (1) is to decrypt a certain segment of character string ciphertext to be decryptedConverting the characters one by one into numerical data to obtain a high-order numerical sequenceAnd low bit number value sequenceThe conversion relationship is expressed as follows:
firstly, converting characters in a certain section of character string ciphertext C to be decrypted into numerical data one by one, namely, converting a single Chinese character into region bit code numerical data by adopting a unicode2native (·) function, and expressing the region bit code numerical data into region bit data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use [ R ]i1,Ri2]Represents;
then the numerical data [ Ri1,Ri2]Correspondingly combining to obtain high-order numerical value sequenceAnd low bit number value sequenceWherein
Then check the low-order numerical value sequence R2 one by one to see if there is Ri2An element of 32, if so, would correspond to the last element R in the high-order numerical sequence R1i+11Adding 1 to the value and deleting the element R with the value of 32i2And its element R in the corresponding high-order numerical sequence R1i1;
6. The method for decrypting character string according to claim 4, wherein: the high-order digit value sequence after the reverse scrambling in the step (4)And the low-order digit value sequence D2 after bidirectional diffusion decryption is used for converting the numerical value and the character, and the conversion relation is expressed as follows:
setting a null character sequence PP, and carrying out reverse scrambling on the high-digit numerical sequenceAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the sequence are operated as follows,
If it is notAnd D2i> 250, then 1 space is added to the character sequence PP, i.e. PP ═ PP, ', i.e'];
Otherwise, using native2unicode (·) function to convert numerical dataConverted into single Chinese characters and added to the character sequence PP, i.e.
Directly using char (·) function to convert numerical data (D2)i) Converted into a single ASCII code character and added to the character sequence PP, i.e. PP ═ PP, char (D2)i)]。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910215951.3A CN109981246B (en) | 2019-03-21 | 2019-03-21 | Encryption method and decryption method for character string |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910215951.3A CN109981246B (en) | 2019-03-21 | 2019-03-21 | Encryption method and decryption method for character string |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109981246A CN109981246A (en) | 2019-07-05 |
CN109981246B true CN109981246B (en) | 2021-12-17 |
Family
ID=67079846
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910215951.3A Active CN109981246B (en) | 2019-03-21 | 2019-03-21 | Encryption method and decryption method for character string |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109981246B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110457949A (en) * | 2019-08-14 | 2019-11-15 | 于向东 | A kind of data desensitization method of holding uniqueness based on data dictionary, integrality, relevance |
CN110650005B (en) * | 2019-09-17 | 2022-02-01 | 南通大学 | Chinese and English character string encryption method |
CN114500035B (en) * | 2022-01-24 | 2023-06-23 | 杭州天宽科技有限公司 | Data encryption system based on service data sharing cloud platform |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104486073A (en) * | 2014-12-23 | 2015-04-01 | 南通大学 | Encryption and decryption method of character data |
CN109472338A (en) * | 2018-11-19 | 2019-03-15 | 南通大学 | A kind of Mass production method of commodity anti-counterfeit two-dimensional bar code |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103532701B (en) * | 2013-10-16 | 2014-09-10 | 南通纺织职业技术学院 | Encryption and decryption method for numeric type data |
-
2019
- 2019-03-21 CN CN201910215951.3A patent/CN109981246B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104486073A (en) * | 2014-12-23 | 2015-04-01 | 南通大学 | Encryption and decryption method of character data |
CN109472338A (en) * | 2018-11-19 | 2019-03-15 | 南通大学 | A kind of Mass production method of commodity anti-counterfeit two-dimensional bar code |
Non-Patent Citations (5)
Title |
---|
A novel bit-level image encryption scheme using hyper-chaotic systems;Suying Sheng,Xinhua Wu;《IEEE》;20130725;全文 * |
A novel chaos-based image encryption scheme using coupled map lattices;Xinhua Wu;《IEEE》;20130725;全文 * |
基于斜帐篷混沌映射和Arnold变换的图像加密方案;李春虎等;《计算机应用研究》;20171115(第11期);全文 * |
基于有限状态斜帐篷映射的图像加密算法;张子振;《湖南理工学院学报(自然科学版)》;20101215;全文 * |
基于混沌序列置乱与扩散变换的彩色数字图像加密算法;张芳君等;《软件导刊》;20180905;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN109981246A (en) | 2019-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109995504B (en) | Encryption and decryption method for character string | |
CN109981245B (en) | Encryption and decryption method for character string | |
CN109981246B (en) | Encryption method and decryption method for character string | |
CN105847629A (en) | Reversible information hiding method for encrypted image | |
Abdulzahra et al. | Combining cryptography and steganography for data hiding in images | |
Sinha et al. | Encrypted information hiding using audio steganography and audio cryptography | |
CN109547663B (en) | Improved LSB image steganography method combined with cryptography | |
CN114157772B (en) | Digital image encryption method based on space-time chaotic system and half tensor product compressed sensing | |
Miss et al. | Fuzzy logic based image encryption for confidential data transfer using (2, 2) secret sharing scheme | |
Su et al. | A robust visual image encryption scheme based on controlled quantum walks | |
Bandekar et al. | LSB based text and image steganography using AES algorithm | |
Kundu et al. | A secure approach to audio steganography | |
CN116192360A (en) | Asymmetric visual sense meaningful image encryption method based on 2D compressed sensing | |
CN110278066B (en) | Encryption and decryption method for Chinese character string | |
CN110287713B (en) | Encryption method and decryption method for Chinese character string | |
Sivakumar et al. | Generation of random key stream using word grid puzzle for the applications of cryptography | |
Mishra et al. | Image encryption technique based on chaotic system and hash function | |
Barakat et al. | Securing Digital Image using Modified Chaotic Logistic Key | |
Reddy | Improved secure data transfer using video steganographic technique | |
Bremnavas et al. | Medical image security using LSB and chaotic logistic map | |
Sharma et al. | Steganography techniques using cryptography-a review paper | |
Jumaa | Hiding of random permutated encrypted text using lsb steganography with random pixels generator | |
CN103746793A (en) | Number form text encryption and decryption methods | |
Zyara | Suggested Method for Encryption and Hiding Image using LCG and LSB | |
Manideep et al. | Information Hiding Secretly Using Image Steganography |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |