CN105893857A - File encryption method, device and equipment - Google Patents
File encryption method, device and equipment Download PDFInfo
- Publication number
- CN105893857A CN105893857A CN201610201683.6A CN201610201683A CN105893857A CN 105893857 A CN105893857 A CN 105893857A CN 201610201683 A CN201610201683 A CN 201610201683A CN 105893857 A CN105893857 A CN 105893857A
- Authority
- CN
- China
- Prior art keywords
- fritter
- encrypted
- file
- memory size
- divided
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2107—File encryption
Abstract
The embodiment of the invention provides a file encryption method, a device and equipment, wherein the method comprises the following steps: acquiring the size of a memory of a file to be encrypted; when the size of the memory is larger than a first preset threshold value, dividing the file to be encrypted into N small blocks, wherein N is an integer larger than 1; and encrypting M small blocks in the N small blocks according to a first encryption mode, and encrypting other small blocks except the M small blocks in the N small blocks according to a second encryption mode, wherein M is a positive integer smaller than N. According to the embodiment of the invention, one part of the file to be encrypted is encrypted by adopting the first encryption mode, and the other part of the file to be encrypted is encrypted by adopting the second encryption mode, so that the file to be encrypted is encrypted by adopting two encryption modes, the difficulty of cracking the file to be encrypted is increased, and the safety is improved.
Description
Technical field
The present invention relates to technical field of data security, be specifically related to a kind of file encrypting method, device and equipment.
Background technology
Along with the fast development of information technology, terminal (such as mobile phone, panel computer etc.) uses increasingly frequency
Numerous.In this day and age, the information of Computer Storage gets more and more, and the safety of data is more and more important.
Thus, when when storage to various equipment and using in service, data have to appropriately be encrypted, such as, by number
During according to storage to high in the clouds, with greater need for so encryption, because the data being stored in high in the clouds can be deposited the most from time to time
By the possibility of malicious attack.
Generally to data encryption, conventional encryption algorithm, such as advanced encryption algorithm (Advanced can be used
Encryption Standard, AES) or data encryption standards (Data Encryption Standard, DES)
Etc., but, this cipher mode is easier to be cracked, thus, reduce the safety of file.
Summary of the invention
Embodiments provide a kind of file encrypting method, device and equipment, the peace of file can be improved
Quan Xing.
Embodiment of the present invention first aspect provides a kind of file encrypting method, including:
Obtain the memory size of file to be encrypted;
When described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of fritter,
Wherein, described N is the integer more than 1;
M fritter in described N number of fritter is encrypted according to the first cipher mode, and to described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, and described M is
Positive integer less than described N.
In conjunction with the embodiment of the first aspect of the embodiment of the present invention, in the first possible reality of first aspect
Execute in mode, described described file to be encrypted is divided into N number of fritter, including:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal;
Or,
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
In conjunction with the embodiment of the first aspect of the embodiment of the present invention, the reality that the second in first aspect is possible
Execute in mode, described described file to be encrypted is divided into N number of fritter, including:
When described memory size is even number, described file to be encrypted is divided into that memory size is equal first
Divide and Part II;
Described Part I is divided into P the fritter that memory size is equal, and described Part II is divided into interior
Depositing the most unequal N-P the fritter of size, wherein, described P is the positive integer less than described N.
In conjunction with the embodiment that the second of the first aspect of the embodiment of the present invention is possible, in the of first aspect
In three kinds of possible embodiments, described P is that described Part I is preset size according to first and is averaged
The fritter number obtained after piecemeal, or, described P is the numerical value that user specifies.
In conjunction with the first aspect of the embodiment of the present invention, first aspect the first may to any one in the third
Embodiment, in the 4th kind of possible embodiment of first aspect, described in described N number of fritter
M fritter be encrypted according to the first cipher mode, including:
Each fritter in M fritter in described N number of fritter is respectively divided into K fritter, obtains
M*K fritter, wherein, described K is the integer more than 1, and wherein, described K is the number specified by user
Value, or, described K is described each fritter to be preset size according to second and is averaged after piecemeal and obtains
Fritter number;
Part fritter in described M*K fritter is encrypted according to the first AES, and by described
In M*K fritter, other fritters in addition to described part fritter are encrypted according to the second AES.
In conjunction with the first aspect of the embodiment of the present invention, first aspect the first may to any one in the third
Embodiment, in the 5th kind of possible embodiment of first aspect, described by described N number of fritter
Other fritters in addition to described M fritter are encrypted according to the second cipher mode, including:
Other fritters in addition to described M fritter in described N number of fritter are carried out according to XOR AES
Encryption.
In conjunction with the first aspect of the embodiment of the present invention, first aspect the first may to any one in the third
Embodiment, in the 6th kind of possible embodiment of first aspect, described N is described ciphertext to be added
Part is preset, according to the 3rd, the fritter number obtained after size carries out piecemeal, or, described N is that user specifies
Numerical value;
Described M is the numerical value that user specifies, and described M fritter is random described in described N number of fritter
M, or, described M fritter is M the fritter selected according to the order pre-set.
Embodiment of the present invention second aspect provides a kind of document encrypting apparatus, including:
Acquiring unit, for obtaining the memory size of file to be encrypted;
Blocking unit, for when described memory size is more than the first predetermined threshold value, by described file to be encrypted
Being divided into N number of fritter, wherein, described N is the integer more than 1;
First ciphering unit, for pressing M fritter in described N number of fritter of described blocking unit piecemeal
It is encrypted according to the first cipher mode;
Second ciphering unit, for pressing other fritters in addition to described M fritter in described N number of fritter
Being encrypted according to the second cipher mode, described M is the positive integer less than described N.
In conjunction with the embodiment of the second aspect of the embodiment of the present invention, in the first possible reality of second aspect
Execute in mode, described blocking unit specifically for:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal;
Or,
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
In conjunction with the embodiment of the second aspect of the embodiment of the present invention, the reality that the second in second aspect is possible
Executing in mode, described blocking unit includes:
First divides module, presets threshold for the described memory size obtained at described acquiring unit more than first
When being worth and be even number, described file to be encrypted is divided into the equal Part I of memory size and Part II;
Second divides module, is divided into internal memory big for dividing the described Part I of Module Division by described first
Little P equal fritter, and described Part II is divided into the most unequal N-P the fritter of memory size,
Wherein, described P is the positive integer less than described N.
In conjunction with the embodiment that the second of the second aspect of the embodiment of the present invention is possible, in the of second aspect
In three kinds of possible embodiments, described P is that described Part I is preset size according to first and is averaged
The fritter number obtained after piecemeal, or, described P is the numerical value that user specifies.
In conjunction with the second aspect of the embodiment of the present invention, second aspect the first may to any one in the third
Embodiment, in the 4th kind of possible embodiment of second aspect, described first ciphering unit includes:
3rd divides module, for being respectively divided by each fritter in M fritter in described N number of fritter
For K fritter, obtaining M*K fritter, wherein, described K is the integer more than 1, wherein, and described K
For the numerical value specified by user, or, described K is that described each fritter is preset size according to second and carried out
The fritter number obtained after average piecemeal;
First encrypting module, for entering the part fritter in described M*K fritter according to the first AES
Row encryption, and other fritters in addition to described part fritter in described M*K fritter are encrypted according to second
Algorithm is encrypted.
In conjunction with the second aspect of the embodiment of the present invention, second aspect the first may to any one in the third
Embodiment, in the 5th kind of possible embodiment of second aspect, described second ciphering unit is concrete
For:
Other fritters in addition to described M fritter in described N number of fritter are carried out according to XOR AES
Encryption.
In conjunction with the second aspect of the embodiment of the present invention, second aspect the first may to any one in the third
Embodiment, in the 6th kind of possible embodiment of second aspect, described N is described ciphertext to be added
Part is preset, according to the 3rd, the fritter number obtained after size carries out piecemeal, or, described N is that user specifies
Numerical value;
Described M is the numerical value that user specifies, and described M fritter is random described in described N number of fritter
M, or, described M fritter is M the fritter selected according to the order pre-set.
The embodiment of the present invention the 3rd face provides a kind of file encryption equipment, it is characterised in that including: process
Device, memorizer, communication interface and bus;
Described processor, described memorizer and described communication interface are connected by described bus and complete each other
Communication;Described memorizer storage executable program code;Described processor is by reading in described memorizer
The executable program code of storage runs the program corresponding with described executable program code, for execution
A kind of data processing method;Wherein, described method includes:
Obtain the memory size of file to be encrypted;
When described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of fritter,
Wherein, described N is the integer more than 1;
M fritter in described N number of fritter is encrypted according to the first cipher mode, and to described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, and described M is
Positive integer less than described N.
Embodiment of the present invention fourth aspect provides a kind of storage medium, and wherein, this storage medium should for storage
By program, described application program is for operationally performing described a kind of file encryption of the embodiment of the present invention
Method.
The embodiment of the present invention the 5th aspect provides a kind of application program, and wherein, this application program is for running
A kind of file encrypting method described in the Shi Zhihang embodiment of the present invention.
Implement the embodiment of the present invention, have the advantages that
The memory size of file to be encrypted is obtained by the embodiment of the present invention, pre-more than first at this memory size
If during threshold value, file to be encrypted being divided into N number of fritter, wherein, this N is the integer more than 1, to this N
M fritter in individual fritter is encrypted according to the first cipher mode, and to this N number of fritter removes this M
Other fritters outside individual fritter are encrypted according to the second cipher mode, and this M is the positive integer being less than.From
And, a part for file to be encrypted can be used the first cipher mode encryption, another part uses the second encryption
Mode is encrypted, and therefore, have employed two kinds of cipher modes and is encrypted file to be encrypted, increase and treat
The difficulty that encryption file is cracked, thus, improve safety.
Accompanying drawing explanation
For the technical scheme being illustrated more clearly that in the embodiment of the present invention, institute in embodiment being described below
The accompanying drawing used is needed to be briefly described, it should be apparent that, the accompanying drawing in describing below is the one of the present invention
A little embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, also
Other accompanying drawing can be obtained according to these accompanying drawings.
Fig. 1 is the first embodiment schematic flow sheet of a kind of file encrypting method that the embodiment of the present invention provides;
Fig. 2 is the second embodiment schematic flow sheet of a kind of file encrypting method that the embodiment of the present invention provides;
Fig. 3 is the 3rd embodiment schematic flow sheet of a kind of file encrypting method that the embodiment of the present invention provides;
Fig. 4 a is the example structure schematic diagram of a kind of document encrypting apparatus that the embodiment of the present invention provides;
Fig. 4 b is the another structural representation of embodiment of a kind of document encrypting apparatus that the embodiment of the present invention provides;
Fig. 4 c is the another structural representation of embodiment of a kind of document encrypting apparatus that the embodiment of the present invention provides;
Fig. 5 is the example structure schematic diagram of a kind of file encryption equipment that the embodiment of the present invention provides.
Detailed description of the invention
Embodiments provide a kind of file encrypting method, device and equipment, the peace of file can be improved
Quan Xing.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearly
Chu, it is fully described by, it is clear that described embodiment is a part of embodiment of the present invention rather than all
Embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative labor
The every other embodiment obtained under dynamic premise, broadly falls into the scope of protection of the invention.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearly
Chu, it is fully described by, it is clear that described embodiment is a part of embodiment of the present invention rather than all
Embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative labor
The every other embodiment obtained under dynamic premise, broadly falls into the scope of protection of the invention.
Term " first " in description and claims of this specification and described accompanying drawing, " second ", "
Three " and " the 4th " etc. is for distinguishing different object rather than for describing particular order.Additionally, art
Language " includes " and " having " and their any deformation, it is intended that cover non-exclusive comprising.Such as
Contain series of steps or the process of unit, method, system, product or equipment are not limited to list
Step or unit, but the most also include step or the unit do not listed, or the most also include right
In intrinsic other step of these processes, method, product or equipment or unit.
Referenced herein " embodiment " is it is meant that the special characteristic, structure or the characteristic that describe can in conjunction with the embodiments
To be included at least one embodiment of the present invention.There is this phrase not in each position in the description
Necessarily each mean identical embodiment, be not and the independent of other embodiments mutual exclusion or alternative embodiment.
Those skilled in the art explicitly and are implicitly understood by, and embodiment described herein can be real with other
Execute example to combine.
Equipment described by the embodiment of the present invention can include smart mobile phone (as Android phone, iOS mobile phone,
Windows Phone mobile phone etc.), panel computer, palm PC, notebook computer, mobile internet device
(MID, Mobile Internet Devices) or Wearable etc., the said equipment is only citing, rather than thoroughly
Lift, including but not limited to the said equipment.
One embodiment of a kind of file encrypting method of the present invention, a kind of file encrypting method comprises the steps that acquisition
The memory size of file to be encrypted;When described memory size is more than the first predetermined threshold value, by described to be encrypted
File is divided into N number of fritter, and wherein, described N is the integer more than 1;To the M in described N number of fritter
Individual fritter is encrypted according to the first cipher mode, and in described N number of fritter in addition to described M fritter
Other fritters be encrypted according to the second cipher mode, described M is the positive integer less than described N.
Referring to Fig. 1, the first embodiment flow process for a kind of file encrypting method of embodiment of the present invention offer is shown
It is intended to.File encrypting method described in the present embodiment, comprises the following steps:
101, the memory size of file to be encrypted is obtained.
In the embodiment of the present invention, file to be encrypted can include but are not limited to: picture file, video file,
Audio file, word text, data cached file, compressed package files, folder file etc..Enter
One step ground, file to be encrypted can be also the most encrypted file.Specifically, can read file to be encrypted,
And obtain the memory size of this file to be encrypted, wherein, can obtain from the attribute information of file to be encrypted should
The memory size of file to be encrypted, such as, when file to be encrypted is a pictures, not only can be from this picture
Attribute information in obtain the memory size of picture, it is also possible to obtain the form of this picture.
Alternatively, file to be encrypted can be 1 or multiple, and wherein, this file to be encrypted can be led to by user
Crossing the file that touch control operation carries out selecting, such as, user, can be to needing from picture library when to image ciphering
At least one pictures chosen carries out touch control operation, using this at least one pictures of choosing as file to be encrypted.
102, when described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of little
Block, wherein, described N is the integer more than 1.
In the embodiment of the present invention, can determine whether whether the memory size of this file to be encrypted is more than the first predetermined threshold value,
Wherein, the first predetermined threshold value can be: 500kb, 501kb, 750kb, 800kb, 801kb, 801.11kb,
1M etc..When the memory size of file to be encrypted is more than the first predetermined threshold value, file to be encrypted is divided into N
Individual fritter, this N is the integer more than 1.
Alternatively, when the memory size of file to be encrypted is more than the first predetermined threshold value, can be according to random fashion
File to be encrypted is divided into N number of fritter.Further, file to be encrypted can be divided into N number of fritter, each
The memory size of fritter is equal.
Alternatively, when the memory size of this file to be encrypted is less than the first predetermined threshold value, can be to literary composition to be encrypted
Part is directly encrypted.In actual application, if file to be encrypted is less, then use the encryption that complexity is higher
During algorithm, also will not affect very much the enciphering rate of file to be encrypted, thus, it is contemplated that at file to be encrypted
When memory size is less than certain threshold value, this file to be encrypted is directly encrypted.
Still optionally further, when the memory size of file to be encrypted is more than the first predetermined threshold value, can determine whether this
Whether memory size can be divided exactly by the second predetermined threshold value, and the memory size at file to be encrypted can be preset by second
When threshold value divides exactly, this file to be encrypted is divided into N equal portions, obtains N number of fritter.At file to be encrypted
Memory size when not divided exactly by the second predetermined threshold value, file to be encrypted can be divided into N number of fritter, this is N number of
The memory size only having part fritter in fritter is equal, distinguishingly, has the interior of N-1 fritter in N number of fritter
Depositing equal in magnitude, remaining 1 fritter is not equal with the memory size of this N-1 fritter.Above-mentioned second pre-
If threshold value can be any integer, alternatively, the second predetermined threshold value is 16, such as, for des encryption mode
For, minimum encryption unit (size of file to be encrypted) is required to be the integral multiple of 16bit, i.e. uses DES
When being encrypted file to be encrypted, the size of file must be the integral multiple of 16bit, and wherein, second presets threshold
The specific size of value can be determined according to the AES used when being encrypted file to be encrypted by user.Tool
Body ground, when the memory size of file to be encrypted is more than the first predetermined threshold value, and the internal memory of file to be encrypted is big
When I is divided exactly by the second predetermined threshold value, this file to be encrypted can be divided into N equal portions, in implementing,
The numerical value that the big I of N is specified by user setup, i.e. user.Further, N can be also file to be encrypted
According to being preset, according to the 3rd, the fritter number obtained after size carries out piecemeal, wherein, the 3rd presets big I
For 4kb, 8kb, 16kb, 512b etc., such as, N can be to be one by file to be encrypted according to every 4kb
Fritter carries out the fritter number that piecemeal obtains.In specific implementation process, how to judge the internal memory of file to be encrypted
Can size be divided exactly by the second predetermined threshold value, can be converted into by memory size and be indicated in units of kb,
Then judging that the numeral of this conversion could be divided exactly by the second predetermined threshold value, numeral in post-conversion is with arithmetic point
Time, then the numeral after this turn can be rounded, then, it is judged that this integer could be whole by the second predetermined threshold value
Remove.Being 4096 to be illustrated with the second predetermined threshold value, such as, the memory size of file to be encrypted is 4M,
Then 4M=4*1024kb=4096kb, then the memory size of this file to be encrypted can be divided exactly by 4096, the most such as,
The size of file to be encrypted is 4095kb, then the memory size of this file to be encrypted can not be divided exactly by 4096, again
Such as, 4.113M=4.113*1024kb=4211.712kb, obtain 4211kb after rounding, then, 4211 are not
Can be divided exactly by 4096, then, then the memory size of this file to be encrypted can not be divided exactly by 4096.Further
Ground, above-mentioned N can be determined by the second predetermined threshold value, and such as, N is the memory size and second of file to be encrypted
The ratio of predetermined threshold value, or, N is the ratio of the approximate number of the memory size of file to be encrypted and the second predetermined threshold value,
Such as, if the second predetermined threshold value is 4096, when the memory size of file to be encrypted is 1M, then, should
1M=1024kb=1024*1024b, then, this 1M can be divided exactly by the second predetermined threshold value, then,
N=1M/4096, or, N=1M/8 etc..The above-mentioned memory size at file to be encrypted is not preset by second
When threshold value divides exactly, file to be encrypted can be divided into N number of fritter, this N number of fritter only has the interior of part fritter
Deposit equal in magnitude, such as, in the case of file to be encrypted can not be divided exactly by 4, file to be encrypted can be pressed
Fritter according to every 4kb size is split, and finally that is not that the fritter of 4kb is as single one using this
Individual fritter.
103, M fritter in described N number of fritter is encrypted according to the first cipher mode, by described
In N number of fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, described
M is the positive integer less than described N.
In the embodiment of the present invention, M can be the numerical value that user specifies, and M fritter can be appointing in N number of fritter
Anticipate M fritter, or, M fritter is M the fritter selected according to the order pre-set, can be right
N number of fritter is numbered, then, the order pre-set can be the 1st to m-th, the 2nd to the
M+1, etc., the order pre-set can be also sampling order, such as, with 2 as sampling interval, M
Individual fritter can be: 2,4,6,8 ..., 2M, wherein, M is positive integer and is less than N.Wherein, can be to M
Fritter is encrypted according to the first cipher mode, by residue N-M the fritter in this N number of fritter according to second
Cipher mode is encrypted.Wherein, the first cipher mode can comprise a kind of AES or multiple encryption is calculated
Method, such as, is all encrypted above-mentioned M fritter according to RSA cryptographic algorithms, or, can be by M
Certain part fritter in fritter is encrypted according to RSA cryptographic algorithms and in this M fritter except this certain part
Other fritters outside fritter are encrypted according to XOR AES.In like manner, the second cipher mode can comprise one
Plant AES or multiple encryption algorithms, such as, by above-mentioned N-M fritter all according to RSA cryptographic algorithms
It is encrypted, or, certain the part fritter in N-M fritter can be encrypted according to RSA cryptographic algorithms
Add according to XOR AES with other fritters in addition to this certain part fritter in this N-M fritter
Close.
Alternatively, the complexity of the AES employed in the first cipher mode can be more than the second cipher mode
Employed in AES, or, the complexity of the AES used in the second cipher mode is more than the
The AES used in one cipher mode.
Alternatively, the first adoptable AES of cipher mode can include but are not limited to: superencipherment is calculated
Method, RSA cryptographic algorithms, data encryption standards, 3DES (Triple DES), RC2, RC4, international number
According to AES (International Data Encryption Algorithm, IDEA), XOR AES etc.
Deng, the second adoptable AES of cipher mode can include but are not limited to: advanced encryption algorithm, RSA
AES, data encryption standards, 3DES, RC2, RC4, IDEA, XOR AES etc., can
Selection of land, the AES that the first cipher mode uses is different from the AES that the second cipher mode uses.
One concrete making an excessive case more excessive illustrates, and is 512kb in the first predetermined threshold value, and the second predetermined threshold value is 4096,
When the big I of file to be encrypted is divided exactly by the second predetermined threshold value, the first cipher mode can be by the first fritter
Being encrypted according to AES encryption algorithm with last fritter, the second cipher mode is for continue to remaining fritter
Continuing and be divided into multiple decile, then, first fritter is carried out AES encryption algorithm and is encrypted, other are little
Block is encrypted according to XOR AES.Size at file to be encrypted can not be divided exactly by the second predetermined threshold value
Time, the first cipher mode can be the first fritter and penultimate fritter to be added according to AES encryption algorithm
Close and last fritter is encrypted according to XOR AES, and the second cipher mode is to remaining fritter
Continue to be divided into multiple decile, then, first fritter is carried out AES encryption algorithm and is encrypted, other
Fritter is encrypted according to XOR AES.
If, the memory size of file to be encrypted is 400kb, the memory size 512kb of file the most to be encrypted,
So, directly whole file to be encrypted can be encrypted, such as, RSA cryptographic algorithms can be used whole
File to be encrypted is encrypted.Because now, the memory size of file to be encrypted is less, thus, even if
Use complex AES also to the occupancy of internal memory, CPU in ciphering process will not be caused obvious shadow
Ring.
If again, the memory size of file to be encrypted is 4096kb, then the memory size of this file to be encrypted is big
In 512Kb, and the memory size of this file to be encrypted can be divided exactly by 4096, then can be to be encrypted by this further
File is split according to the size that memory size is 4kb of each fritter, specifically, the first fritter and
Last fritter is encrypted according to the first cipher mode, will the first fritter and last fritter according to
AES encryption algorithm is encrypted.Remaining fritter is encrypted according to the second cipher mode, will remaining
Fritter is divided into 8 parts again, and is encrypted first fritter according to AES encryption algorithm, and remaining fritter is pressed
It is encrypted according to XOR AES.Thus, now, can to the N number of fritter obtained after piecemeal as much as possible
Using XOR AES, this XOR AES complexity is relatively low, thus, AES complicated with employing
Compare, enciphering rate can be improved and reduce the CPU occupancy to memory source.
If again, the memory size of file to be encrypted is 4095kb, then the memory size of this file to be encrypted is big
In 512Kb, and the memory size of this file to be encrypted can not be divided exactly by 4096, then can be by file to be encrypted literary composition
Part is split according to the size of every piece of 4Kb, then, the memory size of last fritter is less than 4kb,
First fritter and penultimate fritter can be added according to the first cipher mode with last fritter
Close, will first fritter and penultimate fritter be encrypted according to AES encryption algorithm, by last
Individual block is encrypted according to XOR AES, and remaining fritter is encrypted according to the second cipher mode, i.e.
Remaining fritter is divided into 8 parts, first fritter can be encrypted according to AES encryption algorithm, remaining
Fritter be encrypted according to XOR AES.
It should be noted that during the enforcement embodiment of the present invention, need to select fritter as much as possible according to
XOR AES is encrypted, and enters other fritter according to the AES beyond XOR AES
Row encryption.Alternatively, file to be encrypted can be divided into N number of fritter, wherein, use XOR AES
The number of the fritter being encrypted is more than N/2 and less than 9N/10, so, is possible not only to promote enciphering rate,
Reduce the memory source occupancy of CPU in ciphering process, and, the safety of encryption can be ensured.
The memory size of file to be encrypted is obtained by the embodiment of the present invention, pre-more than first at this memory size
If during threshold value, file to be encrypted being divided into N number of fritter, wherein, this N is the integer more than 1, to this N
M fritter in individual fritter is encrypted according to the first cipher mode, and to this N number of fritter removes this M
Other fritters outside individual fritter are encrypted according to the second cipher mode, and this M is the positive integer being less than.From
And, a part for file to be encrypted can be used the first cipher mode encryption, another part uses the second encryption
Mode is encrypted, and therefore, have employed two kinds of cipher modes and is encrypted file to be encrypted, increase and treat
The difficulty that encryption file is cracked, thus, improve safety.Further, a kind of cipher mode wherein
For simple encryption mode, when another cipher mode is complicated cipher mode, the encryption of file to be encrypted can be improved
Speed, reduces the memory headroom occupancy of CPU.
Referring to Fig. 2, the second embodiment flow process for a kind of file encrypting method of embodiment of the present invention offer is shown
It is intended to.File encrypting method described in the present embodiment, comprises the following steps:
201, the memory size of file to be encrypted is obtained.
202, when described memory size is more than the first predetermined threshold value and is even number, described file to be encrypted is divided
Become Part I and Part II that memory size is equal.
In the embodiment of the present invention, can judge the memory size of file to be encrypted more than the first predetermined threshold value it
After, then judge whether memory size is even number, and memory size can be converted into and be indicated with kb unit, example
As, 1M=1024kb, i.e. 1024 is even number.If memory size being converted into kb for mixed decimal during unit,
Then the number after this conversion can be rounded, then judge whether the number after rounding is even number, such as,
1.113M=1139.712kb, then, round 1139.712, available 1139, this 1139 is not
Even number.When the memory size of file to be encrypted is even number, then file to be encrypted can be divided into memory size phase
Deng Part I and the memory size of Part II, i.e. Part I and the memory size of Part II equal.
203, described Part I is divided into P the fritter that memory size is equal, and described Part II is divided
For the most unequal N-P the fritter of memory size, wherein, described N is that positive integer and described P are for less than institute
State the positive integer of N.
In the embodiment of the present invention, can be by P equal for the memory size of Part I fritter, wherein, P's is big
The memory size of each fritter that I is selected by user determines.Specifically, can be according to the internal memory of Part I
Size, finds the approximate number that this memory size is corresponding, determines the size of P according to this approximate number, and such as, internal memory is big
It is little for 1024kb, then, it may be determined that its approximate number 32, then a P=1024/32=32, then can be by first
32 equal portions that part is divided into memory size to be 32kb.In implementing, the big I of N by user setup,
After setting this N value, the big palpulus of P is less than this N, thus, for Part II, then may be used
This Part II is divided into N-P part, then this Part II can be divided into the most unequal N-P the fritter of size,
Random algorithm can be used, the most unequal N-P the fritter of size can be divided into by Part II.Wherein, above-mentioned P
For the positive integer less than N.Above-mentioned P is Part I to be preset size according to first and is averaged after piecemeal
The fritter number arrived, or, P is the numerical value that user specifies.Further, P can be also that file to be encrypted is pressed
Being averaged after piecemeal the fritter number obtained according to presetting size according to first, wherein, first presets size
Can be 4kb, 8kb, 16kb, 512b etc..
204, M fritter in described N number of fritter is encrypted according to the first cipher mode, and to institute
State in N number of fritter other fritters in addition to described M fritter to be encrypted according to the second cipher mode, institute
Stating M is the positive integer less than described N.
In the embodiment of the present invention, M fritter can be any M the fritter in N number of fritter.Wherein, M is
Positive integer and less than N.M fritter can be encrypted according to the first cipher mode, by this N number of fritter
Residue N-M fritter be encrypted according to the second cipher mode.Wherein, the first cipher mode can comprise one
Plant AES or multiple encryption algorithms, such as, above-mentioned M fritter is all entered according to RSA cryptographic algorithms
Row encryption, or, certain the part fritter in M fritter can be encrypted according to RSA cryptographic algorithms and be somebody's turn to do
In M fritter, other fritters in addition to this certain part fritter are encrypted according to XOR AES.In like manner,
Second cipher mode can comprise a kind of AES or multiple encryption algorithms, such as, little by above-mentioned N-M
Block is all encrypted according to RSA cryptographic algorithms, or, can by certain the part fritter in N-M fritter according to
RSA cryptographic algorithms be encrypted and in this N-M fritter other fritters in addition to this certain part fritter by
It is encrypted according to XOR AES.
It should be noted that during the enforcement embodiment of the present invention, need to select fritter as much as possible according to
XOR AES is encrypted, and enters other fritter according to the AES beyond XOR AES
Row encryption.Alternatively, file to be encrypted can be divided into N number of fritter, wherein, use XOR AES
The number of the fritter being encrypted is more than N/2 and less than 9N/10, so, is possible not only to promote enciphering rate,
Reduce the memory source occupancy of CPU in ciphering process, and, the safety of encryption can be ensured.
The memory size of file to be encrypted is obtained by the embodiment of the present invention, pre-more than first at this memory size
If during threshold value and when being even number, its pending data being divided into 2 equal portions, wherein, equal portions are averagely divided into
Multiple fritters that memory size is equal, another equal portions are divided into the most unequal multiple fritters of memory size,
To N number of fritter, M fritter in this N number of fritter is encrypted according to the first cipher mode, and to this
In N number of fritter, other fritters in addition to this M fritter are encrypted according to the second cipher mode, and this M is
The positive integer being less than.Thus, a part for file to be encrypted can be used the first cipher mode encryption, another
Part uses the second cipher mode to be encrypted, and therefore, have employed two kinds of cipher modes and enters file to be encrypted
Row encryption, increases the difficulty that file to be encrypted is cracked, thus, improve safety.Further, exist
One of which cipher mode is simple encryption mode, when another cipher mode is complicated cipher mode, can improve
The enciphering rate of file to be encrypted, reduces the memory headroom occupancy of CPU.
Referring to Fig. 3, the 3rd embodiment flow process for a kind of file encrypting method of embodiment of the present invention offer is shown
It is intended to.File encrypting method described in the present embodiment, comprises the following steps:
301, the memory size of file to be encrypted is obtained.
302, when described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of little
Block, wherein, described N is the integer more than 1.
303, each fritter in M fritter in described N number of fritter is respectively divided into K fritter,
Obtaining M*K fritter, wherein, described K is the integer more than 1, and described M is whole less than described N
Number.
In the embodiment of the present invention, can continue each fritter in M fritter is made Further Division, wherein,
Each fritter can be divided into K fritter respectively.The memory size of this K fritter can be equal, or K
The memory size of fritter can be unequal, or, the memory size of this K fritter can part equal.Further
Ground, during each fritter in M fritter is divided into K fritter, can be in M fritter
Part fritter divide according to average mark segmentation method, then, which in each fritter obtained
The memory size of each fritter is equal.For other fritters in addition to part fritter in M fritter,
During fritter each in this part is divided into K fritter, can arrange fritter minimum memory size or
Person's maximum memory size.Such as, during certain fritter is divided into K fritter, it is individual little that K can be set
The minimum memory size of each fritter in block, then the memory size of K fritter is all higher than this minimum memory size,
Or, during certain fritter is divided into K fritter, each fritter can be set in K fritter
Big memory size, then the memory size of this K fritter is respectively less than this minimum memory size.Based on aforesaid way,
Each fritter in M fritter is being respectively divided into K fritter, available M*K fritter, wherein,
K is the integer more than 1.Above-mentioned K is that each fritter in M fritter is preset size according to the 3rd and carried out
The fritter number obtained after average piecemeal, or, K is the numerical value that user specifies.Further, K also may be used
It is averaged after piecemeal the fritter obtained according to being preset size according to the 3rd for each fritter in M fritter
Number, wherein, the 3rd to preset big I be 4kb, 8kb, 16kb, 512b etc..
304, the part fritter in described M*K fritter is encrypted according to the first AES, and will
In described M*K fritter, other fritters in addition to described part fritter add according to the second AES
Close.
In the embodiment of the present invention, the part fritter in M*K fritter can be added according to the first AES
Close, the fritter number contained in the subdividing of middle part can be arranged voluntarily by system default or user, and this part is little
Block can randomly select from M*K fritter, or, user specify.
305, other fritters in addition to described M fritter in described N number of fritter are calculated according to XOR encryption
Method is encrypted.
In the embodiment of the present invention, can be to other fritters in addition to M fritter in N number of fritter according to XOR
AES is encrypted, thus, compared with other AESs, it is possible to decrease the algorithm in ciphering process is multiple
Miscellaneous degree, has not only shortened the time of encryption, it is often more important that, reduce CPU and memory source is accounted for
By rate.
It should be noted that during the enforcement embodiment of the present invention, need to select fritter as much as possible according to
XOR AES is encrypted, and enters other fritter according to the AES beyond XOR AES
Row encryption.Alternatively, file to be encrypted can be divided into N number of fritter, wherein, use XOR AES
The number of the fritter being encrypted is more than N/2 and less than 9N/10, so, is possible not only to promote enciphering rate,
Reduce the memory source occupancy of CPU in ciphering process, and, the safety of encryption can be ensured.
The memory size of file to be encrypted is obtained by the embodiment of the present invention, pre-more than first at this memory size
If during threshold value, file to be encrypted being divided into N number of fritter, wherein, this N is the integer more than 1, to this N
M fritter in individual fritter continues division and obtains M*K fritter, little to the part in this M*K fritter
Block is encrypted according to the first encryption, and other fritters are encrypted according to the second AES, and N number of to this
Fritter other fritters in addition to above-mentioned M fritter are encrypted according to XOR AES, and this M is little
In positive integer.Thus, a part for file to be encrypted can be used the first cipher mode encryption, another portion
Divide and use the second cipher mode to be encrypted, therefore, have employed two kinds of cipher modes and file to be encrypted is carried out
Encryption, increases the difficulty that file to be encrypted is cracked, thus, improve safety.Further, at it
Middle a kind of cipher mode is simple encryption mode, when another cipher mode is complicated cipher mode, can improve and treat
The enciphering rate of encryption file, reduces the memory headroom occupancy of CPU.
Refer to Fig. 4, for the example structure signal of a kind of document encrypting apparatus that the embodiment of the present invention provides
Figure.Described in the present embodiment, including:
Acquiring unit 401, for obtaining the memory size of file to be encrypted.
In the embodiment of the present invention, file to be encrypted can include but are not limited to: picture file, video file,
Audio file, word text, data cached file, compressed package files, folder file etc..Enter
One step ground, file to be encrypted can be also the most encrypted file.Can read file to be encrypted, and acquisition should
The memory size of file to be encrypted, wherein, can obtain this ciphertext to be added from the attribute information of file to be encrypted
The memory size of part, when file to be encrypted is a pictures, not only can obtain from the attribute information of this picture
Memory size to picture, it is also possible to obtain the form of this picture.
Alternatively, file to be encrypted can be 1 or multiple, and wherein, this file to be encrypted can be led to by user
Crossing the file that touch control operation carries out selecting, such as, user, can be to needing from picture library when to image ciphering
At least one pictures chosen carries out touch control operation, using this at least one pictures of choosing as file to be encrypted.
Blocking unit 402, for when described memory size is more than the first predetermined threshold value, by described ciphertext to be added
Part is divided into N number of fritter, and wherein, described N is the integer more than 1.
In the embodiment of the present invention, can determine whether whether the memory size of this file to be encrypted is more than the first predetermined threshold value,
Wherein, the first predetermined threshold value can be: 500kb, 501kb, 750kb, 800kb, 801kb, 801.11kb,
1M etc..When the memory size of file to be encrypted is more than the first predetermined threshold value, file to be encrypted is divided into N
Individual fritter, this N is the integer more than 1.
Alternatively, when the memory size of file to be encrypted is more than the first predetermined threshold value, can be according to random fashion
File to be encrypted is divided into N number of fritter.Further, can be that file to be encrypted is divided into N number of fritter, often
The memory size of one fritter is equal.
Alternatively, when the memory size of this file to be encrypted is less than the first predetermined threshold value, can be to literary composition to be encrypted
Part is directly encrypted.In actual application, if file to be encrypted is less, then use the encryption that complexity is higher
During algorithm, also will not affect very much the enciphering rate of file to be encrypted, thus, it is contemplated that at file to be encrypted
When memory size is less than certain threshold value, this file to be encrypted is directly encrypted.
Still optionally further, when the memory size of file to be encrypted is more than the first predetermined threshold value, can determine whether this
Whether memory size can be divided exactly by the second predetermined threshold value, and the memory size at file to be encrypted can be preset by second
When threshold value divides exactly, this file to be encrypted is divided into N equal portions, obtains N number of fritter.At file to be encrypted
Memory size when not divided exactly by the second predetermined threshold value, file to be encrypted can be divided into N number of fritter, this is N number of
The memory size only having part fritter in fritter is equal, distinguishingly, has the interior of N-1 fritter in N number of fritter
Depositing equal in magnitude, remaining 1 fritter is not equal with the memory size of this N-1 fritter.Above-mentioned second pre-
If threshold value can be any integer, alternatively, the integer of 4, such as, 4096.Specifically, at file to be encrypted
Memory size more than the first predetermined threshold value time, and the memory size of file to be encrypted can be by the second predetermined threshold value
When dividing exactly, this file to be encrypted can be divided into N equal portions, in implementing, the big I of N is by user
Arrange, or, this N can be determined by the second predetermined threshold value.Further, N can be also by file to be encrypted
The fritter number obtained after carrying out piecemeal according to certain fixing fritter, such as, by file to be encrypted according to every 4kb
It is that a fritter carries out piecemeal.In specific implementation process, how to judge that can the memory size of file to be encrypted
Divided exactly by the second predetermined threshold value, memory size can be converted into and be indicated in units of kb, then judge
The numeral of this conversion could be divided exactly by the second predetermined threshold value, when numeral in post-conversion is with arithmetic point, then may be used
Numeral after this turn is rounded, then, it is judged that this integer could be divided exactly by the second predetermined threshold value.With
Two predetermined threshold value are 4096 to be illustrated, and such as, the memory size of file to be encrypted is 4M, then
4M=4*1024kb=4096kb, then the memory size of this file to be encrypted can be divided exactly by 4096, the most such as,
The size of file to be encrypted is 4095kb, then the memory size of this file to be encrypted can not be divided exactly by 4096, again
Such as, 4.113M=4.113*1024kb=4211.712kb, obtain 4211kb after rounding, then, 4211 are not
Can be divided exactly by 4096, then, then the memory size of this file to be encrypted can not be divided exactly by 4096.
Such as, N is memory size and the ratio of the second predetermined threshold value of file to be encrypted, or, N is to be added
The memory size of ciphertext part and the ratio of the approximate number of the second predetermined threshold value, such as, if the second predetermined threshold value is 4096,
When the memory size of file to be encrypted is 1M, then, this 1M=1024kb=1024*1024b, then, should
1M can be divided exactly by the second predetermined threshold value, then, N=1M/4096, or, N=1M/8 etc..
The most such as, when the memory size of file to be encrypted is not divided exactly by the second predetermined threshold value, can be by be encrypted
File is divided into N number of fritter, and the memory size only having part fritter in this N number of fritter is equal, such as, is treating
In the case of encryption file can not be divided exactly by 4, file to be encrypted can be carried out according to the fritter of every 4kb size
Segmentation, and finally that is not that the fritter of 4kb is as a single fritter using this.
First ciphering unit 403, for the M in described N number of fritter of described blocking unit 402 piecemeal
Individual fritter is encrypted according to the first cipher mode.
Second ciphering unit 404, for little to other in addition to described M fritter in described N number of fritter
Block is encrypted according to the second cipher mode, and described M is the positive integer less than described N.
In the embodiment of the present invention, M fritter can be any M the fritter in N number of fritter.Wherein, M is
Positive integer and less than N.Wherein, M fritter can be encrypted according to the first cipher mode, this is N number of
Residue N-M fritter in fritter is encrypted according to the second cipher mode.Wherein, the first cipher mode can
Comprise a kind of AES or multiple encryption algorithms, such as, by above-mentioned M fritter all according to rsa encryption
Algorithm is encrypted, or, certain the part fritter in M fritter can be added according to RSA cryptographic algorithms
In close and this M fritter, other fritters in addition to this certain part fritter add according to XOR AES
Close.In like manner, the second cipher mode can comprise a kind of AES or multiple encryption algorithms, such as, by upper
State N-M fritter to be all encrypted according to RSA cryptographic algorithms, or, can be by certain in N-M fritter
Part fritter is encrypted according to RSA cryptographic algorithms and in this N-M fritter in addition to this certain part fritter
Other fritters be encrypted according to XOR AES.
Alternatively, the complexity of the AES employed in the first cipher mode can be more than the second cipher mode
Employed in AES, or, the complexity of the AES used in the second cipher mode is more than the
The AES used in one cipher mode.
Alternatively, the first adoptable AES of cipher mode can include but are not limited to: superencipherment is calculated
Method AES, RSA cryptographic algorithms, DES, 3DES, RC2, RC4, IDEA, XOR AES etc.,
The second adoptable AES of cipher mode can include but are not limited to: advanced encryption algorithm, rsa encryption
Algorithm, data encryption standards, 3DES, RC2, RC4, IDEA, XOR AES etc., alternatively,
The AES that first cipher mode uses is different from the AES that the second cipher mode uses.
One concrete making an excessive case more excessive illustrates, and is 512kb in the first predetermined threshold value, and the second predetermined threshold value is 4096,
When the big I of file to be encrypted is divided exactly by the second predetermined threshold value, the first cipher mode can be by the first fritter
Being encrypted according to AES encryption algorithm with last fritter, the second cipher mode is for continue to remaining fritter
Continuing and be divided into multiple decile, then, first fritter is carried out AES encryption algorithm and is encrypted, other are little
Block is encrypted according to XOR AES.Size at file to be encrypted can not be divided exactly by the second predetermined threshold value
Time, the first cipher mode can be the first fritter and penultimate fritter to be added according to AES encryption algorithm
Close and last fritter is encrypted according to XOR AES, and the second cipher mode is to remaining fritter
Continue to be divided into multiple decile, then, first fritter is carried out AES encryption algorithm and is encrypted, other
Fritter is encrypted according to XOR AES.
If, the memory size of file to be encrypted is 400kb, the memory size 512Kb of file the most to be encrypted,
So, directly whole file to be encrypted can be encrypted, such as, RSA cryptographic algorithms can be used whole
File to be encrypted is encrypted.Because now, the memory size of file to be encrypted is less, thus, even if
Use complex AES also to the occupancy of internal memory, CPU in ciphering process will not be caused obvious shadow
Ring.
If again, the memory size of file to be encrypted is 4096kb, then the memory size of this file to be encrypted is big
In 512Kb, and the memory size of this file to be encrypted can be divided exactly by 4096, then can be to be encrypted by this further
File is split according to the size that memory size is 4kb of each fritter, specifically, the first fritter and
Last fritter is encrypted according to the first cipher mode, will the first fritter and last fritter according to
AES encryption algorithm is encrypted.Remaining fritter is encrypted according to the second cipher mode, will remaining
Fritter is divided into 8 parts again, and is encrypted first fritter according to AES encryption algorithm, and remaining fritter is pressed
It is encrypted according to XOR AES.Thus, now, can to the N number of fritter obtained after piecemeal as much as possible
Using XOR AES, this XOR AES complexity is relatively low, thus, AES complicated with employing
Compare, enciphering rate can be improved and reduce the CPU occupancy to memory source.
If again, the memory size of file to be encrypted is 4095kb, then the memory size of this file to be encrypted is big
In 512Kb, and the memory size of this file to be encrypted can not be divided exactly by 4096, then can be by file to be encrypted literary composition
Part is split according to the size of every piece of 4Kb, then, the memory size of last fritter is less than 4kb,
First fritter and penultimate fritter can be added according to the first cipher mode with last fritter
Close, will first fritter and penultimate fritter be encrypted according to AES encryption algorithm, by last
Individual block is encrypted according to XOR AES, and remaining fritter is encrypted according to the second cipher mode, i.e.
Remaining fritter is divided into 8 parts, first fritter can be encrypted according to AES encryption algorithm, remaining
Fritter be encrypted according to XOR AES.
Alternatively, described blocking unit 402 specifically for:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal.
Alternatively, described blocking unit 402 specifically for:
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
As a kind of possible embodiment, as shown in Figure 4 b, described in Fig. 4 a blocking unit 402
Comprise the steps that
First divides module 4021, for the described memory size that obtains at described acquiring unit 401 more than the
One predetermined threshold value and when being even number, is divided into the equal Part I of memory size and by described file to be encrypted
Two parts.
In the embodiment of the present invention, after the memory size judging file to be encrypted is more than the first predetermined threshold value,
Judge whether memory size is even number again, memory size can be converted into and be indicated with kb unit, such as,
1M=1024kb, i.e. 1024 is even number.If memory size being converted into kb for mixed decimal during unit, then
Number after this conversion can be rounded, then judge whether the number after rounding is even number, such as,
1.113M=1139.712kb, then, round 1139.712, available 1139, this 1139 is not
Even number.When memory size is even number, then file to be encrypted can be divided into the Part I that memory size is equal
With the memory size of Part II, i.e. Part I is equal with the memory size of Part II.
Second divides module 4022, and the described Part I divided for dividing module 4021 by described first divides
For P the fritter that memory size is equal, and described Part II is divided into the most unequal N-P of memory size
Individual fritter, wherein, described P is the positive integer less than described N.
In the embodiment of the present invention, can be by P equal for the memory size of Part I fritter, wherein, P's is big
The memory size of each fritter that I is selected by user determines.Specifically, can be according to the internal memory of Part I
Size, finds the approximate number that this memory size is corresponding, determines the size of P according to this approximate number, and such as, internal memory is big
It is little for 1024kb, then, it may be determined that its approximate number 32, then a P=1024/32=32, then can be by first
32 equal portions that part is divided into memory size to be 32kb.In implementing, the big I of N by user setup,
After setting this N value, the big palpulus of P is less than this N, thus, for Part II, then may be used
This Part II is divided into N-P part, then this Part II can be divided into the most unequal N-P the fritter of size,
Random algorithm can be used, the most unequal N-P the fritter of size can be divided into by Part II.Wherein, above-mentioned P
For the positive integer less than N.
Alternatively, as illustrated in fig. 4 c, the first ciphering unit 403 described in Fig. 4 a comprises the steps that
3rd divides module 4031, for by each fritter in M fritter in described N number of fritter respectively
Being divided into K fritter, obtain M*K fritter, wherein, described K is the integer more than 1, wherein,
Described K is the numerical value specified by user, or, described K is that described each fritter is preset big according to second
The fritter number obtained after the little piecemeal that is averaged.
In the embodiment of the present invention, can continue each fritter in M fritter is made Further Division, wherein,
Each fritter can be divided into K fritter respectively.The memory size of this K fritter can be equal, or K
The memory size of fritter can be unequal, or, the memory size of this K fritter can part equal.Further
Ground, during each fritter in M fritter is divided into K fritter, can be in M fritter
Part fritter divide according to average mark segmentation method, then, which in each fritter obtained
The memory size of each fritter is equal.For other fritters in addition to part fritter in M fritter,
During fritter each in this part is divided into K fritter, can arrange fritter minimum memory size or
Person's maximum memory size.Such as, during certain fritter is divided into K fritter, it is individual little that K can be set
The minimum memory size of each fritter in block, then the memory size of K fritter is all higher than this minimum memory size,
Or, during certain fritter is divided into K fritter, each fritter can be set in K fritter
Big memory size, then the memory size of this K fritter is respectively less than this minimum memory size.Based on aforesaid way,
Each fritter in M fritter is being respectively divided into K fritter, available M*K fritter, wherein,
K is the integer more than 1.
First encrypting module 4032, for calculating the part fritter in described M*K fritter according to the first encryption
Method is encrypted, and by other fritters in addition to described part fritter in described M*K fritter according to second
AES is encrypted.
In the embodiment of the present invention, the part fritter in M*K fritter can be added according to the first AES
Close, the fritter number contained in the subdividing of middle part can be arranged voluntarily by system default or user, and this part is little
Block can randomly select from M*K fritter, or, user specify.
Alternatively, above-mentioned second ciphering unit 404 can be specifically for:
Other fritters in addition to described M fritter in described N number of fritter are carried out according to XOR AES
Encryption.
In the embodiment of the present invention, can be to other fritters in addition to M fritter in N number of fritter according to XOR
AES is encrypted, thus, compared with other AESs, it is possible to decrease the algorithm in ciphering process is multiple
Miscellaneous degree, has not only shortened the time of encryption, it is often more important that, reduce CPU and memory source is accounted for
By rate.
Alternatively, to be described Part I preset size according to first to described P is averaged after piecemeal and obtains
Fritter number, or, described P is the numerical value that user specifies.
Alternatively, described N is that described file to be encrypted is preset according to the 3rd and obtained after size carries out piecemeal
Fritter number, or, described N is the numerical value that user specifies;
Described M is the numerical value that user specifies, and described M fritter is random described in described N number of fritter
M, or, described M fritter is M the fritter selected according to the order pre-set.
It should be noted that during the enforcement embodiment of the present invention, need to select fritter as much as possible according to
XOR AES is encrypted, and enters other fritter according to the AES beyond XOR AES
Row encryption.Alternatively, file to be encrypted can be divided into N number of fritter, wherein, use XOR AES
The number of the fritter being encrypted is more than N/2 and less than 9N/10, so, is possible not only to promote enciphering rate,
Reduce the memory source occupancy of CPU in ciphering process, and, the safety of encryption can be ensured.
By the document encrypting apparatus described by the embodiment of the present invention, the memory size of file to be encrypted can be obtained,
When this memory size is more than the first predetermined threshold value, file to be encrypted is divided into N number of fritter, wherein, this N
For the integer more than 1, M fritter in this N number of fritter is encrypted according to the first cipher mode, and
Other fritters in addition to this M fritter in this N number of fritter are encrypted according to the second cipher mode, should
M is the positive integer being less than.Thus, a part for file to be encrypted can be used the first cipher mode encryption,
Another part uses the second cipher mode to be encrypted, and therefore, have employed two kinds of cipher modes to literary composition to be encrypted
Part is encrypted, and increases the difficulty that file to be encrypted is cracked, thus, improve safety.Further,
A kind of cipher mode is simple encryption mode wherein, when another cipher mode is complicated cipher mode, can carry
The enciphering rate of high file to be encrypted, reduces the memory headroom occupancy of CPU.
Refer to Fig. 5, for the example structure signal of a kind of document handling apparatus that the embodiment of the present invention provides
Figure.Equipment described in the present embodiment, including: at least one input equipment 1000;At least one output
Equipment 2000;At least one processor 3000, such as CPU;With memorizer 4000, above-mentioned input equipment
1000, outut device 2000, processor 3000 and memorizer 4000 are connected by bus 5000.
Wherein, above-mentioned input equipment 1000 concretely contact panel, physical button or mouse.
Above-mentioned outut device 2000 concretely display screen.
Above-mentioned memorizer 4000 can be high-speed RAM memorizer, it is possible to for non-labile memorizer
(non-volatile memory), such as disk memory.Above-mentioned memorizer 4000 is used for storing batch processing
Code, above-mentioned input equipment 1000, outut device 2000 and processor 3000 are used for calling memorizer 4000
The program code of middle storage, performs to operate as follows:
Above-mentioned processor 3000, is used for:
Obtain the memory size of file to be encrypted;
When described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of fritter,
Wherein, described N is the integer more than 1;
M fritter in described N number of fritter is encrypted according to the first cipher mode, and to described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, and described M is
Positive integer less than described N.
Alternatively, described file to be encrypted is divided into N number of fritter by above-mentioned processor 3000, including:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal;
Or,
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
Alternatively, described file to be encrypted is divided into N number of fritter by above-mentioned processor 3000, including:
When described memory size is even number, described file to be encrypted is divided into that memory size is equal first
Divide and Part II;
Described Part I is divided into P the fritter that memory size is equal, and described Part II is divided into interior
Depositing the most unequal N-P the fritter of size, wherein, described P is the positive integer less than described N.
Alternatively, to be described Part I preset size according to first to described P is averaged after piecemeal and obtains
Fritter number, or, described P is the numerical value that user specifies.
Alternatively, above-mentioned processor 3000 to M fritter in described N number of fritter according to the first encryption side
Formula is encrypted, including:
Each fritter in M fritter in described N number of fritter is respectively divided into K fritter, obtains
M*K fritter, wherein, described K is the integer more than 1, and wherein, described K is the number specified by user
Value, or, described K is described each fritter to be preset size according to second and is averaged after piecemeal and obtains
Fritter number;
Part fritter in described M*K fritter is encrypted according to the first AES, and by described
In M*K fritter, other fritters in addition to described part fritter are encrypted according to the second AES.
Alternatively, above-mentioned processor 3000 is by other in addition to described M fritter in described N number of fritter
Fritter is encrypted according to the second cipher mode, including:
Other fritters in addition to described M fritter in described N number of fritter are carried out according to XOR AES
Encryption.
Alternatively, described N is that described file to be encrypted is preset according to the 3rd and obtained after size carries out piecemeal
Fritter number, or, described N is the numerical value that user specifies;
Described M is the numerical value that user specifies, and described M fritter is random described in described N number of fritter
M, or, described M fritter is M the fritter selected according to the order pre-set.
Input equipment 1000, outut device 2000 and place in implementing, described in the embodiment of the present invention
Reason device 3000 can perform the first embodiment of a kind of file encrypting method, the second reality that the embodiment of the present invention provides
Execute the implementation described in example and the 3rd embodiment, it is possible to perform a kind of literary composition that the embodiment of the present invention provides
Described in the embodiment of part encryption device implementation, do not repeat them here.
The embodiment of the present invention also provides for a kind of computer-readable storage medium, and wherein, this computer-readable storage medium can be deposited
Containing program, this program includes any one file encrypting method described in said method embodiment when performing
Part or all of step.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, in certain embodiment the most in detail
The part stated, may refer to the associated description of other embodiments.
It should be noted that for aforesaid each method embodiment, in order to be briefly described, therefore it is all stated
For a series of combination of actions, but those skilled in the art should know, the present invention is not by described
The restriction of sequence of movement, because according to the present invention, some step can use other orders or carry out simultaneously.
Secondly, those skilled in the art also should know, embodiment described in this description belongs to be preferable to carry out
Example, necessary to involved action and the module not necessarily present invention.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, in certain embodiment the most in detail
The part stated, may refer to the associated description of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device, can be passed through it
Its mode realizes.Such as, device embodiment described above is only schematically, the most described list
The division of unit, is only a kind of logic function and divides, and actual can have other dividing mode, example when realizing
As multiple unit or assembly can in conjunction with or be desirably integrated into another system, or some features can be ignored,
Or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can
To be the INDIRECT COUPLING by some interfaces, device or unit or communication connection, can be electrical or other
Form.
The described unit illustrated as separating component can be or may not be physically separate, as
The parts that unit shows can be or may not be physical location, i.e. may be located at a place, or
Can also be distributed on multiple NE.Can select therein some or all of according to the actual needs
Unit realizes the purpose of the present embodiment scheme.
It addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit,
Can also be that unit is individually physically present, it is also possible to two or more unit are integrated in a unit
In.Above-mentioned integrated unit both can realize to use the form of hardware, it would however also be possible to employ SFU software functional unit
Form realizes.
If described integrated unit realizes using the form of SFU software functional unit and as independent production marketing or
During use, can be stored in a computer read/write memory medium.Based on such understanding, the present invention
The part that the most in other words prior art contributed of technical scheme or this technical scheme whole or
Part can embody with the form of software product, and this computer software product is stored in a storage medium
In, including some instructions with so that a computer equipment (can be personal computer, server or net
Network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage
Medium includes: USB flash disk, read only memory (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), portable hard drive, magnetic disc or CD etc. are various can store program code
Medium.
The above, above example only in order to technical scheme to be described, is not intended to limit;To the greatest extent
The present invention has been described in detail by pipe with reference to previous embodiment, and those of ordinary skill in the art should manage
Solve: the technical scheme described in foregoing embodiments still can be modified by it, or to wherein part
Technical characteristic carries out equivalent;And these amendments or replacement, do not make the essence of appropriate technical solution take off
Scope from various embodiments of the present invention technical scheme.
Claims (10)
1. a file encrypting method, it is characterised in that including:
Obtain the memory size of file to be encrypted;
When described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of fritter,
Wherein, described N is the integer more than 1;
M fritter in described N number of fritter is encrypted according to the first cipher mode, and to described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, and described M is
Positive integer less than described N.
Method the most according to claim 1, it is characterised in that described described file to be encrypted is divided into
N number of fritter, including:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal;
Or,
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
Method the most according to claim 1, it is characterised in that described described file to be encrypted is divided into
N number of fritter, including:
When described memory size is even number, described file to be encrypted is divided into that memory size is equal first
Divide and Part II;
Described Part I is divided into P the fritter that memory size is equal, and described Part II is divided into interior
Depositing the most unequal N-P the fritter of size, wherein, described P is the positive integer less than described N.
Method the most according to claim 3, it is characterised in that described P be described Part I by by
Preset size according to first to be averaged after piecemeal the fritter number obtained, or, described P is that user specifies
Numerical value.
5. according to the method described in any one of Claims 1-4, it is characterised in that described to described N number of
M fritter in fritter is encrypted according to the first cipher mode, including:
Each fritter in M fritter in described N number of fritter is respectively divided into K fritter, obtains
M*K fritter, wherein, described K is the integer more than 1, and wherein, described K is the number specified by user
Value, or, described K is described each fritter to be preset size according to second and is averaged after piecemeal and obtains
Fritter number;
Part fritter in described M*K fritter is encrypted according to the first AES, and by described
In M*K fritter, other fritters in addition to described part fritter are encrypted according to the second AES.
6. according to the method described in any one of Claims 1-4, it is characterised in that described by described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, including:
Other fritters in addition to described M fritter in described N number of fritter are carried out according to XOR AES
Encryption.
7. according to the method described in any one of Claims 1-4, it is characterised in that described N be described in treat
Encryption file is preset, according to the 3rd, the fritter number obtained after size carries out piecemeal, or, described N is for using
The numerical value that family is specified;
Described M is the numerical value that user specifies, and described M fritter is random described in described N number of fritter
M, or, described M fritter is M the fritter selected according to the order pre-set.
8. a document encrypting apparatus, it is characterised in that including:
Acquiring unit, for obtaining the memory size of file to be encrypted;
Blocking unit, for when described memory size is more than the first predetermined threshold value, by described file to be encrypted
Being divided into N number of fritter, wherein, described N is the integer more than 1;
First ciphering unit, for pressing M fritter in described N number of fritter of described blocking unit piecemeal
It is encrypted according to the first cipher mode;
Second ciphering unit, for pressing other fritters in addition to described M fritter in described N number of fritter
Being encrypted according to the second cipher mode, described M is the positive integer less than described N.
Device the most according to claim 8, it is characterised in that described blocking unit specifically for:
When described memory size is divided exactly by the second predetermined threshold value, described file to be encrypted is divided into N number of fritter,
And the memory size of each fritter is equal;
Or,
When described memory size is not divided exactly by described second predetermined threshold value, described file to be encrypted is divided into N
Individual fritter, wherein, in the middle part of described N number of fritter, the memory size of subdividing is equal.
10. a file encryption equipment, it is characterised in that including: processor, memorizer, communication interface
And bus;
Described processor, described memorizer and described communication interface are connected by described bus and complete each other
Communication;Described memorizer storage executable program code;Described processor is by reading in described memorizer
The executable program code of storage runs the program corresponding with described executable program code, for execution
A kind of data processing method;Wherein, described method includes:
Obtain the memory size of file to be encrypted;
When described memory size is more than the first predetermined threshold value, described file to be encrypted is divided into N number of fritter,
Wherein, described N is the integer more than 1;
M fritter in described N number of fritter is encrypted according to the first cipher mode, and to described N number of
In fritter, other fritters in addition to described M fritter are encrypted according to the second cipher mode, and described M is
Positive integer less than described N.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610201683.6A CN105893857A (en) | 2016-03-31 | 2016-03-31 | File encryption method, device and equipment |
PCT/CN2016/108929 WO2017166856A1 (en) | 2016-03-31 | 2016-12-07 | Method, device and equipment for file encryption |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610201683.6A CN105893857A (en) | 2016-03-31 | 2016-03-31 | File encryption method, device and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105893857A true CN105893857A (en) | 2016-08-24 |
Family
ID=57013278
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610201683.6A Pending CN105893857A (en) | 2016-03-31 | 2016-03-31 | File encryption method, device and equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105893857A (en) |
WO (1) | WO2017166856A1 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106982116A (en) * | 2017-04-26 | 2017-07-25 | 南通大学 | A kind of local file encryption method of the AES based on reversible logic circuits |
CN107222488A (en) * | 2017-06-16 | 2017-09-29 | 康美健康云服务有限公司 | A kind of image ciphering storage method |
WO2017166856A1 (en) * | 2016-03-31 | 2017-10-05 | 北京金山安全软件有限公司 | Method, device and equipment for file encryption |
CN108427509A (en) * | 2018-01-16 | 2018-08-21 | 芯盾网安(北京)科技发展有限公司 | The method for sending voice by input method |
CN109033867A (en) * | 2018-06-29 | 2018-12-18 | 上海爱优威软件开发有限公司 | A kind of file encrypting method and system |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113098843B (en) * | 2021-03-08 | 2022-06-14 | 中国地质大学(武汉) | High-speed random sampling encryption method for geological and geographical big data |
CN117633841A (en) * | 2023-12-12 | 2024-03-01 | 上海合芯数字科技有限公司 | Encryption module controller, encryption module, encryption system, and encryption processing method |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070028099A1 (en) * | 2003-09-11 | 2007-02-01 | Bamboo Mediacasting Ltd. | Secure multicast transmission |
CN102693398A (en) * | 2012-05-09 | 2012-09-26 | 深圳大学 | Data encryption method and system |
CN103268452A (en) * | 2013-05-31 | 2013-08-28 | 福建伊时代信息科技股份有限公司 | Method and device for file processing |
CN103607393A (en) * | 2013-11-21 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Data safety protection method based on data partitioning |
CN104091129A (en) * | 2014-06-26 | 2014-10-08 | 腾讯科技(深圳)有限公司 | Data processing method and device |
CN104205117A (en) * | 2014-04-10 | 2014-12-10 | 华为技术有限公司 | Device file encryption and decryption method and device |
CN104378422A (en) * | 2014-11-13 | 2015-02-25 | 中国联合网络通信有限公司保定市分公司 | Mobile terminal and file transmission method and system thereof |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105893857A (en) * | 2016-03-31 | 2016-08-24 | 北京金山安全软件有限公司 | File encryption method, device and equipment |
-
2016
- 2016-03-31 CN CN201610201683.6A patent/CN105893857A/en active Pending
- 2016-12-07 WO PCT/CN2016/108929 patent/WO2017166856A1/en active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070028099A1 (en) * | 2003-09-11 | 2007-02-01 | Bamboo Mediacasting Ltd. | Secure multicast transmission |
CN102693398A (en) * | 2012-05-09 | 2012-09-26 | 深圳大学 | Data encryption method and system |
CN103268452A (en) * | 2013-05-31 | 2013-08-28 | 福建伊时代信息科技股份有限公司 | Method and device for file processing |
CN103607393A (en) * | 2013-11-21 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Data safety protection method based on data partitioning |
CN104205117A (en) * | 2014-04-10 | 2014-12-10 | 华为技术有限公司 | Device file encryption and decryption method and device |
CN104091129A (en) * | 2014-06-26 | 2014-10-08 | 腾讯科技(深圳)有限公司 | Data processing method and device |
CN104378422A (en) * | 2014-11-13 | 2015-02-25 | 中国联合网络通信有限公司保定市分公司 | Mobile terminal and file transmission method and system thereof |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017166856A1 (en) * | 2016-03-31 | 2017-10-05 | 北京金山安全软件有限公司 | Method, device and equipment for file encryption |
CN106982116A (en) * | 2017-04-26 | 2017-07-25 | 南通大学 | A kind of local file encryption method of the AES based on reversible logic circuits |
CN106982116B (en) * | 2017-04-26 | 2020-01-17 | 南通大学 | Local file encryption method of AES (advanced encryption Standard) based on reversible logic circuit |
CN107222488A (en) * | 2017-06-16 | 2017-09-29 | 康美健康云服务有限公司 | A kind of image ciphering storage method |
CN108427509A (en) * | 2018-01-16 | 2018-08-21 | 芯盾网安(北京)科技发展有限公司 | The method for sending voice by input method |
CN109033867A (en) * | 2018-06-29 | 2018-12-18 | 上海爱优威软件开发有限公司 | A kind of file encrypting method and system |
Also Published As
Publication number | Publication date |
---|---|
WO2017166856A1 (en) | 2017-10-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105893857A (en) | File encryption method, device and equipment | |
CN107819569B (en) | The encryption method and terminal device of log-on message | |
US10091000B2 (en) | Techniques for distributing secret shares | |
CN107707347B (en) | User key backup method and device and user key importing method and device | |
EP3136284B1 (en) | Personal information anonymization method, personal information anonymization program, and information processing apparatus | |
EP3940568B1 (en) | Image privacy protection method, apparatus and device | |
CN108400868B (en) | Seed key storage method and device and mobile terminal | |
CN107728878A (en) | Display methods, terminal and the computer-readable recording medium of application icon | |
CN104036200B (en) | Data classification and encryption method, system and mobile terminal based on Finger-print labelling method | |
CN105320613A (en) | Systems and methods for dynamic data storage | |
Rossit et al. | A non-permutation flowshop scheduling problem with lot streaming: A Mathematical model | |
CN107122634A (en) | The method for reinforcing and protecting and device of software installation bag | |
CN106209895A (en) | A kind of data encryption and transmission method and intelligent terminal | |
CN107122632A (en) | The encryption method and device of software installation bag | |
KR102546008B1 (en) | Method for parallel processing of encription algorithm using multi cpu and gpu | |
CN104579637B (en) | Key generation method and device | |
CN110245520A (en) | A kind of file enciphering method, file encryption device and terminal device | |
CN104915583A (en) | Interface decryption processing method and mobile terminal | |
CN110990846B (en) | Information storage method, device and computer readable storage medium | |
CN111368322B (en) | File decryption method and device, electronic equipment and storage medium | |
CN113014373A (en) | Data encryption method, device, equipment and medium in homomorphic calculation | |
CN106775894A (en) | The operation method and terminal of a kind of application program | |
CN107358125B (en) | Processor | |
CN105740692B (en) | A kind of unlocking method and terminal | |
CN116186649A (en) | Cross-system access method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160824 |
|
RJ01 | Rejection of invention patent application after publication |