CN109981245B - Encryption and decryption method for character string - Google Patents
Encryption and decryption method for character string Download PDFInfo
- Publication number
- CN109981245B CN109981245B CN201910215924.6A CN201910215924A CN109981245B CN 109981245 B CN109981245 B CN 109981245B CN 201910215924 A CN201910215924 A CN 201910215924A CN 109981245 B CN109981245 B CN 109981245B
- Authority
- CN
- China
- Prior art keywords
- sequence
- chaotic
- character
- numerical
- low
- 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
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000000739 chaotic effect Effects 0.000 claims abstract description 135
- 238000009792 diffusion process Methods 0.000 claims abstract description 104
- 230000002457 bidirectional effect Effects 0.000 claims abstract description 40
- 238000006243 chemical reaction Methods 0.000 claims description 17
- 238000012545 processing Methods 0.000 claims description 16
- 238000012163 sequencing technique Methods 0.000 claims description 13
- 230000001174 ascending effect Effects 0.000 claims description 8
- 238000000605 extraction Methods 0.000 claims description 8
- 239000000126 substance Substances 0.000 claims description 6
- 238000013507 mapping Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 229920000742 Cotton Polymers 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 210000000540 fraction c Anatomy 0.000 description 1
- 235000012907 honey Nutrition 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 238000001228 spectrum Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/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)
- Complex Calculations (AREA)
- Storage Device Security (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention discloses a method for encrypting and decrypting a character string, which comprises the following steps: firstly, a chaotic system is utilized to generate chaotic signals, and a certain segment of character string to be encrypted is scrambled according to a position change scrambling rule before and after a chaotic sequence is sequenced; then converting the scrambled character string into a high-order numerical sequence and a low-order numerical sequence; 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 character string, and simultaneously utilizes the cryptographic characteristic of the chaotic sequence to carry out bidirectional diffusion encryption or decryption on the low-digit numerical sequence converted from the character string, thereby having good performance of resisting known/selected plaintext attack and ciphertext-only attack and ensuring the security and feasibility of encryption and decryption of the character string.
Description
Technical Field
The invention relates to the technical field of information security, in particular to an encryption and decryption method for 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 a character string encryption and decryption method, which scrambles a certain section of character string to be encrypted by utilizing the position change rule before and after the chaos sequence generated by a chaos system is sequenced, performs bidirectional diffusion encryption on a low-digit value sequence converted from the scrambled character string by utilizing the password characteristic of the chaos sequence generated by the chaos system, and further converts the high-digit value sequence and the low-digit value sequence to generate a ciphertext, thereby ensuring the safety and feasibility of character string encryption and decryption.
The technical scheme is as follows: the invention relates to a character string encryption method, which comprises the following steps:
(1) scrambling of character strings:
firstly, an initial value x is set by using external encryption keys (alpha, beta)1The tilt tent chaotic system shown in the following formula (1) is iterated with α and μ as β, k denotes the number of iterations, and x denotes the number of iterationsk+1Representing a chaotic signal obtained from the k-th iteration, wherein k is 1,2, so as to obtain a chaotic sequence X,
then respectively calculating according to the following formula (2) to obtain the initial iteration step number m of the chaotic system1And an extraction interval (n)1) From the m-th in the chaotic sequence X1Element 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, scrambling a certain segment of character string to be encrypted according to the position change scrambling rule before and after sequencing of the sequence Y, and obtaining the scrambled character stringOf a character sequenceWherein the length of the character string is marked as L;
(2) transcoding: converting the scrambled character sequence into numerical data one by one to obtain a high-digit numerical sequenceAnd low bit number value sequenceWherein the numerical sequenceIs consistent with the length of the character 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=β,
from the initial valueAnd the parameter mu1Performing single iteration on the chaos system of the inclined tent shown in the formula (1) 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 dataForward 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 (1) 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: sequence of high-order numerical valuesAnd 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, the character sequence after scrambling in step (2) is converted into numerical data character by character, wherein the character sequence includes displayable ASCII characters except spaces and 6763 double-byte coded Chinese characters in the GB2312 character set; wherein, 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, bit numerical data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can useData ofIndicating that the corresponding data are combined to obtain a high-order numerical sequenceAnd low bit number value sequence
Further, the high-order 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 string C, and sequencing the high-order 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, make a judgment ifAnd (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 dataConverting into single Chinese character, and addingInto 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 comprises 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) 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 keysStarting valueAnd parametersThe chaos system of the tilt tent shown in the formula (11) is iterated, k represents the number of iterations,denotes the chaotic signal obtained from the k-th iteration, where k is 1,2
Calculating according to the following formula (12) to obtain the initial iteration step number of the chaotic systemFrom chaotic sequencesTo extractThe chaotic signal is used as an initial value of the chaotic system of the 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 (11) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (13) to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption according to the following formula (14) to obtain reverse diffusion decrypted data
Wherein the content of the first and second substances,and R0′2In 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 Ri′2、Ri′-12And anTo the parameters of the chaos system of the inclined tentThe adjustment is made according to the following equation (15),
Then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (16) 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 (11) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (17) to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is performed according to the following formula (18) 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 (19),
(3) Transcoding: carrying out numerical value and character processing on the high-order numerical value sequence R1 and the low-order numerical value sequence D2 after bidirectional diffusion decryptionConverting to obtain a character sequence PP, wherein the length of the character sequence PP is
(4) And (3) derangement of character strings:
first using an external decryption keyRespectively calculating to obtain initial iteration steps of the chaotic system according to a formula (20) shown belowAnd an extraction interval
Then from the chaotic sequenceTo middleElement 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 character sequencePerforming inverse scrambling to obtain the character sequence after inverse scramblingNamely the character string recovered after the character string to be decrypted is decrypted.
Further, the step (1) is to encrypt a certain segment of character string to be decryptedConverting the characters into numerical data one by one to obtain a high-order numerical sequence R1 ═ { R }11,R21,...,Ri1,....,RL1And low order bit value sequencesThe 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 the data [ Ri1,Ri2]Represents;
then, each numerical data [ R ]i1,Ri2]Corresponding combinationObtaining a high-order numerical sequenceAnd low order numerical orderColumn(s) of
Next, it is checked whether there is R in the low order numerical sequence R2i2An 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 numerical value sequence R1 and the low-order numerical value sequence D2 decrypted by the bidirectional diffusion in the step (3) are converted into values and characters, and the conversion relationship is expressed as follows:
setting a null character sequence PP, and sequencing high-digit numerical valuesAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the sequence are operated as follows,
if R isi1If greater than 128, then
If R isi1215 and 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 data [ Ri1,D2i]Converted into single Chinese character and added into the character sequence PP, i.e. PP ═ PP, native2unicode ([ R)i1,D2i])];
If R isi1If < 128, then
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 method comprises the steps of scrambling a certain section of character string to be encrypted by utilizing a position change rule before and after the chaos sequence generated by the chaos system is sequenced, performing bidirectional diffusion encryption on a low-digit value sequence converted from the scrambled character string by utilizing the password characteristic of the chaos sequence generated by the chaos system, and converting the high-digit value sequence and the low-digit value sequence to generate a ciphertext, so that the safety and feasibility of encryption and decryption of the character string are ensured.
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) scrambling of character strings:
firstly, an initial value x is set by using external encryption keys (alpha, beta)1Iterating the tilt tent chaotic system (formula as below), wherein k represents iteration number, and x represents iteration numberk+1Representing a chaotic signal obtained from the k-th iteration, wherein k is 1,2, so as to obtain a chaotic sequence X,
then respectively calculating the initial iteration step number (m) of the chaotic system according to the following formula1) And an extraction interval (n)1) From the m-th in the chaotic sequence X1Element 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, scrambling a certain segment of character string to be encrypted according to the position change scrambling rule before and after sequencing of the sequence Y to obtain a scrambled character sequenceWhere the string length is noted as L.
(2) Transcoding: converting the scrambled character sequence into numerical data one by one, wherein the character sequence comprises displayable ASCII code characters except blank spaces and 6763 Chinese characters of double-byte encoding in a GB2312 character set; wherein, 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, bit numerical data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use the dataIndicating that the corresponding data are combined to obtain a high-order numerical sequenceAnd low bit number value sequenceWherein the numerical sequenceThe length of the encryption key is consistent with the length of a certain segment of character string to be encrypted.
(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=β,
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 dataForward 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 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 of the inclined tent shown in the step (1) to obtainChaotic 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 according to the following formula 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 string C, and sequencing the high-order 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, make a judgment ifAnd (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)]
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 decryptedCharacter-by-character conversionConverting the data into numerical data to obtain a high-order numerical value sequence R1 ═ { R ═ R11,R21,...,Ri1,....,RL1R and a low order value sequence R2 ═ R12,R22,...,Ri2,....,RL2The 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 the data [ Ri1,Ri2]Represents;
then, each numerical data [ R ]i1,Ri2]Corresponding combinationObtaining a high-order numerical sequenceAnd low bit number value sequence
Next, it is checked whether there is R in the low order numerical sequence R2i2An 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 isA certain segment of word to be decryptedString cipher textHas a length of
(2) 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 keysStarting valueAnd parametersIteration is carried out on the tilting tent chaotic system (the formula is shown as follows), k represents the iteration number,denotes the chaotic signal obtained from the k-th iteration, where k is 1,2
Calculating to obtain the initial iteration step number of the chaotic system according to the following formulaFrom chaotic sequencesTo extractThe chaotic signal is used as an initial value of the chaotic system of the 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 to obtain a chaos signalFor chaotic signals simultaneouslyPerforming the following integer processing to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption to obtain reverse diffusion decrypted data
Wherein the content of the first and second substances,and R0′2In 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 Ri′2、Ri′-12And anTo the parameters of the chaos system of the inclined tentThe following adjustment is made as follows,
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 formula shown in the specification
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 to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is carried out according to the following formula 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,
(3) Transcoding: setting a null character sequence PP, and sequencing high-digit numerical valuesAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the sequence are operated as follows,
if R isi1If greater than 128, then
If R isi1215 and 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 data [ Ri1,D2i]Converted into single Chinese character and added into the character sequence PP, i.e. PP ═ PP, native2unicode ([ R)i1,D2i])];
If R isi1If < 128, the numerical data (D2) is directly processed by using char (·) functioni) Converted into a single ASCII code character and added to the character sequence PP, i.e. PP ═ PP, char (D2)i)]
(4) And (3) derangement of character strings:
first using an external decryption keyRespectively calculating the initial iteration steps of the chaotic system according to the following formulaAnd an extraction interval
Then from the chaotic sequenceTo middleElement 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 character sequencePerforming inverse scrambling to obtain the character sequence after inverse scramblingI.e. the character string recovered after the decryption of the character string to be decrypted, wherein the length of the character string 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) first, iterating the tilt tent chaotic system shown in the formula in step (1) of the encryption method for a character string in the above embodiment by using an external encryption key (α is 0.12345, β is 0.65), so as to obtain a chaotic sequence X, and meanwhile, calculating according to the formula in step (1) of the encryption method for a character string in the above embodiment, so as to obtain an initial iteration step number (m) of the chaotic system1) And an extraction interval (n)1),
m1=523+23=546
n1=19+1=20
1 is taken out every other 20 elements from the 546 th element in the chaotic sequence X, so as to form a chaotic sequence Y with the length L of 18, wherein the chaotic sequence Y is {0.361896018751758,0.707665360260700,0.416287938280632,0.569011637774278,0.276890527259342,0.467623413399187,0.989176495851167,0.169240171895533,0.675028025531495,0.458815246880602,0.612489131368256,0.174072241734472,0.580925969554056,0.934397085989157,0.159735447382966,0.158302228329434,0.858615950392380 and 0.592104003195874},
and finally sequencing the chaotic sequence Y in an ascending order, scrambling a certain section of character string to be encrypted, namely 'character string encryption/decryption 111111 aaaaaaaa', according to the position change scrambling rule {16,15,8,12,5,1,3,10,6,4,13,18,11,9,2,17,14,7} before and after the sequence Y is sequenced to obtain a scrambled character sequence
(2) The scrambled character sequence is processed Converting the characters into numerical data one by one to obtain a high-order numerical sequence And low bit number value sequence Wherein the numerical sequenceThe length of the character string is consistent with the length of the character string, and is marked as L being 18;
(3) firstly, forward diffusion encryption of low-order numerical value sequence is carried out
Using the external encryption key (α ═ 0.12345, β ═ 0.65), calculating according to the formula in step (3) of the encryption method for a character string in the above embodiment, and obtaining the initial iteration step number (m) of the chaotic system2),
m2=432+8=440
Extracting 440 th element from the chaos sequence X as an initial value of the tilt tent chaos systemSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent1=0.65),
For low-order bit value sequence Each element ofIn the above embodiment, the oblique tent chaotic mapping single iteration, the integer processing, the forward diffusion encryption and the oblique tent chaotic mapping parameter μ shown in the formula in step (3) of the encryption method for the character string are sequentially performed1Adjustment, etc., wherein forward diffusion encryption key Y1 is taken046 and C1026, so as to obtain the forward diffusion encrypted low bit number sequence C1 ═ {64,14,78,35,4,28,63,55,82,55,55,60,61,85,25,1,68,92 };
then, reverse diffusion encryption of low-order numerical value sequence is carried out
Using the external encryption key (α ═ 0.12345, β ═ 0.65), calculating according to the formula in step (3) of the encryption method for a character string in the above embodiment, and obtaining the initial iteration step number (m) of the chaotic system3),
m3=543+34=577
Extracting the 577 th element from the chaotic sequence X as an initial value of the tilting tent chaotic systemSimultaneously obtaining the parameters (mu) of the chaos system of the inclined tent2=0.65),
For low bit value sequence C1 ═ { C11,C12,...,C1i,....,C118Each element C1 in {64,14,78,35,4,28,63,55,82,55,55,60,61,85,25,1,68,92} is C1iSequentially performing single iteration and integer transformation of the chaos mapping of the inclined tent shown in the formula in the step (3) of the encryption method for the character string in the above embodimentProcessing, reverse diffusion encryption and tilt tent chaotic mapping parameter mu2Adjustment, 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 {35,26,86,76,84,32,25,31,68,74,86,2,51,90,53,66,87,60 };
(4) sequence of high-order numerical valuesAnd each corresponding element in the low-order digit value sequence C2 after bidirectional diffusion encryption is subjected to numerical value and character conversion in turn, so as to obtain a character string ciphertext as "D"; wm jin Cuochun @ Myan cocoon w # T { fraction cx]”。
According to the method for decrypting the character string in the above embodiment, the steps are as follows:
(1) a certain section of ciphertext D to be decrypted; the wm chinaware spring @ michael cocoons w # T { frac ] "are converted into numerical data one by one, and a high-bit numerical sequence R1 ═ {0,0, 189,215,180,0,195,188,0,0, 183,0,0,0} and a low-bit numerical sequence R2 ═ {68,59,119,109,245,193,186,64,229,235,119,35,84,123,214,99,120,93 };
(2) 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 (2) 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 the 577 th element as the 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 {68,59,119,109,245,193,186,64,229,235,119,35,84,123,214,99,120,93}i2Wherein i is 1,2, 3.. times, 18, the slope tent chaotic mapping single iteration, the integer processing, the inverse diffusion decryption and the slope tent chaotic mapping parameter shown in the formula in step (2) 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 low-order bit value sequence D1 after bidirectional diffusion decryption, which is {64,14,78,35,4,28,63,55,82,55,55,60,61,85,25,1,68,92 };
then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating 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 chaotic system
From chaotic sequencesExtracting 440 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 {64,14,78,35,4,28,63,55,82,55,55,60,61,85,25,1,68,92}iIn the above embodiment, the slope tent chaotic mapping single iteration, the integer processing, the forward diffusion decryption and the slope tent chaotic mapping parameter shown in the formula in step (2) of the decryption method for the character string 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 ═ {97,97,49, 226,214,174,49,220,211,97,97,49, 251,97,97,49 };
(3) converting the numerical value and the character by using the sequence of high-order values R1 ═ {0,0, 189,215,180,0,195,188,0,0, 183,0, 0} and the sequence of low-order values D2 ═ 97,97,49, 226,214,174,49,220,211,97,97,49, 251,97,97,49}, wherein the character string is "aa 11 string 1 dense plus aa11 character aa 1", that is, the character sequence PP { 'a', 'a', '1', '1', '1', 'solution', 'word', 'string', '1', 'dense', 'a', 'a', 'a', '1', '1', '1', 'and';
(4) first using an external decryption keyCalculating according to the formula in step (4) of the decryption method for the character string in the above specific embodiment to obtain the initial iteration step number of the chaos mapping of the tilt tentAnd an extraction interval
From chaotic sequencesThe 546 th element is started to take 1 every 20 elements, thereby forming the length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting in ascending order, according to sequenceThe position change scrambling rule before and after the ordering {16,15,8,12,5,1,3,10,6,4,13,18,11,9,2,17,14,7}, inverse scrambling is performed on the character sequence PP { ' a ', ' a ', ' 1 ', ' 1 ', ' solution ', ' word ', ' string ', ' 1 ', ' cipher ', ' addition ', ' a ', ' 1 ', ' 1 ', ' character ', ' a ', ' a ', ' 1 ', ' 1 ', ' 1 ', ' string ', ' addition ', ' solution ', ' cipher ', ' 1 ', ' 1 ', ' 1 ', ' 1 ', ' 1 ', ' a ', ' a ', ' a ', ' a ', ' and ' a ' }, namely the character string recovered after the decryption of the character string to be decrypted is 'character string encryption and decryption 111111 aaaaaaa',
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.65000000000001; 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 string encryption ciphertext generated by the 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 string to be encrypted, so that the 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 Chinese characters, a certain section of ciphertext to be decrypted is D; wm jin Cuochun @ Myan cocoon w # T { fraction cx]", the decryption step of a string is similar to that of embodiment 1, and only slight changes occur in the decryption key:orOrOr D1027; orOr R0′2The string ciphertext decryption result is shown in table 3, 37. As can be seen from table 3, a small change in the decryption key causes a large change in the decryption result of the ciphertext, and the recovered string is useless, so that the method for decrypting the string provided in this patent is sensitive to the decryption key.
TABLE 3 ciphertext decipher result when external decipher key is changed slightly
Example 5
According to the method for decrypting the character string, the decryption steps are similar to those of the embodiment 1, and only a certain section of the character string ciphertext to be decrypted ("D; wm Jinzhichun @ Myan cocoon w # T { subdivision cx ]") is slightly changed: "d; wm jin dui chun @ michael cocoon w # T { fraction cx ] "; or "D; wm Cotton cut spring @ Myan cocoon w # T { subdivision cx ] "; or "D; wm brocade chiseling & burma cocoon w # T { fraction cx ] "; or "D; wm jin kui chun @ michael cocoon W # T { subdivision cx ] "; or "D; wm jin dui chun @ burma cocoon w # T [ fen cx ] "; or "D; wm jin kui chun @ michael cocoon w # T { fen cx } "; or "; dwm Chizuchun @ Myan cocoon w # T { subdivision cx ] "; or "D; wm brocade chikura @ Myan cocoon w # T { fraction c ] x ", and the string decryption results are 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) scrambling of character strings:
firstly, an initial value x is set by using external encryption keys (alpha, beta)1The tilt tent chaotic system shown in the following formula (1) is iterated with α and μ as β, k denotes the number of iterations, and x denotes the number of iterationsk+1Representing a chaotic signal obtained from the k-th iteration, wherein k is 1,2, so as to obtain a chaotic sequence X,
then, the initial iteration step numbers (m) of the chaotic system are respectively calculated according to the following formula (2)1) And an extraction interval (n)1) From the m-th in the chaotic sequence X1Element 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, scrambling a certain segment of character string to be encrypted according to the position change scrambling rule before and after sequencing of the sequence Y to obtain a scrambled character sequenceWherein the length of the character string is marked as L;
(2) transcoding: converting the scrambled character sequence into numerical data one by one to obtain a high-digit numerical sequenceAnd low bit number value sequenceWherein the numerical sequenceIs consistent with the length of the character 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 parameters (mu) of the chaos system of the inclined tent1) I.e. mu1=β,
from the initial valueAnd the parameter mu1Performing single iteration on the chaos system of the inclined tent shown in the formula (1) 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 dataForward 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 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 of the inclined tent shown in the formula (1) 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: sequence of high-order numerical valuesAnd 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 the scrambled character sequence into numerical data one by one in the step (2), wherein the character sequence comprises displayable ASCII code characters except blank spaces and 6763 Chinese characters of double-byte encoding in the GB2312 character set(ii) a Wherein, 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, bit numerical data]Or converting displayable ASCII code characters into ASCII code numerical data expressed as [0, ASCII code numerical data]All can use the dataIndicating that the corresponding data are combined to obtain a high-order numerical sequenceAnd low bit number value sequence
3. The method for encrypting a character string according to claim 1, wherein: the high-order digit value sequence 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 string C, and sequencing the high-order 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, make a judgment ifAnd (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: converting a certain segment of character string ciphertext C to be decrypted into numerical data one by one to obtain a high-order numerical sequence R1 ═ R11,R21,...,Ri1,....,RL1R and a low order value sequence R2 ═ R12,R22,...,Ri2,....,RL2Wherein the length of the numerical value sequences R1, R2 isSome segment of character string cryptograph to be decryptedHas a length of
(2) 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 keysStarting valueAnd parametersThe chaos system of the tilt tent shown in the formula (11) is iterated, k represents the number of iterations,denotes the chaotic signal obtained from the k-th iteration, where k is 1,2
Calculating according to the following formula (12) to obtain the initial iteration step number of the chaotic systemFrom chaotic sequencesTo extractThe chaotic signal is used as an initial value of the chaotic system of the 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 Ri2Wherein i is 1,2, 3.,the 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 (11) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (13) to obtain chaotic signal
② using chaotic signalsFor data Ri2Performing reverse diffusion decryption according to the following formula (14) to obtain reverse diffusion decrypted data
Wherein the content of the first and second substances,and R0′2In 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 Ri′2、Ri′-12And anTo the parameters of the chaos system of the inclined tentThe adjustment is made according to the following equation (15),
thereby obtaining the sequence D1 ═ D1 of the low-bit value after the reverse diffusion decryption1,D12,...,D1i,...,D1L};
Then, forward diffusion decryption of the low-order bit value sequence is carried out
Using external decryption keysCalculating according to the following formula (16) 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 D1iWherein i is 1,2, 3.,the 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 (11) to obtain a chaos signalFor chaotic signals simultaneouslyPerforming integer processing according to the following formula (17) to obtain chaotic signal
② using chaotic signalsFor data D1iForward diffusion decryption is performed according to the following formula (18) 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 (19),
(3) Transcoding: carrying out value-to-character conversion on the high-order numerical value sequence R1 and the low-order numerical value sequence D2 after bidirectional diffusion decryption to obtain a character sequence PP, wherein the length of the character sequence PP is
(4) And (3) derangement of character strings:
first using an external decryption keyRespectively calculating to obtain initial iteration steps of the chaotic system according to a formula (20) shown belowAnd an extraction interval
Then from the chaotic sequenceTo middleElement start every otherEach element is 1, thereby forming a length ofOf the chaotic sequence
Finally, the chaotic sequence is processedSorting according to ascending order, and performing reverse scrambling on each character in the character string PP according to the position change scrambling rule before and after sorting of the sequence Y to obtain a character sequence after reverse scramblingNamely the character string recovered after the character string to be decrypted is decrypted.
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, 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 the data [ Ri1,Ri2]Represents;
then, each numerical data [ R ]i1,Ri2]Corresponding combinationObtaining a high-order numerical sequenceAnd low bit number value sequence
Next, it is checked whether there is R in the low order numerical sequence R2i2An 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: and (3) performing conversion of numerical values and characters on the high-order numerical value sequence R1 and the low-order numerical value sequence D2 subjected to bidirectional diffusion decryption, wherein the conversion relation is expressed as follows:
setting a null character sequence PP, and sequencing high-digit numerical valuesAnd the low-bit value sequence after bidirectional diffusion decryptionThe corresponding elements in the sequence are operated as follows,
if R isi1If greater than 128, then
If R isi1215 and D2i> 250, then 1 space is added to the character sequence PP, i.e. PP ═ PP, ', i.e'](ii) a Otherwise, using native2unicode () function to convert numerical data [ Ri1,D2i]Converted into single Chinese character and added into the character sequence PP, i.e. PP ═ PP, native2unicode ([ R)i1,D2i])];
If R isi1If < 128, then
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 |
---|---|---|---|
CN201910215924.6A CN109981245B (en) | 2019-03-21 | 2019-03-21 | Encryption and decryption method for character string |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910215924.6A CN109981245B (en) | 2019-03-21 | 2019-03-21 | Encryption and decryption method for character string |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109981245A CN109981245A (en) | 2019-07-05 |
CN109981245B true CN109981245B (en) | 2022-01-28 |
Family
ID=67079842
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910215924.6A Active CN109981245B (en) | 2019-03-21 | 2019-03-21 | Encryption and decryption method for character string |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109981245B (en) |
Families Citing this family (5)
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 |
CN110650006B (en) * | 2019-09-17 | 2021-11-12 | 南通大学 | Encryption and decryption method for Chinese and English character strings |
CN111985591B (en) * | 2020-07-24 | 2022-06-21 | 南通大学 | Commodity anti-counterfeiting code generation method based on character string encryption |
CN112163230B (en) * | 2020-09-16 | 2021-09-24 | 南通大学 | Commodity anti-counterfeiting code generation method based on Chinese character encryption |
CN113095042B (en) * | 2021-03-23 | 2023-12-19 | 广州零端科技有限公司 | Character string encryption method, system, device and storage medium |
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 |
CN109102452A (en) * | 2018-07-28 | 2018-12-28 | 河南大学 | A kind of image encryption method based on Latin square scramble and directional diffusion |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9836281B2 (en) * | 2013-03-12 | 2017-12-05 | Greg J. Wright | Encryption method and system using a random bit string encryption key |
-
2019
- 2019-03-21 CN CN201910215924.6A patent/CN109981245B/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 |
CN109102452A (en) * | 2018-07-28 | 2018-12-28 | 河南大学 | A kind of image encryption method based on Latin square scramble and directional diffusion |
Non-Patent Citations (1)
Title |
---|
一种基于双向扩散的混沌图像加密算法研究;吴新华;《南通纺织职业技术学院学报(综合版)》;20140630;第14卷(第2期);13-17 * |
Also Published As
Publication number | Publication date |
---|---|
CN109981245A (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 | |
CN110011783B (en) | Encryption and decryption method for Chinese characters | |
Sinha et al. | Encrypted information hiding using audio steganography and audio cryptography | |
CN105100115A (en) | Data storage method for privacy protection based on encryption password and data fractionation | |
CN104751401A (en) | Novel piecewise linear chaotic mapping image encrypting and encoding method | |
CN104378198A (en) | Voice encryption method based on block cipher system | |
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 | |
CN103179319A (en) | Method for encrypting digital images of double-chaos system | |
Miss et al. | Fuzzy logic based image encryption for confidential data transfer using (2, 2) secret sharing scheme | |
Bandekar et al. | LSB based text and image steganography using AES algorithm | |
Yahaya et al. | Cryptosystem for secure data transmission using Advance Encryption Standard (AES) and Steganography | |
Kundu et al. | A secure approach to audio steganography | |
Suresh et al. | Separable reversible data hiding using Rc4 algorithm | |
CN116192360A (en) | Asymmetric visual sense meaningful image encryption method based on 2D compressed sensing | |
Alghamdi et al. | A secure iris image encryption technique using bio-chaotic algorithm | |
CN110278066B (en) | Encryption and decryption method for Chinese character string | |
Alghamdi et al. | Bio-chaotic stream cipher-based iris image encryption | |
Sivakumar et al. | Generation of random key stream using word grid puzzle for the applications of cryptography | |
CN110287713B (en) | Encryption method and decryption method for Chinese character string | |
Bartwal et al. | Lossless and Reversible Data Hiding in Encrypted Images With Public Key Cryptography. | |
Barakat et al. | Securing Digital Image using Modified Chaotic Logistic Key | |
Reddy | Improved secure data transfer using video steganographic technique |
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 | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20231221 Address after: 707, 7th Floor, Building 3, Zilang Science and Technology City, No. 60 Chongzhou Avenue, Development Zone, Nantong City, Jiangsu Province, 226000 Patentee after: Jiangsu Xunrui Technology Co.,Ltd. Address before: 226000 No. 87 Youth Middle Road, Nantong City, Jiangsu Province Patentee before: JIANGSU College OF ENGINEERING AND TECHNOLOGY |