CN116894273B - File encryption method, decryption method, equipment and medium based on exclusive or sum remainder - Google Patents

File encryption method, decryption method, equipment and medium based on exclusive or sum remainder Download PDF

Info

Publication number
CN116894273B
CN116894273B CN202311159556.0A CN202311159556A CN116894273B CN 116894273 B CN116894273 B CN 116894273B CN 202311159556 A CN202311159556 A CN 202311159556A CN 116894273 B CN116894273 B CN 116894273B
Authority
CN
China
Prior art keywords
byte
encrypted
buffer
file
bytes
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
CN202311159556.0A
Other languages
Chinese (zh)
Other versions
CN116894273A (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.)
SICHUAN CONSTRUCTION NETWORK CO Ltd
Original Assignee
SICHUAN CONSTRUCTION NETWORK 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 SICHUAN CONSTRUCTION NETWORK CO Ltd filed Critical SICHUAN CONSTRUCTION NETWORK CO Ltd
Priority to CN202311159556.0A priority Critical patent/CN116894273B/en
Publication of CN116894273A publication Critical patent/CN116894273A/en
Application granted granted Critical
Publication of CN116894273B publication Critical patent/CN116894273B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
    • 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

Abstract

The invention relates to the technical field of file encryption and decryption, and discloses a file encryption method, a file decryption device and a file decryption medium based on exclusive OR and remainder, wherein the file encryption method comprises the following steps: s1, designing a key library by using a random character string; s2, defining a first buffer byte array; s3, reading bytes to be read with the length of M from an original file to be encrypted according to the byte arrangement sequence into the first buffer byte array; s4, taking the remainder obtained by carrying out the residual operation on each byte in the first buffer byte array combined with the current position P of the original encrypted file stream and the maximum value Z of the bytes as an index to find a corresponding key for encryption in the key bank A; then performing exclusive-or operation to obtain an encrypted byte; s5, writing in sequence; s6, judging whether bytes to be read exist or not, if yes, jumping to S3, otherwise, jumping to S7; s7, ending the encryption process. The invention can quickly encrypt and decrypt files with large data quantity.

Description

File encryption method, decryption method, equipment and medium based on exclusive or sum remainder
Technical Field
The invention relates to the technical field of file encryption and decryption, in particular to a file encryption method, a file decryption device and a file medium based on exclusive or and remainder.
Background
In the modern society of the rapid development of information technology, information security plays an important role, and the cryptography is the guarantee and core of information security.
The cipher is used as secret information means, and the cipher coding system has two kinds of block cipher and stream cipher based on different plaintext processing modes, and the block cipher system is one traditional cipher system with great number of block ciphers, including DES variation, IDEA algorithm, SAFER series algorithm, RC series algorithm, etc.
The existing encryption and decryption methods are complex, if the content of the file is relatively large, the file needs more time in the encryption and decryption process, and the efficiency is very low, so that on the premise of ensuring confidentiality, a lightweight encryption and decryption method is needed to be designed to cope with the file with large data volume.
Disclosure of Invention
The invention provides a file encryption method, a file decryption device and a file decryption medium based on exclusive OR and remainder to solve the problems.
The invention is realized by the following technical scheme:
a file encryption method based on exclusive OR and remainder comprises the following steps:
s1, designing a key store A by using a random character string,a is a secret key in a secret key library, and n is the number of the secret keys;
s2, defining a first buffer byte array buffer1, wherein the byte length of the first buffer byte array buffer1 is M, and the byte length of the first buffer byte array buffer1 is determined according to external hardware configuration;
s3, clearing bytes in the first buffer byte array buffer1, reading bytes to be read with the length of M from an original file to be encrypted according to the byte arrangement sequence into the first buffer byte array buffer1, and after the bytes in the original file are read into the first buffer byte array buffer1, enabling the remaining unread bytes to be the bytes to be read;
s4, taking the remainder obtained by carrying out the residual operation on each byte in the first buffer byte array buffer1 combined with the current position P of the original encrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for encryption in the key bank A; then, carrying out exclusive OR operation on each obtained secret key for encryption and the byte corresponding to the byte read into the first buffer byte array buffer1 in sequence to obtain encrypted bytes;
s5, sequentially writing the obtained encrypted bytes from the last bit of the last byte of the original encrypted file stream according to the sequence of the encrypted bytes to form a new original encrypted file stream;
s6, judging whether bytes to be read exist in the original file, if so, jumping to S3, otherwise, jumping to S7;
s7, the new original encrypted file stream is the encrypted file corresponding to the original file, and the encryption process is finished.
As optimization, the specific process of S1 is:
s1.1, defining a character string library by using random character strings;
s1.2, coding the character string library to obtain a key library A.
Preferably, the byte length of the character string library is not less than the byte maximum value Z, and the characters in the character string library comprise one or more of numbers, letters and Chinese characters.
As an optimization, in S1.2, the encoding of the string library may be performed by encrypting the string library by using utf-8 encoding or Unicode encoding.
As optimization, the specific steps of S4 are:
s4.1, acquiring the current position P of the original encrypted file stream;
s4.2, cycling the bytes in the first buffer byte array buffer1, and dividing each byte in the first buffer byte array buffer1 by a byte maximum value Z according to the (P+ byte position index) to obtain the remainder of each byte in the first buffer byte array buffer1, namely:
i is the i-th byte in the first buffer byte array buffer1,representing the remainder corresponding to the ith byte in the first buffer byte array buffer 1;
s4.3, respectively indexing the obtained residues to find corresponding keys for encryption in the key bank AThe numerical value of the remainder is the sequence number of the key;
s4.4, the obtained key for encryptionAnd performing exclusive OR operation on the byte correspondence read from the first buffer byte array buffer1 at this time in sequence to obtain an encrypted byte, namely an ith encrypted byte= (the byte in the ith first buffer byte array buffer 1) ≡j->
The invention also discloses a file decryption method based on the exclusive or and the remainder, which decrypts the encrypted file encrypted by the file encryption method based on the exclusive or and the remainder, and comprises the following steps:
t1, defining a second buffer byte array buffer2, wherein the byte length of the second buffer byte array buffer2 is N, and the byte length of the second buffer byte array buffer2 is determined according to external hardware configuration;
t2, clearing bytes in the second buffer byte array buffer2, reading the encrypted bytes to be read with the length of N from the encrypted file to be decrypted according to the sequence of the encrypted bytes, and changing the remaining unread encrypted bytes into the encrypted bytes to be read after the encrypted bytes in the encrypted file are read into the second buffer byte array buffer 2;
t3, taking the remainder obtained by carrying out the residual operation on each encrypted byte in the second buffer byte array buffer2 combined with the current position K of the original decrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for decryption in a key bank A; then, performing exclusive OR operation on each obtained secret key for decryption and the encrypted byte read into the second buffer byte array buffer2 at this time in sequence to obtain decrypted bytes;
t4, sequentially writing the obtained decryption bytes from the last bit of the last byte of the original decryption file stream according to the order of the decryption bytes to form a new original decryption file stream;
t5, judging whether the encrypted file contains the encrypted bytes to be read, if yes, jumping to T2, otherwise jumping to T6;
and T6, the new original decrypted file stream is the original file, and the decryption process is finished.
As optimization, the specific steps of T3 are:
t3.1, obtaining the current position K of the original decrypted file stream;
t3.2, cycling the encrypted bytes in the two-buffer byte array buffer2, and dividing each encrypted byte in the two-buffer byte array buffer2 by a byte maximum value Z according to (K+ the position index of the encrypted byte), so as to obtain the remainder of each encrypted byte in the two-buffer byte array buffer2, namely:
j is the j-th encrypted byte in the second buffer byte array buffer2,representing the remainder corresponding to the j-th encrypted byte in the second buffer byte array buffer 2;
t3.3, respectively indexing the remainder of the obtained plurality of encrypted bytes to find the corresponding key for decryption in the key bank AThe numerical value of the remainder of the encrypted byte is the sequence number of the key;
t3.4, key for decryption obtainedExclusive or operation is sequentially carried out on the byte correspondence read from the second buffer byte array buffer2 at this time to obtain decrypted bytes, namely, jth decrypted bytes= (encrypted bytes in the jth second buffer byte array buffer 2) ≡>
As an optimization, the key store a used in T3 is the same key store as the key store a designed in the file encryption method based on the exclusive or and the remainder.
The invention also discloses an electronic device, which comprises at least one processor and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above.
The invention also discloses a storage medium storing a computer program which, when executed by a processor, implements the method described above.
Compared with the prior art, the invention has the following advantages and beneficial effects:
the file encryption method, decryption method, equipment and medium based on the exclusive OR and the remainder are simple in implementation method, and can quickly encrypt and decrypt files with large data volume on the premise of ensuring confidentiality.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the drawings that are needed in the examples will be briefly described below, it being understood that the following drawings only illustrate some examples of the present invention and therefore should not be considered as limiting the scope, and that other related drawings may be obtained from these drawings without inventive effort for a person skilled in the art. In the drawings:
FIG. 1 is a flow chart of a file encryption method based on exclusive OR and remainder according to the present invention;
fig. 2 is a flowchart of a file decryption method based on exclusive or and remainder according to the present invention.
Description of the embodiments
For the purpose of making apparent the objects, technical solutions and advantages of the present invention, the present invention will be further described in detail with reference to the following examples and the accompanying drawings, wherein the exemplary embodiments of the present invention and the descriptions thereof are for illustrating the present invention only and are not to be construed as limiting the present invention.
A file encryption method based on exclusive or and remainder according to embodiment 1, as shown in fig. 1, includes:
s1, designing a key store A by using a random character string,a is a secret key in a secret key library, and n is the number of the secret keys;
the specific process is as follows:
s1.1, defining a character string library by using random character strings;
s1.2, encrypting the character string library to obtain a key library A, and encrypting a random character string library in the character string library by adopting the modes of utf-8, unicode and the like to obtain the key library, wherein the function is to convert the character strings in the key library into byte bytes. The byte length of the string library is not less than the byte maximum value Z, e.g., the byte maximum value Z is 255, then the byte length of the string library cannot be less than 255, and the characters in the string library include one or more of numbers, letters, and Chinese characters.
Since some deviation occurs when the byte length is greater than 255, the byte maximum value Z is 255 in this embodiment.
S2, defining a first buffer byte array buffer1, wherein the byte length of the first buffer byte array buffer1 is M, the byte length of the first buffer byte array buffer1 is determined according to external hardware configuration, such as 10k,
byte[] buffer 1= new byte[10*1024]。
s3, clearing bytes in the first buffer byte array buffer1, reading bytes to be read with the length of M from an original file to be encrypted according to the byte arrangement sequence into the first buffer byte array buffer1, and after the bytes in the original file are read into the first buffer byte array buffer1, enabling the remaining unread bytes to be the bytes to be read;
s4, taking the remainder obtained by carrying out the residual operation on each byte in the first buffer byte array buffer1 combined with the current position P of the original encrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for encryption in the key bank A; and then carrying out exclusive OR operation on each obtained secret key for encryption and the byte read into the first buffer byte array buffer1 at the time to obtain encrypted bytes.
The method comprises the following specific steps:
s4.1, acquiring the current position P of the original encrypted file stream, wherein the current position P of the original encrypted file stream can be understood as follows:
if the original file is encrypted, the bytes stored in the first buffer byte array buffer1 are stored from the first character of the original file, then the original encrypted file stream at the moment has no encrypted bytes, the current position P=0, and if a part of characters in front of the original file are encrypted to form the original encrypted file stream, the byte length of the original encrypted file stream is 10 bytes, then the current position P=9 of the original encrypted file stream;
s4.2, cycling the bytes in the first buffer byte array buffer1, and dividing each byte in the first buffer byte array buffer1 by a byte maximum value Z according to (P+the position index of the byte in the first buffer byte array buffer 1) to obtain the remainder of each byte in the first buffer byte array buffer1, namely:
i is the i-th byte in the first buffer byte array buffer1,representing the remainder corresponding to the ith byte in the first buffer byte array buffer 1;
for example, the first byte in the buffered byte array has a position index of 1.
S4.3, respectively indexing the obtained residues to find corresponding keys for encryption in the key bank AThe number value of the remainder is the sequence number of the key,/->
Since the random string is used to distinguish the starting point of a thread, it is possible to produce multiple starting points when similar services are concurrent, and the random string is defined to distinguish different starting points of threads, that is, the thread starting point identifier, so that when searching the corresponding secret key, multiple secret keys can be searched simultaneously.
S4.4, the obtained key for encryptionAnd performing exclusive OR operation on the byte correspondence read from the first buffer byte array buffer1 at this time in sequence to obtain an encrypted byte, namely an ith encrypted byte= (the byte in the ith first buffer byte array buffer 1) ≡j->
S5, sequentially writing the obtained encrypted bytes from the last bit of the last byte of the original encrypted file stream according to the sequence of the encrypted bytes to form a new original encrypted file stream;
s6, judging whether bytes to be read exist in the original file, if so, jumping to S3, otherwise, jumping to S7;
s7, the new original encrypted file stream is the encrypted file corresponding to the original file, and the encryption process is finished.
According to the formula a= (a-b), wherein a-b is the encryption generated in the encryption link, so that the decryption result can be obtained by only finding the corresponding b in the encryption environment and then performing exclusive-or operation. Therefore, as shown in fig. 2, embodiment 2 further discloses a file decryption method based on the xor sum, which decrypts an encrypted file encrypted by a file encryption method based on the xor sum of embodiment 1, including:
t1, defining a second buffer byte array buffer2, wherein the byte length of the second buffer byte array buffer2 is N, and the byte length of the second buffer byte array buffer2 is determined according to external hardware configuration;
t2, clearing bytes in the second buffer byte array buffer2, reading the encrypted bytes to be read with the length of N from the encrypted file to be decrypted according to the sequence of the encrypted bytes, and changing the remaining unread encrypted bytes into the encrypted bytes to be read after the encrypted bytes in the encrypted file are read into the second buffer byte array buffer 2;
t3, taking the remainder obtained by carrying out the residual operation on each encrypted byte in the second buffer byte array buffer2 combined with the current position K of the original decrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for decryption in a key bank A; then, performing exclusive OR operation on each obtained secret key for decryption and the encrypted byte read into the second buffer byte array buffer2 at this time in sequence to obtain decrypted bytes;
t4, sequentially writing the obtained decryption bytes from the last bit of the last byte of the original decryption file stream according to the order of the decryption bytes to form a new original decryption file stream;
t5, judging whether the encrypted file contains the encrypted bytes to be read, if yes, jumping to T2, otherwise jumping to T6;
and T6, the new original decrypted file stream is the original file, and the decryption process is finished.
The specific steps of T3 are as follows:
t3.1, obtaining the current position K of the original decrypted file stream;
if the decryption of the encrypted file is started, the bytes stored in the second buffer byte array buffer2 are stored from the first encrypted byte of the encrypted file, and then the original decrypted file stream has no decrypted bytes, and the current position k=0.
If a part of characters in front of an encrypted file has been decrypted to form an original decrypted file stream having a byte length of 20 bytes, then the current position k=19 of the original encrypted file stream.
T3.2, the encrypted bytes in the two-buffer byte array buffer2 are circulated, and the remainder of each encrypted byte in the two-buffer byte array buffer2 is obtained by dividing each encrypted byte in the two-buffer byte array buffer2 by the maximum value Z of the byte (K+the position index of the encrypted byte in the second buffer byte array buffer 2), namely:
j is the j-th encrypted byte in the second buffer byte array buffer2,representing the remainder corresponding to the j-th encrypted byte in the second buffer byte array buffer 2;
t3.3, respectively indexing the remainder of the obtained plurality of encrypted bytes to find the corresponding key for decryption in the key bank AThe numerical value of the remainder of the encrypted byte is the sequence number of the key; />
T3.4, key for decryption obtainedExclusive or operation is sequentially carried out on the byte correspondence read from the second buffer byte array buffer2 at this time to obtain decrypted bytes, namely, jth decrypted bytes= (encrypted bytes in the jth second buffer byte array buffer 2) ≡>
In this embodiment, the keystore a used in T3 is the same keystore as the keystore a designed in the file encryption method based on the exclusive or and the remainder of embodiment 1.
Embodiment 3 also discloses an electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above.
Embodiment 4 also discloses a storage medium storing a computer program which, when executed by a processor, implements the aforementioned method.
The following are specific codes for implementing the encryption and decryption methods by the c# implementation:
using System.Text;
const string KeyString = "File encryption and decryption method based on exclusive OR operation," +
The method can be used for scenes in any field where encryption and decryption of files are required. "+
"it uses a random string of not less than 255 bytes in length as a key store" +
"can contain arbitrary characters such as numerals, letters, chinese characters, etc." +
And encrypting and decrypting the file by using the exclusive OR operation and the residual operation. ";
var keys = System.Text.Encoding.UTF8.GetBytes(KeyString);
encryption of/file
using (var orgStream=new FileStream ("original encryption File", fileMode OpenOrCreate))
{
using (var encryptStream =new FileStream ("encrypted file", filemode. OpenorCreate))
{
var buffer = new byte[10];
var count = 0;
while ((count = orgStream.Read(buffer, 0, buffer.Length))>0)
{
var p = (int)encryptStream.Position;
for (int i = 0; i<buffer.Length; i++)
{
buffer[i] ^= keys[(p + i) % 255];
}
encryptStream.Write(buffer, 0, count);
}
}
}
Decryption of/file
using (var encryptStream1 =new FileStream ("encrypted file", filemode. OpenorCreate))
{
using (var decryptStream =new FileStream ("decryption file", filemode. OpenorCreate))
{
var buffer1 = new byte[1];
var count1 = 0;
while ((count1 = encryptStream1.Read(buffer1, 0, buffer1.Length))>0)
{
var p = (int)decryptStream.Position;
for (int i = 0; i<buffer1.Length; i++)
{
buffer1[i] ^= keys[(p + i) % 255];
}
decryptStream.Write(buffer1, 0, count1);
}
}
}
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (10)

1. The file encryption method based on exclusive OR and remainder is characterized by comprising the following steps:
s1, designing a key store A by using a random character string,a is a secret key in a secret key library, and n is the number of the secret keys;
s2, defining a first buffer byte array buffer1, wherein the byte length of the first buffer byte array buffer1 is M;
s3, clearing bytes in the first buffer byte array buffer1, reading bytes to be read with the length of M from an original file to be encrypted according to the byte arrangement sequence into the first buffer byte array buffer1, and after the bytes in the original file are read into the first buffer byte array buffer1, enabling the remaining unread bytes to be the bytes to be read;
s4, taking the remainder obtained by carrying out the residual operation on each byte in the first buffer byte array buffer1 combined with the current position P of the original encrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for encryption in the key bank A; then, carrying out exclusive OR operation on each obtained secret key for encryption and the byte corresponding to the byte read into the first buffer byte array buffer1 in sequence to obtain encrypted bytes;
s5, sequentially writing the obtained encrypted bytes from the last bit of the last byte of the original encrypted file stream according to the sequence of the encrypted bytes to form a new original encrypted file stream;
s6, judging whether bytes to be read exist in the original file, if so, jumping to S3, otherwise, jumping to S7;
s7, the new original encrypted file stream is the encrypted file corresponding to the original file, and the encryption process is finished.
2. The file encryption method based on exclusive or and remainder according to claim 1, wherein the specific process of S1 is:
s1.1, defining a character string library by using random character strings;
s1.2, encrypting the character string library to obtain a key library A.
3. The method of claim 2, wherein the byte length of the string library is not less than the byte maximum Z, and the characters in the string library include one or more of numbers, letters, and kanji.
4. The method for encrypting a file based on exclusive or and remainder according to claim 2, wherein in S1.2, said string library is encrypted by means of utf-8 encoding or Unicode encoding.
5. The file encryption method based on exclusive or and remainder according to claim 1, wherein the specific steps of S4 are:
s4.1, acquiring the current position P of the original encrypted file stream;
s4.2, cycling the bytes in the first buffer byte array buffer1, and dividing each byte in the first buffer byte array buffer1 by a byte maximum value Z according to the (P+ byte position index) to obtain the remainder of each byte in the first buffer byte array buffer1, namely:
i is the i-th byte in the first buffer byte array buffer1,representing the remainder corresponding to the ith byte in the first buffer byte array buffer 1;
s4.3, respectively indexing the obtained residues to find corresponding keys for encryption in the key bank AThe numerical value of the remainder is the sequence number of the key;
s4.4, the obtained key for encryptionAnd performing exclusive OR operation on the byte correspondence read from the first buffer byte array buffer1 at this time in sequence to obtain an encrypted byte, namely an ith encrypted byte= (the byte in the ith first buffer byte array buffer 1) ≡j->
6. A file decrypting method based on exclusive or and remainder, for decrypting an encrypted file encrypted by the exclusive or and remainder-based file encrypting method according to any one of claims 1 to 5, comprising:
t1, defining a second buffer byte array buffer2, wherein the byte length of the second buffer byte array buffer2 is N;
t2, clearing bytes in the second buffer byte array buffer2, reading the encrypted bytes to be read with the length of N from the encrypted file to be decrypted according to the sequence of the encrypted bytes, and changing the remaining unread encrypted bytes into the encrypted bytes to be read after the encrypted bytes in the encrypted file are read into the second buffer byte array buffer 2;
t3, taking the remainder obtained by carrying out the residual operation on each encrypted byte in the second buffer byte array buffer2 combined with the current position K of the original decrypted file stream and the maximum value Z of the byte as an index to find a corresponding key for decryption in a key bank A; then, performing exclusive OR operation on each obtained secret key for decryption and the encrypted byte read into the second buffer byte array buffer2 at this time in sequence to obtain decrypted bytes;
t4, sequentially writing the obtained decryption bytes from the last bit of the last byte of the original decryption file stream according to the order of the decryption bytes to form a new original decryption file stream;
t5, judging whether the encrypted file contains the encrypted bytes to be read, if yes, jumping to T2, otherwise jumping to T6;
and T6, the new original decrypted file stream is the original file, and the decryption process is finished.
7. The method for decrypting a file based on exclusive or and remainder according to claim 6, wherein the specific step of T3 is:
t3.1, obtaining the current position K of the original decrypted file stream;
t3.2, cycling the encrypted bytes in the two-buffer byte array buffer2, and dividing each encrypted byte in the two-buffer byte array buffer2 by a byte maximum value Z according to (K+ the position index of the encrypted byte), so as to obtain the remainder of each encrypted byte in the two-buffer byte array buffer2, namely:
j is the j-th encrypted byte in the second buffer byte array buffer2,representing the remainder corresponding to the j-th encrypted byte in the second buffer byte array buffer 2;
t3.3, respectively indexing the remainder of the obtained plurality of encrypted bytes to find the corresponding key for decryption in the key bank AThe numerical value of the remainder of the encrypted byte is the sequence number of the key;
t3.4, key for decryption obtainedExclusive or operation is sequentially carried out on the byte correspondence read from the second buffer byte array buffer2 at this time to obtain decrypted bytes, namely, jth decrypted bytes= (encrypted bytes in the jth second buffer byte array buffer 2) ≡>
8. The method for decrypting a file based on exclusive or and remainder according to claim 6, wherein the keystore a used in T3 is the same keystore as the keystore a designed in the method for encrypting a file based on exclusive or and remainder according to any one of claims 1 to 5.
9. An electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
10. A storage medium storing a computer program, which when executed by a processor implements the method of any one of claims 1 to 8.
CN202311159556.0A 2023-09-11 2023-09-11 File encryption method, decryption method, equipment and medium based on exclusive or sum remainder Active CN116894273B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311159556.0A CN116894273B (en) 2023-09-11 2023-09-11 File encryption method, decryption method, equipment and medium based on exclusive or sum remainder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311159556.0A CN116894273B (en) 2023-09-11 2023-09-11 File encryption method, decryption method, equipment and medium based on exclusive or sum remainder

Publications (2)

Publication Number Publication Date
CN116894273A CN116894273A (en) 2023-10-17
CN116894273B true CN116894273B (en) 2023-11-21

Family

ID=88315231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311159556.0A Active CN116894273B (en) 2023-09-11 2023-09-11 File encryption method, decryption method, equipment and medium based on exclusive or sum remainder

Country Status (1)

Country Link
CN (1) CN116894273B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117725605B (en) * 2024-02-07 2024-04-23 四川建设网有限责任公司 Method and system for remotely and automatically compiling electronic archive file information confidentiality

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000148013A (en) * 1998-11-16 2000-05-26 Fujitsu Ltd Remainder arithmetic unit using defining polynomial in finite field
JP2008256817A (en) * 2007-04-03 2008-10-23 Tsutomu Tatsuzawa Stream encryption method, decryption method, and encryption algorithm and decryption algorithm based on pi-data
CN101471769A (en) * 2007-12-28 2009-07-01 北京大唐高鸿数据网络技术有限公司 Enciphering/deciphering method for VoIP medium transmission
CN101938350A (en) * 2010-07-16 2011-01-05 黑龙江大学 File encryption and decryption method based on combinatorial coding
CN102708534A (en) * 2012-04-12 2012-10-03 江苏技术师范学院 Generating method of variable-parameter multistage chaotic pseudorandom sequence
CN104883257A (en) * 2014-06-12 2015-09-02 梁庆生 Big data encryption method
CN115913571A (en) * 2022-11-16 2023-04-04 湖南快乐阳光互动娱乐传媒有限公司 File encryption and decryption method and device, and digital copyright protection system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4256415B2 (en) * 2006-09-04 2009-04-22 株式会社日立製作所 ENCRYPTION DEVICE, DECRYPTION DEVICE, INFORMATION SYSTEM, ENCRYPTION METHOD, DECRYPTION METHOD, AND PROGRAM
DE102007005636B4 (en) * 2007-02-05 2008-11-13 Infineon Technologies Ag A method for generating a traffic encryption key, method for transmitting data, means for generating a traffic encryption key, data transmission arrangement

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000148013A (en) * 1998-11-16 2000-05-26 Fujitsu Ltd Remainder arithmetic unit using defining polynomial in finite field
JP2008256817A (en) * 2007-04-03 2008-10-23 Tsutomu Tatsuzawa Stream encryption method, decryption method, and encryption algorithm and decryption algorithm based on pi-data
CN101471769A (en) * 2007-12-28 2009-07-01 北京大唐高鸿数据网络技术有限公司 Enciphering/deciphering method for VoIP medium transmission
CN101938350A (en) * 2010-07-16 2011-01-05 黑龙江大学 File encryption and decryption method based on combinatorial coding
CN102708534A (en) * 2012-04-12 2012-10-03 江苏技术师范学院 Generating method of variable-parameter multistage chaotic pseudorandom sequence
CN104883257A (en) * 2014-06-12 2015-09-02 梁庆生 Big data encryption method
CN115913571A (en) * 2022-11-16 2023-04-04 湖南快乐阳光互动娱乐传媒有限公司 File encryption and decryption method and device, and digital copyright protection system

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Description of a New Variable-Length Key, 64-Bit Block Cipher (Blowfish);Bruce Sctmeier;International Workshop on Fast Software Encryption;第191-204页 *
Medical image encryption using high-speed scrambling and pixel adaptive diffusion;Zhongyun Hua 等;Signal Processing 144 (2018);第134-144页 *
基于文本重要内容的鲁棒水印算法;姜传贤;陈孝威;李智;;自动化学报(第09期);第1250-1256页 *
基于随机码数列的文件加密算法的实现;孙玉强;顾玉宛;孙富琴;;微计算机信息(第06期);第70-71+89页 *
等级访问控制下密文数据库密钥管理方案研究;胡前伟 等;计算机科学与探索;第11卷(第6期);第921-931页 *

Also Published As

Publication number Publication date
CN116894273A (en) 2023-10-17

Similar Documents

Publication Publication Date Title
US8284933B2 (en) Encrypting variable-length passwords to yield fixed-length encrypted passwords
CN111310222B (en) File encryption method
KR101324825B1 (en) Message authentication code pre-computation with applications to secure memory
US5008935A (en) Efficient method for encrypting superblocks of data
US8683218B2 (en) System and method for N-dimensional encryption
US10461924B2 (en) Format-preserving cipher
US10009169B2 (en) Format-preserving cipher
CN116894273B (en) File encryption method, decryption method, equipment and medium based on exclusive or sum remainder
KR101989813B1 (en) Generating and verifying the alternative data in a specified format
US9313023B1 (en) Format-preserving cipher
US7599492B1 (en) Fast cryptographic key recovery system and method
CN110543778A (en) linear random encryption and decryption algorithm for character data
CN114417073B (en) Neighbor node query method and device of encryption graph and electronic equipment
CN107315539B (en) Data storage method and data extraction method
CN115641130A (en) Method, device and equipment for generating transaction record ID based on improved snowflake algorithm
CN112235101B (en) Coding method and device based on hybrid coding mechanism, decoding method and device
CN116132977B (en) Mouse safety encryption authentication method
CN104794243A (en) Third-party ciphertext retrieval method based on file name
CN113055155A (en) Data security storage method based on big data platform
Avanzi et al. Qameleon v. 1.0
US9058507B2 (en) Signal processor with an encrypting or decrypting device in a memory system
CN112287374A (en) Excel ciphertext document recovery method, computer equipment and storage medium
CN100359494C (en) Electronic file characters internal code transformation encryption method
CN114254372B (en) Data encryption processing method and system and electronic equipment
CN113468544B (en) Training method and device for application model

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