CN113382004A - File encryption method - Google Patents

File encryption method Download PDF

Info

Publication number
CN113382004A
CN113382004A CN202110649055.5A CN202110649055A CN113382004A CN 113382004 A CN113382004 A CN 113382004A CN 202110649055 A CN202110649055 A CN 202110649055A CN 113382004 A CN113382004 A CN 113382004A
Authority
CN
China
Prior art keywords
file
array
logistic
xor
byte
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.)
Pending
Application number
CN202110649055.5A
Other languages
Chinese (zh)
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.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development 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 Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202110649055.5A priority Critical patent/CN113382004A/en
Publication of CN113382004A publication Critical patent/CN113382004A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The invention discloses a file encryption method, which belongs to the technical field of network security and data privacy, and is characterized in that a file is read according to bytes, and file data is processed by using a logistic sequence exclusive OR mode: the logical sequence replaces the position of the file data in the file and carries out exclusive or processing; the obtained file data is subjected to BASE64 byte encoding to obtain a character string to be transmitted. The invention can resist statistical attack and plaintext attack and provides guarantee for file storage and transmission safety.

Description

File encryption method
Technical Field
The invention relates to the technical field of network security and data privacy, in particular to a file encryption method.
Background
With the continuous expansion of the network ecological environment, the network transmission loophole is also utilized by people, and the event that important information is leaked due to network monitoring and serious loss is caused to individuals and enterprises frequently occurs. Therefore, network transmission security is more and more emphasized, and network file transmission security issues are more and more concerned.
Disclosure of Invention
The technical task of the invention is to provide a file encryption method aiming at the defects, which can resist statistical attack and plaintext attack and provide guarantee for file storage and transmission safety.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a file encryption method reads a document according to bytes, processes file data in a logic sequence exclusive OR mode: the logical sequence replaces the position of the file data in the file and carries out exclusive or processing; the obtained file data is subjected to BASE64 byte encoding to obtain a character string to be transmitted.
Aiming at the problem of file storage and transmission safety, the method encodes and encrypts data of the file from the level of byte stream, so that the converted new encoding byte has higher information entropy and lower byte association degree, is used for resisting statistical attack and plaintext attack, and provides guarantee for file storage and transmission safety.
Preferably, the logistic sequence replacement is a full-file replacement;
the XOR rule is: the current bit is XOR-ed with the last two bits simultaneously, the last bit is XOR-ed with the first two bits, and the second last bit is XOR-ed with the adjacent two bits.
Specifically, the iteration number of the initial value of the logistic map is given by the user.
Preferably, the original byte stream array is XOR-ed with the logistic sequence by parity: performing logistic sequence replacement on the newly obtained array, and performing exclusive or processing on the newly obtained array according to the last two digits; then carrying out global replacement on the array; and the circular encryption is performed in the same manner, which is determined by the file size.
Specifically, the method is realized by the following steps:
reading a file to be encrypted in a file stream mode to obtain a file stream byte array a of the file, and carrying out a new round of XOR processing on the array a and a logistic mapping iteration value to obtain a new file stream byte array b;
scrambling the array b to obtain a new byte array c;
carrying out n rounds of XOR processing on the array c;
the BASE64 encoding of the resulting byte array results in the string to be transmitted.
Further, the processing mode of scrambling the array b is as follows: and sequencing the sequences by using a logistic iteration sequence, and replacing the log array b according to the logistic sequence to obtain a new byte array c.
Further, the processing mode of performing n rounds of xor processing on the array c is as follows: the current bit and the last two bits are subjected to exclusive-or operation simultaneously.
The invention also claims a file encryption system, which comprises a logical mapping module, an XOR processing module and a BASE64 encoding module, and the system encodes and encrypts data from the byte stream level for a file, thereby realizing the file encryption method.
The invention also claims a file encryption device, comprising: at least one memory and at least one processor;
the at least one memory to store a machine readable program;
the at least one processor is used for calling the machine readable program and executing the method.
The invention also claims a computer readable medium having stored thereon computer instructions which, when executed by a processor, cause the processor to perform the above-described method.
Compared with the prior art, the file encryption method has the following beneficial effects:
compared with a price asking encryption method of a double-logistic chaotic sequence, the method has higher processing speed and is more advantageous to the transmission of large files by adopting single logistic;
compared with the traditional document transmission mode from the encryption of an initiating terminal to the decryption of a terminal device, the method breaks the limitation of a client server terminal, and is suitable for various fields of network transmission.
By combining the logistic mapping and the XOR processing, the problem of processing time only using the XOR can be solved, and meanwhile, the processing effect of the XOR can be enhanced by the pseudo random number generated by the logistic, so that the information entropy of the file data is rapidly improved, and the coding and encryption effect is greatly improved.
Drawings
FIG. 1 is a flowchart of a file encryption method provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating statistics of unprocessed resulting transmitted string characters according to an embodiment of the present invention;
FIG. 3 is a statistical view of transmission string characters obtained after processing according to the present embodiment of the invention;
FIG. 4 is a schematic illustration of raw source file bytecode statistics provided by an embodiment of the invention;
fig. 5 is a schematic diagram of the statistics of the bytecode processed by the scheme according to the embodiment of the invention.
Detailed Description
The present invention will be further described with reference to the following specific examples.
The embodiment of the invention provides a file encryption method, which reads a file according to bytes and processes file data in a logistic sequence exclusive OR mode: the logical sequence replaces the position of the file data in the file, and two bits of the adjacent file data are subjected to XOR processing; the obtained file data is subjected to BASE64 byte encoding to obtain a character string to be transmitted.
The iteration number of the initial value of the logistic mapping is given by a user, and the logistic sequence is replaced by a full file;
the XOR rule is: the current bit is XOR-ed with the last two bits simultaneously, the last bit is XOR-ed with the first two bits, and the second last bit is XOR-ed with the adjacent two bits.
Firstly, the original byte stream array and the logic sequence are XOR-ed according to parity: performing logistic sequence replacement on the newly obtained array, and performing exclusive or processing on the newly obtained array according to the last two digits; then carrying out global replacement on the array; and the circular encryption is performed in the same manner, which is determined by the file size.
The method comprises the following concrete implementation processes:
reading a file to be encrypted in a file stream mode to obtain a file stream byte array a of the file, and carrying out a new round of XOR processing on the array a and a logistic mapping iteration value to obtain a new file stream byte array b;
scrambling the array b, wherein the processing mode is as follows: sequencing the sequence by using a logistic iteration sequence, and replacing the logarithm array b according to the logistic sequence to obtain a new byte array c;
and carrying out n rounds of XOR processing on the array c, wherein the processing mode is as follows: carrying out exclusive or operation on the current bit and the last two bits simultaneously;
the BASE64 encoding of the resulting byte array results in the string to be transmitted.
The implementation process is shown in fig. 1.
In this embodiment, a pdf document is encoded by using BASE64 encoding directly and conventionally, and then all characters are counted to obtain a figure1, as shown in fig. 2; meanwhile, the same pdf document is processed by the scheme and then is encoded by BASE64, and all the encoded characters are counted to obtain a figure2, as shown in fig. 3. Statistics of the frequency of the encrypted characters of the original document and the scheme result in fig. figure3 and figure4, respectively, as shown in fig. 4 and 5.
In addition, by using the method, three different files are encrypted to obtain information entropy statistical results of the files in different states, as shown in the following table:
table 1 comparison table of encryption information entropy of different files
Figure BDA0003110383550000041
It can be seen from fig. figure1, fig. figure2 and table 1 that the number of times of occurrence of characters in character strings processed by the method is substantially the same, so that statistical attacks and plaintext attacks can be effectively resisted, and the information entropy of files encrypted and encoded by the method is greatly improved compared with that of original files and basic BASE64 encoding.
Aiming at the problem of file storage and transmission safety, the method encodes and encrypts data of the file from the level of byte stream, so that the converted new encoding byte has higher information entropy and lower byte association degree, is used for resisting statistical attack and plaintext attack, and provides guarantee for file storage and transmission safety.
The embodiment of the invention also provides a file encryption system, which comprises a logistic mapping module, an XOR processing module and a BASE64 encoding module, wherein the system encodes and encrypts data from the byte stream level of a file, and processes the file data in a logistic sequence exclusive OR mode: the logical sequence replaces the position of the file data in the file, and two bits of the adjacent file data are subjected to XOR processing; the obtained file data is subjected to BASE64 byte encoding to obtain a character string to be transmitted.
The method implements the file encryption method described in the above embodiments.
An embodiment of the present invention further provides a file encryption apparatus, including: at least one memory and at least one processor;
the at least one memory to store a machine readable program;
the at least one processor is configured to invoke the machine-readable program to execute the file encryption method described in the foregoing embodiment.
An embodiment of the present invention further provides a computer-readable medium, where a computer instruction is stored on the computer-readable medium, and when the computer instruction is executed by a processor, the processor is caused to execute the file encryption method described in the above embodiment of the present invention. Specifically, a system or an apparatus equipped with a storage medium on which software program codes that realize the functions of any of the above-described embodiments are stored may be provided, and a computer (or a CPU or MPU) of the system or the apparatus is caused to read out and execute the program codes stored in the storage medium.
In this case, the program code itself read from the storage medium can realize the functions of any of the above-described embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
Examples of the storage medium for supplying the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (e.g., CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD + RW), a magnetic tape, a nonvolatile memory card, and a ROM. Alternatively, the program code may be downloaded from a server computer via a communications network.
Further, it should be clear that the functions of any one of the above-described embodiments may be implemented not only by executing the program code read out by the computer, but also by causing an operating system or the like operating on the computer to perform a part or all of the actual operations based on instructions of the program code.
Further, it is to be understood that the program code read out from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion unit connected to the computer, and then causes a CPU or the like mounted on the expansion board or the expansion unit to perform part or all of the actual operations based on instructions of the program code, thereby realizing the functions of any of the above-described embodiments.
While the invention has been shown and described in detail in the drawings and in the preferred embodiments, it is not intended to limit the invention to the embodiments disclosed, and it will be apparent to those skilled in the art that various combinations of the code auditing means in the various embodiments described above may be used to obtain further embodiments of the invention, which are also within the scope of the invention.

Claims (10)

1. A file encryption method is characterized in that a file is read according to bytes, and file data is processed by using a logistic sequence exclusive OR mode: the logical sequence replaces the position of the file data in the file and carries out exclusive or processing; the obtained file data is subjected to BASE64 byte encoding to obtain a character string to be transmitted.
2. A method for encrypting a file according to claim 1, wherein said logistic sequence substitution is a full file substitution;
the XOR rule is: the current bit is XOR-ed with the last two bits simultaneously, the last bit is XOR-ed with the first two bits, and the second last bit is XOR-ed with the adjacent two bits.
3. A method for encrypting a document according to claim 2, wherein the initial value of the logistic map is iterated a number of times given by the user.
4. A method for encrypting a file according to claim 1, wherein the file is encrypted by xoring the original byte stream array with the logical sequence according to parity: performing logistic sequence replacement on the newly obtained array, and performing exclusive or processing on the newly obtained array according to the last two digits; then carrying out global replacement on the array; and performs round robin encryption in the same manner.
5. A method for encrypting a file according to claim 1, 2 or 4, characterized in that the method is implemented as follows:
reading a file to be encrypted in a file stream mode to obtain a file stream byte array a of the file, and carrying out a new round of XOR processing on the array a and a logistic mapping iteration value to obtain a new file stream byte array b;
scrambling the array b to obtain a new byte array c;
carrying out n rounds of XOR processing on the array c;
the BASE64 encoding of the resulting byte array results in the string to be transmitted.
6. The file encryption method according to claim 5, wherein the scrambling processing on the array b is performed by: and sequencing the sequences by using a logistic iteration sequence, and replacing the log array b according to the logistic sequence to obtain a new byte array c.
7. The file encryption method according to claim 5, wherein the n-round xor processing on the array c is performed by: the current bit and the last two bits are subjected to exclusive-or operation simultaneously.
8. A file encryption system, characterized by comprising a logistic mapping module, an XOR processing module and a BASE64 encoding module, and the system encodes and encrypts data from the byte stream level for a file, and implements the file encryption method according to any one of claims 1 to 7.
9. A file encryption apparatus, comprising: at least one memory and at least one processor;
the at least one memory to store a machine readable program;
the at least one processor, configured to invoke the machine readable program to perform the method of any of claims 1 to 7.
10. A computer readable medium having stored thereon computer instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1 to 7.
CN202110649055.5A 2021-06-10 2021-06-10 File encryption method Pending CN113382004A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110649055.5A CN113382004A (en) 2021-06-10 2021-06-10 File encryption method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110649055.5A CN113382004A (en) 2021-06-10 2021-06-10 File encryption method

Publications (1)

Publication Number Publication Date
CN113382004A true CN113382004A (en) 2021-09-10

Family

ID=77573710

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110649055.5A Pending CN113382004A (en) 2021-06-10 2021-06-10 File encryption method

Country Status (1)

Country Link
CN (1) CN113382004A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997012459A1 (en) * 1995-09-26 1997-04-03 Xian Kan Lin A method for encryption of file
CN111371751A (en) * 2020-02-24 2020-07-03 山东爱城市网信息技术有限公司 File stream byte group data encryption and network transmission method
CN111368345A (en) * 2020-03-09 2020-07-03 浙江众邦机电科技有限公司 Method, device, equipment and computer readable storage medium for decrypting encrypted program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997012459A1 (en) * 1995-09-26 1997-04-03 Xian Kan Lin A method for encryption of file
CN111371751A (en) * 2020-02-24 2020-07-03 山东爱城市网信息技术有限公司 File stream byte group data encryption and network transmission method
CN111368345A (en) * 2020-03-09 2020-07-03 浙江众邦机电科技有限公司 Method, device, equipment and computer readable storage medium for decrypting encrypted program

Similar Documents

Publication Publication Date Title
US9736142B2 (en) Tokenization using multiple reversible transformations
US7769165B2 (en) Semi-public white-box cipher
JP2004534333A (en) Integrated protection method and system for distributed data processing in computer networks
Wong et al. Embedding compression in chaos-based cryptography
JP6346942B2 (en) Blocking password attacks
CN105282090B (en) A kind of open URL scrambled method of anti-unauthorized access on internet
JP4025283B2 (en) Code embedding method, identification information restoring method and apparatus
CN116488814A (en) FPGA-based data encryption secure computing method
KR101852526B1 (en) Method for managing encrypted file in mobile device and encrypted file management system having the same
JPWO2015166701A1 (en) ENCRYPTION METHOD, PROGRAM, AND SYSTEM
CN113382004A (en) File encryption method
CN110943837B (en) User password encryption method based on improved MD5 encryption algorithm
CN114710264A (en) Physical layer encryption and decryption method and system based on Spinal code
JP6273224B2 (en) ENCRYPTION SYSTEM, ENCRYPTION DEVICE, DECRYPTION DEVICE, ENCRYPTION METHOD
Brindhashree et al. Data security based on cryptography steganography combined with OTP algorithm and Huffman coding in the cloud environment
CN107896143B (en) Joint coding method based on high-dimensional chaotic system and arithmetic coding
JP4914329B2 (en) Message authenticator generation device, message authenticator verification device, message authenticator generation method, message authenticator verification method, program, and recording medium
CN116484407B (en) Data security protection method and device, electronic equipment and storage medium
CN117640256B (en) Data encryption method, recommendation device and storage medium of wireless network card
Walidaniy et al. Improvement of PSNR by Using Shannon-Fano Compression Technique in AES-LSB StegoCrypto
CN116894273B (en) File encryption method, decryption method, equipment and medium based on exclusive or sum remainder
CN116880778B (en) User privacy protection method based on regenerative coding and distributed storage
CN111325545B (en) Key management method, device and equipment based on blockchain
CN115801355A (en) Data encryption method, device, equipment and storage medium based on random number
CN114189860A (en) Fixed format data encryption and decryption method and verification method for satellite network equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210910