CN112994875B - Encryption method, decryption method, communication method, system and device thereof - Google Patents

Encryption method, decryption method, communication method, system and device thereof Download PDF

Info

Publication number
CN112994875B
CN112994875B CN202110470641.3A CN202110470641A CN112994875B CN 112994875 B CN112994875 B CN 112994875B CN 202110470641 A CN202110470641 A CN 202110470641A CN 112994875 B CN112994875 B CN 112994875B
Authority
CN
China
Prior art keywords
string
encryption
state vector
module
pseudo
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
Application number
CN202110470641.3A
Other languages
Chinese (zh)
Other versions
CN112994875A (en
Inventor
张洁
王刚
周维杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Zhiying Artificial Intelligence Research Institute Co ltd
Nanjing Xuanying Network Technology Co ltd
Original Assignee
Nanjing Zhiying Artificial Intelligence Research Institute Co ltd
Nanjing Xuanying Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Zhiying Artificial Intelligence Research Institute Co ltd, Nanjing Xuanying Network Technology Co ltd filed Critical Nanjing Zhiying Artificial Intelligence Research Institute Co ltd
Priority to CN202110470641.3A priority Critical patent/CN112994875B/en
Publication of CN112994875A publication Critical patent/CN112994875A/en
Application granted granted Critical
Publication of CN112994875B publication Critical patent/CN112994875B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/065Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
    • H04L9/0656Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps

Abstract

The invention provides an encryption method, a decryption method, a communication method, a system and a device thereof, comprising the following steps: initializing a state vector K; binary conversion is carried out on the algorithm key to form a first byte stream, and an index number is generated; marking the frame header information of the algorithm key according to the index number; rotating the first byte stream to form a new cipher state vector Q; carrying out error XOR calculation on the state vector K, the password state vector Q and the original character string to form a second byte stream; storing the second byte stream in an array to form a character encryption string; and encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain the encrypted character string. The encryption and decryption method is based on the loss symmetric conversion of the matrix, the formed result is complex, the cutting is irregular and can be followed, meanwhile, the generated string is a binary secret code stream which cannot be simulated and is difficult to crack violently, and the security level is high.

Description

Encryption method, decryption method, communication method, system and device thereof
Technical Field
The invention belongs to the technical field of data communication encryption, and particularly relates to an encryption method, a decryption method, a communication method, a system and a device thereof.
Background
Common algorithms for network communication encryption such as RSA are mostly applied to network security check in a cloud system, the process is complex, asymmetric encryption and low in encryption and decryption speed, the algorithm and the loading of an algorithm library are troublesome, real-time verification of data communication cannot be performed, and the method is not suitable for real-time rapid interaction of local area network data.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: an encryption method, a decryption method, a communication method, a system and a device thereof are provided, which utilize two-stage keys to encrypt and decrypt data, and further improve the security of data transmission.
The invention is realized by the following steps: an encryption method comprising the steps of:
initializing a state vector K;
binary conversion is carried out on the algorithm key to form a first byte stream, and an index number is generated;
marking the frame header information of the algorithm key according to the index number;
rotating the first byte stream to form a new cipher state vector Q;
performing vector XOR calculation on the state vector K, the password state vector Q and the original character string to form a second byte stream;
storing the second byte stream in an array to form a character encryption string;
and encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain an encryption string.
Further, the state vector K and the cipher state vector Q each comprise 256 bytes.
Further, the algorithm key is generated by adopting a pseudo-random number method, and the data key is generated by utilizing base64 for encryption according to the algorithm key and the index number.
The invention also provides a decryption method, which comprises the following steps:
extracting a time stamp, an index number, a data key and a character encryption string in the encryption string by using base 64;
judging whether the index number is matched with preset frame header information or not, and if so, decrypting the data key by using base64 to obtain an algorithm key;
initializing a state vector K;
carrying out binary conversion on the algorithm key to form a first byte stream and generating an index number;
rotating the first byte stream to form a new cipher state vector Q;
and carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain an original character string.
Further, the state vector K and the cipher state vector Q each comprise 256 bytes.
Further, after extracting the timestamp, the index number, the data key, and the encrypted string in the encrypted string by using base64, before determining whether the index number matches with the preset frame header information, the method further includes:
and judging whether the difference value between the timestamp and the current time does not exceed a preset value, if so, turning to the step of judging whether the index number is matched with preset frame header information.
Further, the preset value is 3 seconds.
The invention also provides a communication method, which comprises the following steps:
the first process encrypts the original character string by adopting the encryption method to obtain an encrypted character string;
the process I sends the encrypted character string to a process II;
and after receiving the encrypted character string, the process two decrypts the encrypted character string by adopting the decryption method to obtain the original character string.
The present invention also provides an encryption system, comprising:
the initialization module is used for initializing a state vector K;
the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generate an index number;
the marking module is used for marking the frame header information of the algorithm key according to the index number;
the rotation module is used for rotating the first byte stream to form a new password state vector Q;
the computing module is used for carrying out vector XOR computation on the state vector K, the password state vector Q and the original character string to form a second byte stream;
the character encryption string generation module is used for storing the second byte stream in an array to form a character encryption string;
and the encryption module is used for encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain an encryption character string.
The present invention also provides a decryption system, comprising:
the extraction module is used for extracting the time stamp, the index number, the data key and the character encryption string in the encryption string by using base 64;
the judging module is used for judging whether the index number is matched with preset frame header information or not, and if so, the decrypting module is started;
the decryption module is used for decrypting the data key by using base64 to obtain an algorithm key;
the initialization module is used for initializing a state vector K;
the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generate an index number;
the rotation module is used for rotating the first byte stream to form a new password state vector Q;
and the calculation module is used for carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain an original character string.
Further, after extracting the timestamp, the index number, the data key, and the encrypted string in the encrypted string by using base64, before determining whether the index number matches with the preset frame header information, the method further includes:
and the matching module is used for judging whether the difference value between the timestamp and the current time does not exceed a preset value or not, and if so, starting the judging module.
The present invention also provides a communication system, comprising:
the encryption module is used for encrypting the original character string by adopting the encryption method to obtain an encrypted character string;
a sending module, configured to send an encrypted string;
a receiving module for receiving the encrypted character string;
and the decryption module is used for decrypting the encrypted character string by adopting the decryption method to obtain the original character string.
The invention also provides an encryption device, which comprises a processor and a memory; the memory stores a computer program, and the processor implements the steps of the encryption method when executing the computer program.
The invention also provides a decryption device, which comprises a processor and a memory; the memory stores a computer program, and the processor implements the steps of the decryption method when executing the computer program.
The invention also provides a communication device, which comprises a processor and a memory; the memory stores a computer program which, when executed by the processor, implements the steps of the above-described communication method.
The invention has the following beneficial effects:
1. the encryption and decryption method is based on data character string vectorization, and exclusive OR conversion is carried out on the data character string vectorization, so that the formed result is complex and random, and the generated string is a binary encrypted code stream which cannot be simulated, so that the algorithm is difficult to crack violently, and the security level is high.
2. The encryption and decryption method can be realized by C language, the formed code amount is less, and the encryption and decryption method does not depend on any bottom library, can be transplanted to any platform, and improves the universality among the platforms.
3. The encryption and decryption method of the invention adds a timestamp verification process to the secret key, and improves the real-time security of data transmission.
Drawings
FIG. 1 is a flow chart of an encryption method in the present invention;
fig. 2 is a flowchart of a decryption method in the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
The invention provides a communication method, which comprises the following steps:
for a piece of the original string "HardwareType #1# 1004",
the first process encrypts the original string to obtain an encrypted string 0YFhpus01y98UpMg1 bsa 0fICp9vHY7 deend 8p1XcQeE42Riuu6 Iv.
And the process I sends the encrypted character string to the process II.
And after receiving the encrypted character string, the process II decrypts the encrypted character string to obtain an original character string HardwareType #1# 1004.
Based on the same inventive concept, the invention also provides a communication system, which comprises an encryption module, a sending module, a receiving module and a decryption module.
Based on the same inventive concept, the invention also provides a communication device, which comprises a processor and a memory; the memory stores a computer program which, when executed by the processor, implements the steps of the above-described communication method.
The encryption module is used for encrypting the original character string to obtain an encrypted character string; the sending module is used for sending the encrypted character string; the receiving module is used for receiving the encrypted character string; the decryption module is used for decrypting the encrypted character string to obtain an original character string.
As shown in fig. 1, the process of encrypting the original character string to obtain the encrypted character string includes the following steps:
SA01, initialize state vector K. The length of the state vector K is 256, i.e., S [0], S [1],. and S [255 ]. Each cell is a byte, and each byte is assigned 0, 1, 2, 3, 4, 5, 6,.. 254, 255 in ascending order.
SA02, binary conversion is carried out on the algorithm key to form a first byte stream, and an index number is generated. In this encryption process, an algorithm key is used as an encryption key. Specifically, the method comprises the following steps:
SA021, algorithm key are a series of 256 pseudo-random numbers which are not more than 255 at maximum and not less than 0 at minimum, and are generated by adopting a pseudo-random number method, and each 3 bits represent one pseudo-random number. Such as: 123/089/034/124/255/./098 (in this example, "/" is used only to distinguish between two adjacent arrays, has no practical meaning, and is deleted in practical operation), where 123 is a pseudo-random number, and is binary-converted to 01111011 and stored as a byte in the byte array, and similarly 089, 034, 124, 255,./098 are binary-converted and stored as a byte in the byte array. The 256 byte array is the first byte stream. It should be noted that, the generation method of the algorithm key is a conventional technique, and for example, a method of generating an encryption key is described in a chinese patent application publication having a publication number of "CN 110391898A" and a publication date of "10/29/2019", that is, "a 4: and generating an encryption key by using a pseudo-random number generator, wherein the function of the encryption key is the same as that of the algorithm key in the application, and the description is omitted in the invention.
SA022, taking the first bit, the middle 6 bits and the last bit of byte of each byte array to form an 8-bit byte array, and performing ASCll conversion on each byte in the byte array to form a character string with the length of 8, wherein the character string is an index number. For example, each byte of the 8-bit byte array is 35/36/65/78/97/123/77/45 (in this example, "/" is only used to distinguish two adjacent arrays, and has no practical meaning, and needs to be deleted in practical operation), and the strings obtained by performing ASCLL conversion on the byte array are #, $, a, N, a, {, M, -, # $ ANa { M-, which is the index number of the 8-bit byte array.
And SA03, marking the frame header information of the algorithm key according to the index number. Specifically, the index number is used as the header information of the algorithm key.
SA04, the first byte stream is rotated to form a new cipher state vector Q. Specifically, a new cryptographic state Vector Q is formed by directly writing the first byte stream into a Vector, and the length of the cryptographic state Vector Q is 256, i.e., S [0], S [1]. S [255 ]. Each cell is a byte, each byte being a pseudo-random number.
SA05, and carrying out vector XOR calculation on the state vector K, the password state vector Q and the original character string to obtain a second byte stream. Specifically, the method comprises the following steps:
SA051, carrying out XOR calculation on the corresponding units of the state vector K, the password state vector Q and the original character string in sequence to obtain a new value, wherein the values respectively correspond to the values of the corresponding units of the new vector. For example, the first unit S of the state vector K is 0, the first unit S of the password state vector Q is 89, one unit of the original character string is also 0, the first unit of the new vector obtained by xoring the 3 units is 89, and so on, the obtained results of the xor of the 256 units form a new vector.
SA052, directly writing the new vector into the byte array to obtain a second byte stream.
SA06, storing the second byte stream in the array to form a character encryption string.
SA07, and encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain the encrypted character string. Specifically, the method comprises the following steps:
SA071, ASCLL converting the real-time timestamp, index number, data key and second byte stream to form a 256-bit string, such as converting the byte array of the index number into a string. And forming a new character string in sequence, namely a character string formed by the time stamp character string, the index number, the data key and the second byte stream.
SA072, base64 encryption is carried out on the new character string to obtain an encrypted character string. The data key is converted into a character string with a length of 256 by an algorithm key, for example, in the conversion mode of an index number, after the character string and the index number form a character string, base64 is performed to encrypt the character string to form a new 32-bit character string, which is the data key.
Based on the same inventive concept, the invention also provides an encryption system, which comprises an initialization module, a conversion module, a marking module, a rotation module, a calculation module, a character encryption string generation module and an encryption module.
The initialization module is used for initializing a state vector K; the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generating an index number; the marking module is used for marking the frame header information of the algorithm key according to the index number; the rotation module is used for rotating the first byte stream to form a new password state vector Q; the calculation module is used for carrying out vector XOR calculation on the state vector K, the password state vector Q and the original character string to form a second byte stream; the character encryption string generation module is used for storing the second byte stream in an array to form a character encryption string; the encryption module is used for encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain an encryption character string.
Based on the same inventive concept, the invention also provides an encryption device, which comprises a processor and a memory; the memory stores a computer program which when executed by the processor implements the steps of the encryption method.
As shown in fig. 2, the process of decrypting the encrypted character string to obtain the original character string includes the following steps:
SB01, extracting time stamp, index number, data key and character encryption string in the encryption string by using base 64. The process is the reverse process to the step SA071 in the encryption process, and is not described herein again.
SB02, judging whether the difference between the timestamp and the current time does not exceed a preset value, if yes, turning to the step SB 03. In this example, the preset value is 3 seconds.
SB03, judging whether the index number obtained by decryption matches with the preset frame header information, if yes, turning to SB 04.
SB04, decrypts the data key with base64 to obtain the algorithm key. In the decryption process, the algorithm key is used as a decryption key. The encryption and decryption processes adopt a symmetric encryption mode, so that an encryption key and a decryption key must be kept consistent. The preset frame header information is the frame header information for marking the algorithm key in the encryption process, as in step SA03 of the encryption process. And verifying the validity of the encrypted character string by judging the two index numbers. The process of obtaining the algorithm key by decompressing the data key and the process of obtaining the data key by encrypting the algorithm key in the encryption process are the reverse processes, and are not described herein again. The security of the decryption process can be improved by the steps SB02 and SB 03.
SB05, initialize state vector K. This process is the same as step SA01 in the encryption process, and therefore, will not be described again.
SB06, binary conversion is carried out on the algorithm key to form a first byte stream, and an index number is generated. This process is the same as step SA02 in the encryption process, and therefore, will not be described again.
SB07, rotates the first byte stream to form a new cipher state vector Q. This process is the same as step SA04 in the encryption process, and therefore, will not be described again.
SB08, carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain the original character string. This process is the same as the method for obtaining the second byte stream in step SA05 of the encryption process, and therefore, the description thereof is omitted.
It should be noted that, in the encryption process, the algorithm key is used as the encryption key. In the decryption process, the algorithm key is used as a decryption key. The encryption and decryption processes adopt a symmetric encryption mode, so that an encryption key and a decryption key must be kept consistent. In step SA051, the process of sequentially performing xor calculation on the corresponding units of the state vector K, the password state vector Q and the original character string to obtain a new value and further obtaining a new vector is based on data character string vectorization and is subjected to xor conversion. Similarly, the process of "performing vector exclusive-or calculation on the state vector K, the password state vector Q, and the character encryption string to obtain the original character string" in step SB08 is also based on data character string vectorization, and is subjected to the process of performing exclusive-or conversion on the data character string vectorization.
Based on the same inventive concept, the decryption system comprises an extraction module, a matching module, a judgment module, a decryption module, an initialization module, a conversion module, a rotation module and a calculation module.
The extraction module is used for extracting a time stamp, an index number, a data key and a character encryption string in the encryption string by using base 64; the matching module is used for judging whether the difference value between the timestamp and the current time does not exceed a preset value or not, and if so, the judging module is started; the judging module is used for judging whether the index number is matched with the preset frame header information or not, and if so, the decrypting module is started; the decryption module is used for decrypting the data key by using base64 to obtain an algorithm key; the initialization module is used for initializing a state vector K; the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generating an index number; the rotation module is used for rotating the first byte stream to form a new password state vector Q; and the calculation module is used for carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain an original character string.
Based on the same inventive concept, the invention also provides a decryption device, which comprises a processor and a memory; the memory stores a computer program, and the processor implements the steps of the decryption method when executing the computer program.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (14)

1. An encryption method, comprising the steps of:
initializing a state vector K;
binary conversion is carried out on the algorithm key to form a first byte stream, and an index number is generated; the algorithm key is a pseudo-random number sequence which is generated by adopting a pseudo-random number method and consists of a string of 256 pseudo-random numbers with the maximum value not more than 255 and the minimum value not less than 0, and each 3 bits represent one pseudo-random number; the binary conversion process is as follows: after binary conversion, each pseudo-random number is stored in a byte array as a byte to form a first byte stream containing 256 byte arrays;
marking the frame header information of the algorithm key according to the index number;
rotating the first byte stream to form a new cipher state vector Q;
performing vector XOR calculation on the state vector K, the password state vector Q and the original character string to form a second byte stream;
storing the second byte stream in an array to form a character encryption string;
and encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain an encrypted character string, wherein the data key is generated by encrypting by using base64 according to the algorithm key and the index number.
2. An encryption method according to claim 1, characterized in that said state vector K and said cipher state vector Q each comprise 256 bytes.
3. A decryption method, comprising the steps of:
extracting a time stamp, an index number, a data key and a character encryption string in the encryption string by using base 64;
judging whether the index number is matched with preset frame header information, if so, decrypting the data key by using base64 to obtain an algorithm key; the algorithm key is a pseudo-random number sequence which is generated by adopting a pseudo-random number method and consists of a string of 256 pseudo-random numbers with the maximum value not more than 255 and the minimum value not less than 0, and each 3 bits represent one pseudo-random number;
initializing a state vector K;
carrying out binary conversion on the algorithm key to form a first byte stream and generating an index number; the binary conversion process is as follows: after binary conversion, each pseudo-random number is stored in a byte array as a byte to form a first byte stream containing 256 byte arrays;
rotating the first byte stream to form a new cipher state vector Q;
and carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain an original character string.
4. A decryption method according to claim 3, wherein the state vector K and the cipher state vector Q each comprise 256 bytes.
5. The decryption method according to claim 3, wherein after extracting the timestamp, the index number, the data key and the encrypted string in the encrypted string by using base64, before determining whether the index number matches the predetermined frame header information, further comprising:
and judging whether the difference value between the timestamp and the current time does not exceed a preset value, if so, turning to the step of judging whether the index number is matched with preset frame header information.
6. A decryption method according to claim 5, wherein the predetermined value is 3 seconds.
7. A communication method, comprising the steps of:
process one encrypts the original character string by the encryption method according to any one of claims 1 to 2 to obtain an encrypted character string;
the process I sends the encrypted character string to a process II;
and after receiving the encrypted character string, the process two decrypts the encrypted character string by adopting the decryption method as claimed in any one of claims 3 to 6 to obtain the original character string.
8. An encryption system, comprising:
the initialization module is used for initializing a state vector K;
the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generate an index number; the algorithm key is generated by adopting a pseudo-random number method; the algorithm key is a pseudo-random number sequence which is generated by adopting a pseudo-random number method and consists of a string of 256 pseudo-random numbers with the maximum value not more than 255 and the minimum value not less than 0, and each 3 bits represent one pseudo-random number; the binary conversion process is as follows: after binary conversion, each pseudo-random number is stored in a byte array as a byte to form a first byte stream containing 256 byte arrays;
the marking module is used for marking the frame header information of the algorithm key according to the index number;
the rotation module is used for rotating the first byte stream to form a new password state vector Q;
the computing module is used for carrying out vector XOR computation on the state vector K, the password state vector Q and the original character string to form a second byte stream;
the character encryption string generation module is used for storing the second byte stream in an array to form a character encryption string;
and the encryption module is used for encrypting the character encryption string by using base64 according to the real-time timestamp, the index number and the data key to obtain an encrypted character string, and the data key is generated by encrypting by using base64 according to the algorithm key and the index number.
9. A decryption system, comprising:
the extraction module is used for extracting the time stamp, the index number, the data key and the character encryption string in the encryption string by using base 64;
the judging module is used for judging whether the index number is matched with preset frame header information or not, and if so, the decrypting module is started;
the decryption module is used for decrypting the data key by using base64 to obtain an algorithm key; the algorithm key is a pseudo-random number sequence which is generated by adopting a pseudo-random number method and consists of a string of 256 pseudo-random numbers with the maximum value not more than 255 and the minimum value not less than 0, and each 3 bits represent one pseudo-random number;
the initialization module is used for initializing a state vector K;
the conversion module is used for carrying out binary conversion on the algorithm key to form a first byte stream and generate an index number; the binary conversion process is as follows: after binary conversion, each pseudo-random number is stored in a byte array as a byte to form a first byte stream containing 256 byte arrays;
the rotation module is used for rotating the first byte stream to form a new password state vector Q;
and the calculation module is used for carrying out vector XOR calculation on the state vector K, the password state vector Q and the character encryption string to obtain an original character string.
10. The decryption system of claim 9, wherein after extracting the timestamp, the index number, the data key and the encrypted string in the encrypted string by using base64, before determining whether the index number matches the predetermined frame header information, further comprising:
and the matching module is used for judging whether the difference value between the timestamp and the current time does not exceed a preset value or not, and if so, starting the judging module.
11. A communication system, comprising:
an encryption module, configured to encrypt an original character string by using the encryption method according to any one of claims 1 to 2 to obtain an encrypted character string;
a sending module, configured to send an encrypted string;
a receiving module for receiving the encrypted character string;
a decryption module, configured to decrypt the encrypted string by using the decryption method according to any one of claims 3 to 6 to obtain the original string.
12. An encryption apparatus comprising a processor and a memory; the memory stores a computer program which when executed by the processor implements the steps of the encryption method of claim 1.
13. A decryption apparatus comprising a processor and a memory; the memory stores a computer program which, when executed by the processor, implements the steps of the decryption method of claim 3.
14. A communication device comprising a processor and a memory; the memory stores a computer program which, when executed by the processor, implements the steps of the communication method as claimed in claim 7.
CN202110470641.3A 2021-04-29 2021-04-29 Encryption method, decryption method, communication method, system and device thereof Active CN112994875B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110470641.3A CN112994875B (en) 2021-04-29 2021-04-29 Encryption method, decryption method, communication method, system and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110470641.3A CN112994875B (en) 2021-04-29 2021-04-29 Encryption method, decryption method, communication method, system and device thereof

Publications (2)

Publication Number Publication Date
CN112994875A CN112994875A (en) 2021-06-18
CN112994875B true CN112994875B (en) 2022-05-17

Family

ID=76336532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110470641.3A Active CN112994875B (en) 2021-04-29 2021-04-29 Encryption method, decryption method, communication method, system and device thereof

Country Status (1)

Country Link
CN (1) CN112994875B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113242128B (en) * 2021-07-13 2022-02-08 北京天御云安科技有限公司 Timestamp correction method based on system time as cryptographic algorithm initialization vector
CN113935059B (en) * 2021-12-16 2022-03-15 国网浙江省电力有限公司杭州供电公司 Dynamic encryption method and device suitable for financial data and storage medium
CN114285560B (en) * 2021-12-27 2024-03-29 安徽华云安科技有限公司 Data processing method, device, electronic equipment and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104966525A (en) * 2015-01-14 2015-10-07 腾讯科技(深圳)有限公司 File encryption method and apparatus, and file decryption method and apparatus
CN110096851A (en) * 2019-05-13 2019-08-06 北京奇艺世纪科技有限公司 A kind of encryption method and system of bytecode
CN111541723A (en) * 2020-07-07 2020-08-14 飞天诚信科技股份有限公司 Method and terminal for processing key data

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4731840A (en) * 1985-05-06 1988-03-15 The United States Of America As Represented By The United States Department Of Energy Method for encryption and transmission of digital keying data
AU2001260970A1 (en) * 2000-01-31 2001-08-07 Vdg Inc. Block encryption method and schemes for data confidentiality and integrity protection

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104966525A (en) * 2015-01-14 2015-10-07 腾讯科技(深圳)有限公司 File encryption method and apparatus, and file decryption method and apparatus
CN110096851A (en) * 2019-05-13 2019-08-06 北京奇艺世纪科技有限公司 A kind of encryption method and system of bytecode
CN111541723A (en) * 2020-07-07 2020-08-14 飞天诚信科技股份有限公司 Method and terminal for processing key data

Also Published As

Publication number Publication date
CN112994875A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN112994875B (en) Encryption method, decryption method, communication method, system and device thereof
CN1993922B (en) Stream cipher combining system and method
US7224795B2 (en) Variable-length key cryptosystem
US8892881B2 (en) Split key secure access system
CN111984978B (en) High-expansibility password encryption storage method
JPH08510365A (en) Method and apparatus for data encryption
JP2012501579A (en) Pre-calculation of message authentication code applied to secure memory
CN113297606A (en) Color quantum image encryption and decryption method based on multiple chaos and DNA operation
JP2004363739A (en) Enciphering device or deciphering device for common key cipher that can detect alteration
CN108259162A (en) A kind of method for storing cipher key
JP2004523183A (en) Method and apparatus for camouflage of data, information and function conversion
FI3844647T3 (en) System and method for providing protected data storage in data memory
CN116070276A (en) Ciphertext duplicate checking and storing method based on homomorphic encryption and Simhash
CN110166458B (en) Three-level key encryption method
Tarigan Use of Electronic Code Book (Ecb) Algorithm in File Security
CN113098675A (en) Binary data encryption system and method based on polynomial complete homomorphism
CN113326518A (en) Data processing method and device
TWI488478B (en) Techniques for performing symmetric cryptography
CN112528309A (en) Data storage encryption and decryption method and device
WO1994021066A1 (en) A method and apparatus for generating a digital message authentication code
CN1607511B (en) Data protection method and system
CN113452508B (en) Data encryption method, device, equipment and computer readable storage medium
CN115766244A (en) Internet of vehicles information encryption method and device, computer equipment and storage medium
JP2004530919A5 (en)
Kumaresan et al. An efficient image block encryption for key generation using non-uniform cellular automata

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