CN114168976A - Slice file encryption method, slice file decryption method, storage medium and electronic device - Google Patents

Slice file encryption method, slice file decryption method, storage medium and electronic device Download PDF

Info

Publication number
CN114168976A
CN114168976A CN202111297808.7A CN202111297808A CN114168976A CN 114168976 A CN114168976 A CN 114168976A CN 202111297808 A CN202111297808 A CN 202111297808A CN 114168976 A CN114168976 A CN 114168976A
Authority
CN
China
Prior art keywords
data
file
slice
character string
characters
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
CN202111297808.7A
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.)
Guangdong Nenglong Education Co ltd
Original Assignee
Guangdong Nenglong Education 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 Guangdong Nenglong Education Co ltd filed Critical Guangdong Nenglong Education Co ltd
Priority to CN202111297808.7A priority Critical patent/CN114168976A/en
Publication of CN114168976A publication Critical patent/CN114168976A/en
Pending legal-status Critical Current

Links

Images

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/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding

Abstract

The invention discloses a slice file encryption method, a slice file decryption method, a storage medium and electronic equipment, wherein the slice file encryption method comprises the following steps: acquiring password data and file data; carrying out algorithm operation on the password data to generate character string data; and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form encrypted file data. The character string data is generated by performing algorithm operation on the password data, and the file data is divided, sequenced and recombined according to the character string data to form the encrypted file data.

Description

Slice file encryption method, slice file decryption method, storage medium and electronic device
Technical Field
The present invention relates to the field of file encryption, and in particular, to a method for encrypting and decrypting a slice file, a storage medium, and an electronic device.
Background
The traditional file encryption method is more suitable for encryption with less data volume. For files with large data volume, the traditional encryption method has the advantages that the calculation time consumption is long by performing algorithm operation on the whole file data, the encryption performance and efficiency are both satisfactory, and the use requirements cannot be met.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a slice file encryption method which can realize encryption by dividing, sequencing and combining file data and is beneficial to improving the encryption efficiency.
The invention also provides a decryption method which can be used for carrying out segmentation, sequencing and combination on the encrypted file data to realize decryption and is beneficial to improving the decryption efficiency.
The invention also provides a storage medium and an electronic device, which can realize encryption or decryption by dividing and sequencing the file data.
The slice file encryption method according to the embodiment of the first aspect of the invention comprises the following steps: acquiring password data and file data;
carrying out algorithm operation on the password data to generate character string data;
and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form encrypted file data.
The slice file encryption method provided by the embodiment of the invention at least has the following beneficial effects: the character string data is generated by performing algorithm operation on the password data, and the file data is divided, sequenced and recombined according to the character string data to form the encrypted file data.
According to some embodiments of the present invention, the dividing the file data into a plurality of file slice data according to the character string data, and the sorting and combining the plurality of file slice data into the encrypted file data according to the character string data comprises:
dividing the file data into a plurality of file slice data with length values related to the ASCII values of the characters in the character string according to the ASCII values of the characters in the character string data;
the plurality of file slice data are ordered to be combined to form an encrypted file according to ASCII values of characters in the character string data.
According to some embodiments of the invention, the dividing the file data into the plurality of file slice data having length values related to ASCII values of characters in the character string data according to ASCII values of the characters in the character string data comprises:
converting the character string data into a first array, and sequencing the first array to obtain a second array;
adding ASCII values of characters in the character string data to obtain a total value SUM;
dividing the length value FILELENGTH of the file data by the total value SUM to obtain a unit length value BLOCKSIZE;
and dividing the file data into file slice data corresponding to the characters in the second array by taking ASCII of the characters in the second array multiplied by a unit length value BLOCKSIZE as a length value of the file slice data.
According to some embodiments of the invention, the sorting the plurality of file slice data to combine to form the encrypted file according to ASCII values of characters in the character string data comprises:
and sorting the file slice data according to the sequence of the characters in the first array according to the corresponding relation between the characters in the second array and the file slice data and the sorting relation between the second array and the first array so as to combine and form the encrypted file data.
According to some embodiments of the present invention, after the dividing the file data into a plurality of file slice data according to the character string data, further includes: and carrying out fuzzy processing on the file slice data.
According to some embodiments of the present invention, the blurring processing on the file slice data specifically includes: and performing anti-code operation processing on the file slice data.
According to some embodiments of the present invention, the performing an arithmetic operation on the cipher data to generate the string data specifically includes: the MD5 operation is performed on the cipher data to generate a string.
The decryption method according to the embodiment of the second aspect of the present invention comprises the steps of:
acquiring password data and encrypted file data;
carrying out algorithm operation on the password data to generate character string data;
and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form decrypted file data.
The decryption method provided by the embodiment of the invention at least has the following beneficial effects: when in decryption, the obtained password data is consistent with the password data during encryption, the password data generates the same character string data during encryption after algorithm operation, the encrypted file data is divided and sequenced and combined according to the character string data to be restored into decrypted file data, namely original file data, therefore, the decryption operation on the whole encrypted file data is not needed, the decryption can be realized only by dividing, sequencing and combining the encrypted file, and the decryption efficiency is improved.
According to the storage medium of the embodiment of the third aspect of the present invention, program data that operates to be able to execute the above-described slice file encryption method or program data that operates to be able to execute the above-described decryption method is stored.
An electronic device according to a fourth aspect of the present invention includes: a processor and a memory coupled to the processor, the memory storing program data executable by the processor to implement the above-described slice file encryption method or to implement the above-described decryption method.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a block diagram of an encryption flow according to one embodiment of the present invention;
fig. 2 is a block diagram of a decryption process according to one embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, it should be understood that the orientation or positional relationship referred to in the description of the orientation, such as the upper, lower, front, rear, left, right, etc., is based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention.
In the description of the present invention, if there are first and second described only for the purpose of distinguishing technical features, it is not understood that relative importance is indicated or implied or that the number of indicated technical features or the precedence of the indicated technical features is implicitly indicated or implied.
In the description of the present invention, unless otherwise explicitly limited, terms such as arrangement, installation, connection and the like should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
As shown in fig. 1, a method for encrypting a slice file according to an embodiment of the present invention includes the steps of:
s1: acquiring password data and file data;
s2: carrying out algorithm operation on the password data to generate character string data;
s3: and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form encrypted file data.
The character string data is generated by performing algorithm operation on the password data, and the file data is divided, sequenced and recombined according to the character string data to form the encrypted file data.
Referring to fig. 1, in some embodiments of the present invention, step S3 includes the steps of:
s31: dividing the file data into a plurality of file slice data with length values related to the ASCII values of the characters in the character string according to the ASCII values of the characters in the character string data;
s32: the plurality of file slice data are ordered to be combined to form an encrypted file according to ASCII values of characters in the character string data.
And dividing the file data according to the size of the ASCII value corresponding to each character in the character string data to form file slice data, wherein the length of the file slice data is related to the ASCII value of the character. And performing sequencing combination on the file slice data according to the ASCII values of the characters in the character string data, namely the arrangement sequence of the file slice data is related to the ASCII values of the characters. Therefore, the file slice data and the characters in the character string data are associated, and the effect of encrypted segmentation is achieved.
Referring to fig. 1, in some embodiments of the present invention, step S31 includes the steps of:
s311: converting the character string data into a first array, and sequencing the first array to obtain a second array;
s312: adding ASCII values of characters in the character string data to obtain a total value SUM;
s313: dividing the length value FILELENGTH of the file data by the total value SUM to obtain a unit length value BLOCKSIZE;
s314: and dividing the file data into file slice data corresponding to the characters in the second array by taking ASCII of the characters in the second array multiplied by a unit length value BLOCKSIZE as a length value of the file slice data.
Adding the ASCII value of each character in the character string data to obtain a total value SUM, dividing the length value FILELENGTH of the file data by the SUM to obtain a unit length value BLOCKSIZE, so that the same character string can adapt to different file data, and then dividing the file data into file slice data corresponding to the characters according to the sequence of the characters in the second array and the ASCII values of the characters, wherein the length value of the file slice data is equal to the ASCII value of the corresponding character multiplied by the unit length value BLOCKSIZE, so that the division of the file is realized.
Referring to fig. 1, in some embodiments of the present invention, step S32 specifically includes: and sorting the file slice data according to the sequence of the characters in the first array according to the corresponding relation between the characters in the second array and the file slice data and the sorting relation between the second array and the first array so as to combine and form the encrypted file data.
And the second array is generated by sequencing the first array, the file data is divided according to the sequence of the characters in the second array during cutting, the characters have corresponding relations with the file slice data generated by division, the file slice data is sequenced according to the sequence of the characters in the first array and the corresponding relations of the characters and the file slice data, and then the plurality of file slice arrays are combined to form the encrypted file data. In this way, ordered combination of files is achieved.
The first array may be sorted from small to large or from large to small by the size of the ASCII value of the character to generate the second array. The first array may also be operated according to other stable sorting algorithms to generate the second array.
It should be noted that, after the division of the length value FILELENGTH of the file data by the total value SUM may have a remainder BLK, that is, the file data is divided into file slice data corresponding to the characters in the second array, and the remaining file data having a length value equal to the remainder BLK is also included, and the remaining file data is used as the last file slice data and is combined at the end of the sorting process to form the encrypted file data.
Referring to fig. 1, in some embodiments of the present invention, after step S314, step S315 is further included: and carrying out fuzzy processing on the file slice data.
The fuzzy processing is carried out on the file slice data, so that the encryption safety level is further improved.
Referring to fig. 1, in some embodiments of the invention, in step S315: and performing anti-code operation processing on the file slice data.
By performing the inverse code operation on the file slice data, the fuzzy processing is realized, and the operation is simple and efficient.
Referring to fig. 1, in some embodiments of the invention, in step S2: the MD5 operation is performed on the cipher data to generate a string.
The MD5 operation has the advantages of a fixed length of flexibly generating string data, a fixed length of generated string, generally 32 bytes, and an MD5 operation is unrecoverable, i.e., the original cipher data cannot be known from the generated string, and the security level is high.
The cryptographic data may also be an embodiment in which the string is generated by a digest algorithm or an encryption algorithm other than the MD5 algorithm.
Referring to fig. 2, a decryption method according to an embodiment of the second aspect of the present invention includes the steps of:
s1: acquiring password data and encrypted file data;
s2: carrying out algorithm operation on the password data to generate character string data;
s3: and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form decrypted file data.
When in decryption, the obtained password data is consistent with the password data during encryption, the password data generates the same character string data during encryption after algorithm operation, the encrypted file data is divided and sequenced and combined according to the character string data to be restored into decrypted file data, namely original file data, therefore, the decryption operation on the whole encrypted file data is not needed, the decryption can be realized only by dividing, sequencing and combining the encrypted file, and the decryption efficiency is improved.
Referring to fig. 2, the specific decryption includes the following steps:
s1, acquiring password data and encrypted file data;
s2: carrying out algorithm operation on the password data to generate character string data;
s311: converting the character string data into a first array, and sequencing the first array to obtain a second array;
s312: adding ASCII values of characters in the character string data to obtain a total value SUM;
s313: dividing the length value FILELENGTH of the encrypted file data by the total value SUM to obtain a unit length value BLOCKSIZE;
s314: dividing the file data into file slice data corresponding to the characters in the first array by taking ASCII of the characters in the first array multiplied by a unit length value BLOCKSIZE as a length value of the file slice data;
s315: performing anti-code operation processing on the file slice data;
s32: and sorting the file slice data according to the character sequence in the second array according to the corresponding relation between the characters in the first array and the file slice data and the sorting relation between the first array and the second array so as to combine and form the decrypted file data.
The above decryption step is similar to the encryption step, but different from the encryption step: during encryption, the data are divided according to the second array and sorted according to the first array; and during decryption, the data is divided according to the first array, and sorted according to the second array.
In some embodiments of the invention, it may be: during encryption, the data are divided according to the first data and sorted according to the second array; and during decryption, the data is divided according to the second array, and sorted according to the first array.
A storage medium according to an embodiment of the third aspect of the present invention stores program data that runs the above-described slice file encryption method or that runs the above-described decryption method.
The storage medium can be used for reading the stored program data by different devices, and is convenient to use. The program data operation can slice and sort the file data to realize the encryption effect, the encryption algorithm operation on the whole file data is not needed, and the encryption efficiency is improved.
The storage medium may be a hard disk, a U disk, an optical disk, or the like.
An electronic device according to a fourth aspect of the embodiment of the present invention includes: the slice file encryption device comprises a processor and a memory connected with the processor, wherein the memory stores program data, and the program data can be executed by the processor to realize the slice file encryption method or the decryption method.
The processor reads the program data in the memory and the file data to be encrypted, and executes the program data to divide, sort and combine the file data to realize encryption; or the processor reads the program data in the memory and the encrypted file data to be decrypted, and the processor executes the program data to divide and sequence the encrypted file data to realize decryption. Therefore, algorithm operation does not need to be carried out on the whole file data or the encrypted file data, and the encryption and decryption efficiency is improved.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The invention is not limited to the above embodiments, and those skilled in the art can make equivalent modifications or substitutions without departing from the spirit of the invention, and such equivalent modifications or substitutions are included in the scope defined by the claims of the present application.

Claims (10)

1. A method for encrypting a slice file, comprising:
acquiring password data and file data;
carrying out algorithm operation on the password data to generate character string data;
and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form encrypted file data.
2. The method for encrypting the file slice according to claim 1, wherein the dividing of the file data into the plurality of file slice data according to the character string data, and the sorting and combining of the plurality of file slice data according to the character string data into the encrypted file data comprises:
dividing the file data into a plurality of file slice data with length values related to the ASCII values of the characters in the character string according to the ASCII values of the characters in the character string data;
the plurality of file slice data are ordered to be combined to form an encrypted file according to ASCII values of characters in the character string data.
3. The method for encrypting a slice file according to claim 2, wherein the dividing of the file data into the file slice data having a plurality of length values associated with ASCII values of characters in the character string data according to ASCII values of the characters in the character string data comprises:
converting the character string data into a first array, and sequencing the first array to obtain a second array;
adding ASCII values of characters in the character string data to obtain a total value SUM;
dividing the length value FILELENGTH of the file data by the total value SUM to obtain a unit length value BLOCKSIZE;
and dividing the file data into file slice data corresponding to the characters in the second array by taking ASCII of the characters in the second array multiplied by a unit length value BLOCKSIZE as a length value of the file slice data.
4. The method for encrypting the slice file according to claim 3, wherein said sorting the plurality of file slice data according to ASCII values of characters in the character string data to combine to form the encrypted file comprises:
and sorting the file slice data according to the sequence of the characters in the first array according to the corresponding relation between the characters in the second array and the file slice data and the sorting relation between the second array and the first array so as to combine and form the encrypted file data.
5. The method for encrypting a slice file according to claim 1, further comprising, after dividing the file data into a plurality of file slice data based on the character string data: and carrying out fuzzy processing on the file slice data.
6. The method for encrypting the slice file according to claim 5, wherein the blurring the file slice data specifically comprises: and performing anti-code operation processing on the file slice data.
7. The method for encrypting the slice file according to claim 1, wherein the performing an arithmetic operation on the cryptographic data to generate the string data specifically comprises: the MD5 operation is performed on the cipher data to generate a string.
8. A decryption method, characterized by comprising the steps of:
acquiring password data and encrypted file data;
carrying out algorithm operation on the password data to generate character string data;
and dividing the file data according to the character string data to form a plurality of file slice data, and sequencing and combining the plurality of file slice data according to the character string data to form decrypted file data.
9. A storage medium storing program data, characterized in that: the program data run may be capable of performing the slice file encryption method of any one of claims 1 to 7, or the program data run may be capable of performing the decryption method of claim 8.
10. An electronic device, comprising: a processor and a memory coupled to the processor, the memory storing program data executable by the processor to implement the slice file encryption method of any one of claims 1 to 7 or to implement the decryption method of claim 8.
CN202111297808.7A 2021-11-04 2021-11-04 Slice file encryption method, slice file decryption method, storage medium and electronic device Pending CN114168976A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111297808.7A CN114168976A (en) 2021-11-04 2021-11-04 Slice file encryption method, slice file decryption method, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111297808.7A CN114168976A (en) 2021-11-04 2021-11-04 Slice file encryption method, slice file decryption method, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN114168976A true CN114168976A (en) 2022-03-11

Family

ID=80478004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111297808.7A Pending CN114168976A (en) 2021-11-04 2021-11-04 Slice file encryption method, slice file decryption method, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114168976A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827226A (en) * 2022-06-30 2022-07-29 深圳市智联物联科技有限公司 Remote management method for industrial control equipment
CN115438365A (en) * 2022-11-08 2022-12-06 山东捷瑞数字科技股份有限公司 File rapid encryption system and method based on digital twin

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827226A (en) * 2022-06-30 2022-07-29 深圳市智联物联科技有限公司 Remote management method for industrial control equipment
CN114827226B (en) * 2022-06-30 2022-09-09 深圳市智联物联科技有限公司 Remote management method for industrial control equipment
CN115438365A (en) * 2022-11-08 2022-12-06 山东捷瑞数字科技股份有限公司 File rapid encryption system and method based on digital twin

Similar Documents

Publication Publication Date Title
US10778408B1 (en) Systems, devices, and processing for homomorphic encryption
US11709948B1 (en) Systems and methods for generation of secure indexes for cryptographically-secure queries
US5963646A (en) Secure deterministic encryption key generator system and method
CN114168976A (en) Slice file encryption method, slice file decryption method, storage medium and electronic device
US20080240443A1 (en) Method and apparatus for securely processing secret data
JP2007299088A (en) Data protection system, method and program
Li et al. Information leakage in encrypted deduplication via frequency analysis
JP2004523183A (en) Method and apparatus for camouflage of data, information and function conversion
Li et al. Information leakage in encrypted deduplication via frequency analysis: Attacks and defenses
CN108197439A (en) A kind of file encrypting method, device and server
JP3794457B2 (en) Data encryption / decryption method
EP2873187A1 (en) Method of encrypting data
KR20140011534A (en) Generating and verifying the alternative data in a specified format
CN115065555B (en) Information security processing method and system
De Micheli et al. Recovering cryptographic keys from partial information, by example
CN108540486A (en) The generation of cloud key and application method
Tarigan Use of Electronic Code Book (Ecb) Algorithm in File Security
Paterson et al. Cold boot attacks on NTRU
KR101553986B1 (en) System and method of distrubuted data storage, restoration
CN114095214A (en) Encryption and decryption method, device, equipment and medium based on block chain NFT technology
CN111967032B (en) File encryption method and decryption method based on confusion processing
Kirubakaran et al. A cloud based model for deduplication of large data
Kim et al. Analysis of the perfect table fuzzy rainbow tradeoff
Hanling et al. Poster: Proofs of retrievability with low server storage
Shen et al. On post-generation data operations in secure distributed storage systems with internal padding

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