[go: up one dir, main page]

CN107247906A - A kind of encryption method and device for data - Google Patents

A kind of encryption method and device for data Download PDF

Info

Publication number
CN107247906A
CN107247906A CN201710524051.8A CN201710524051A CN107247906A CN 107247906 A CN107247906 A CN 107247906A CN 201710524051 A CN201710524051 A CN 201710524051A CN 107247906 A CN107247906 A CN 107247906A
Authority
CN
China
Prior art keywords
function
template
encryption
type
data
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.)
Granted
Application number
CN201710524051.8A
Other languages
Chinese (zh)
Other versions
CN107247906B (en
Inventor
周志刚
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangxi Minghang Information Technology Co ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710524051.8A priority Critical patent/CN107247906B/en
Publication of CN107247906A publication Critical patent/CN107247906A/en
Application granted granted Critical
Publication of CN107247906B publication Critical patent/CN107247906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a kind of encryption method and device for data, the encryption method therein includes:Logical operation function for encryption is write based on preset function template, the logical operation function for being used to encrypt includes at least two and calculates function, and the preset function template includes at least one template type;The different calculating functions in the logical operation function are combined, first function is obtained;The template type is changed, and based on amended template type and first function generation encryption function;Based on the encryption function, the data are encrypted.The present invention is solved in the prior art because the AES for data encryption is easily cracked, and there is the relatively low technical problem of security, realizes the technique effect for the security for improving data encryption.

Description

A kind of encryption method and device for data
Technical field
The present invention relates to technical field of information processing, more particularly to a kind of encryption method and device for data.
Background technology
With the development of Internet technology, the safety of data is also more and more important, at present would generally be using ripe encryption Algorithm data is encrypted protection.
However, it has been found that hacker is when cracking AES, it will usually check that it is used by decompiling What AES, and can judge whether above-mentioned AES is existing ripe AES first, and due to existing Data ciphering method uses existing ripe AES, and such hacker easily cracks the AES.
It can be seen that, in the prior art, because the AES for data encryption is easily cracked, there is security relatively low Technical problem.
The content of the invention
The present invention provides a kind of encryption method and device for data, to solve in the prior art due to for data The AES of encryption is easily cracked, and there is the relatively low technical problem of security.
First aspect present invention provides a kind of encryption method for data, and methods described includes:
Logical operation function for encryption, the logical operation function for being used to encrypt are write based on preset function template Function is calculated including at least two, the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
Alternatively, in the modification template type, and given birth to based on amended template type and the first function Into after encryption function, methods described also includes:
Based on the preset function template, the encryption function is converted into the mould corresponding with the preset function template First encryption function of plate type function.
Alternatively, the template type includes at least one data type;The modification template type, and be based on repairing Template type and first function generation encryption function after changing, including:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of multiple codes comprising the first function is generated, will The encrypted code is used as the encryption function.
Alternatively, the calculating function is in addition function, SUbtractive function, XOR function and shift operation function It is a kind of.
Based on same inventive concept, second aspect of the present invention provides a kind of encryption device for data, the dress Put including:
Module is write, it is described to be used to encrypt for writing the logical operation function for encryption based on preset function template Logical operation function include at least two and calculate functions, the preset function template includes at least one template type;
Composite module, for combining the different calculating functions in the logical operation function, obtains first function;
Generation module, is given birth to for changing the template type, and based on amended template type and the first function Into encryption function;
Encrypting module, for based on the encryption function, the data to be encrypted.
Optionally, described device also includes processing module, for changing the template type described, and is based on after modification Template type and the first function generation encryption function after, based on the preset function template, by the encryption function It is converted into the first encryption function of the stencil function type corresponding with the preset function template.
Optionally, the template type includes at least one data type;The generation module is additionally operable to:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of multiple codes comprising the first function is generated, will The encrypted code is used as the encryption function.
Optionally, the calculating function is in addition function, SUbtractive function, XOR function and shift operation function It is a kind of.
Based on same inventive concept, third aspect present invention provides a kind of computer-readable recording medium, deposited thereon Computer program is contained, the program realizes following steps when being executed by processor:
Logical operation function for encryption, the logical operation function for being used to encrypt are write based on preset function template Function is calculated including at least two, the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
Based on same inventive concept, fourth aspect present invention provides a kind of computer equipment, including memory, processing Device and storage on a memory and the computer program that can run on a processor, are realized during the computing device described program Following steps:
Logical operation function for encryption, the logical operation function for being used to encrypt are write based on preset function template Function is calculated including at least two, the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
The one or more technical schemes provided in the embodiment of the present invention, have at least the following technical effects or advantages:
The encryption method of data provided in an embodiment of the present invention, is primarily based on preset function template and writes patrolling for encryption Operation function is collected, the logical operation function for being used to encrypt includes at least two and calculates functions, the preset function template bag At least one template type is included, the different calculating functions in the logical operation function is then combined, obtains first function, and repair Change the template type, and add based on amended template type and first function generation encryption function, then based on described The data are encrypted by close function.In the method provided due to the present invention, on the one hand, the logical operation letter for encryption Number is write based on preset function template, and is combined with the different calculating functions in the logical operation function, obtains first Function, i.e. logical operation function are write based on preset function template, therefore obtained logical operation function is a kind of template Function, and first function is combined with a variety of logical operation functions, can improve the complexity of function, so as to increase the difficulty cracked Degree, on the other hand, can change template type on the basis of first function, and according to amended template type and the first letter Number can generate different encryption functions, i.e., can just generate the code of many parts of encryption functions by changing template type, so In decompiling, then need to carry out decompiling to many parts of encryption function codes, add the size of code of decompiling, it is so further The difficulty for cracking data encryption function is added, so improve the security of data encryption.Solve in the prior art due to AES for data encryption is easily cracked, and there is the relatively low technical problem of security.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the accompanying drawing used required in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of flow chart of encryption method for data in the embodiment of the present invention;
Fig. 2 is a kind of structural representation of encryption device for data in the embodiment of the present invention;
Fig. 3 is the structural representation of Computer readable storage medium storing program for executing of the embodiment of the present invention;
Fig. 4 is the structural representation of Computer equipment of the embodiment of the present invention.
Embodiment
The embodiment of the present application by providing a kind of encryption method and device for data, to solve in the prior art by Easily it is cracked in AES, there is the relatively low technical problem of security.
Technical scheme in the embodiment of the present application, general thought is as follows:
A kind of encryption method for data, methods described includes:Patrolling for encryption is write based on preset function template Operation function is collected, the logical operation function for being used to encrypt includes at least two and calculates functions, the preset function template bag At least one template type is included, the different calculating functions in the logical operation function is then combined, obtains first function, and repair Change the template type, and add based on amended template type and first function generation encryption function, then based on described The data are encrypted by close function.
Because the present invention provides the above method, on the one hand, the logical operation function for encryption is to be based on preset function mould What plate was write, and the different calculating functions in the logical operation function are combined with, obtain first function, i.e. logical operation function Write based on preset function template, therefore obtained logical operation function is a kind of stencil function, and first function group A variety of logical operation functions have been closed, the complexity of function can be improved, so as to increase the difficulty cracked, second aspect, Ke Yi Template type is changed on the basis of first function, and different add can be generated according to amended template type and first function Close function, i.e., can just generate the code of many parts of encryption functions by changing template type, so in decompiling, then need pair Many parts of encryption function codes carry out decompiling, add the size of code of decompiling, which further increases crack data encryption The difficulty of function, so improve the security of data encryption.Solve in the prior art due to the encryption for data encryption Algorithm is easily cracked, and there is the relatively low technical problem of security.
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is A part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Embodiment one
A kind of encryption method for data is present embodiments provided, Fig. 1 is refer to, methods described includes:
Step S101:Logical operation function for encryption is write based on preset function template, it is described to be used for patrolling for encryption Collecting operation function includes at least two calculating functions, and the preset function template includes at least one template type;
Step S102:The different calculating functions in the logical operation function are combined, first function is obtained;
Step S103:The template type is changed, and is added based on amended template type and first function generation Close function;
Step S104:Based on the encryption function, the data are encrypted.
It should be noted that during preset function template is this programming languages of C++, a kind of durability for being used for improving code Programming mode, preset function template is exactly a general template in simple terms, for example, write one and compare size of data Function, function effect is which compares in two data is bigger, it is common practice to be to data type float, int, char, Each type in the types such as double writes a comparison function, but its function content is all identical, is only intended to The data type of the data compared is different.And write a general function then by then can only be used based on preset function template All data types can all be supported.So as to improve programming efficiency, code reuse and universal.And in inventive embodiments The logical operation function for encryption is write by using the characteristic of preset function template, and utilizes preset function pattern plate programming In, the realization of compiler can be to its final code of the template instancesization of each type, so that by changing template type, then Different encrypted codes can be obtained, size of code is added, so as to improve the difficulty cracked, it is ensured that the safety of data encryption Property.
Below, with reference to Fig. 1, the encryption method for data that the application is provided is described in detail:
First, step S101 is performed, the logical operation function for encryption is write based on preset function template, it is described to be used for The logical operation function of encryption includes at least two and calculates function, and the preset function template includes at least one template type.
Specifically, logical operation function has a variety of, for example addition function, SUbtractive function, multiplication function etc., this implementation Logical operation function in example at least includes two kinds, and the preset function template includes at least one template type, specific In implementation process, logical operation function can be write using the preset function template of various template type is included.
In order to illustrate more clearly of the logical operation function write based on preset function template for encryption, below with one It is discussed in detail exemplified by specific preset function template, the general type of preset function template first is as follows:
template<Class data type parameters identifier 1 ..., class data type parameters identifiers n>
<Return type><Function name>(parameter list)
{
Function body
}
Wherein, template is non-data type parameters in the keyword of preset function template statement, angle brackets below Identifier, can have one or more, different data type parameters identifiers to represent different template types, wherein class For the keyword of template type.Then non-function in the return type of function, function name and parameter list, braces is followed successively by below Body.Preset function template is a general template, and data type parameters identifier is actually a type parameter, is made During with preset function template, the data type that the above-mentioned type parameter is instantiated as determining.After type parameter is instantiated Parameter is referred to as template argument, and the function instantiated with template argument is referred to as stencil function.I.e. by by preset function template instances Change, then can obtain the corresponding stencil function of preset function template.Lower mask body introduces what several utilization stencil functions were write The method of logical operation function.
The first, add operation function is write using stencil function.
Wherein, template<Class T, class T1, class T2, class T3, class T4, class T5>It is The statement of one stencil function, that is, notify the template type of the compiler stencil function to have 6, the number of template type can root It is configured according to being actually needed.In above-mentioned function, inline is represented directly deploy during call function, and data type is used The type that template T is represented, and data type is modified using const, pData and the formal parameter that add is the function, The type represented using T, and modified with const, the effect of the function is that this function is to add one to parameter pData Add numerical value, if data are encrypted using the addition function, pData is initial data, and using the base in pData Initial data is encrypted plus an add numerical value on plinth.
Second, subtraction function is write using stencil function.
The effect of the function is that an add numerical value is subtracted to parameter pData, and SubData is function name, other and addition Operation function is identical, will not be repeated here.
The third, XOR function is write using stencil function.
The effect of the function is that XorData is function name to one add numerical value of parameter pData XORs, other and addition Operation function is identical, will not be repeated here.
4th kind, shift left operation function is write using stencil function.
The effect of the function is that an add numerical value is moved to left to parameter pData, and LeftData is function name, other with adding Method operation function is identical, will not be repeated here.
5th kind, shift left operation function is write using stencil function.
The effect of the function is that an add numerical value is moved to right to parameter pData, and RightData is function name, other with adding Method operation function is identical, will not be repeated here.
Similarly, other logical operation functions can also be designed, such as multiplying, division arithmetic.
Then step S102 is performed:The different calculating functions in the logical operation function are combined, first function is obtained;
In specific implementation process, the first letter can be obtained by the logical operation function in combination step S101 Number, the mode of combination can have a variety of, such as combination additional calculation function and XOR calculating function, combination subtraction function, Subtraction function, function etc. is moved to left, and for a variety of logical operation functions of combination, can be by adjusting each logic Operation function calls order to obtain different first functions, for example, combination additional calculation function and XOR calculate function First function, it is one kind that addition, which is first carried out, and performs subtraction again, and it is then another first letter that subtraction, which is first carried out, and performs addition again Number.The logical operation function different by combining obtains first function, can improve the complexity of first function.
The implementation method of first function is introduced with a specific example below, it is assumed that need to be sent to client service The user behavior data of device is encrypted.Its initial data is:PData=" first page test Hit1234566.... ", the initial data is long character string, it is however generally that client when being communicated with server, Server can issue a KEY value and be used for that initial data is encrypted, and this KEY value is also a long character string, it is assumed that KEY: PKey=" abcdef1234567899........... ", then the implementation method of first function is as follows:The logical operation letter of combination Several orders is addition function, SUbtractive function, XOR function, moves to left function etc., may then pass through a circulation to realize The function of first function:
For int i=0;i<pDataLen;i++;
{
AddData<int,char,int,int,int,int>(pData[i],pKey[i]);
SubData<int,char,int,int,int,int>(pData[i],pKey[i]);
XorData<int,char,int,int,int,int>(pData[i],pKey[i]);
LeftData<int,char,int,int,int,int>(pData[i],pKey[i]);
}
Wherein, pDataLen refers to the length of data, and i is loop parameter, and initial value is that 0, pData [0] is initial data The first digit, i.e., " f ", pKey [0] be " a ", then be first carried out " f+a ", can be by being converted into specific implementation process ASCII (American Standard Code for Information Interchange, ASCII American Standard Code for Information Interchange generation Code) calculated.Above-mentioned code this operation be pData data are added with pKey data, subtracted each other, XOR, a left side Operation is moved to be encrypted.
On the basis of the above, using generic function come calling logic operation function, so as to generate first function.
Wherein, EncodeData1 is the function name of first function, and remaining parameter declaration has hereinbefore made correlation Explain with illustrating, will not be repeated here, very huge function generation can be generated for the final compiler of EncodeData1 functions Code, and the stencil function wherein called can all generate a different logical operation function.
With above-mentioned EncodeData1 functions accordingly, it can be deduced that the inverse process of decryption function, i.e. AES.Example If AES carries out addition to data, then decipherment algorithm is then to carry out subtraction, and it is decipherment algorithm that order, which is turned around,.
For example it is then for function EncodeData1 decipherment algorithm:
Next step S103 is performed:The template type is changed, and based on amended template type and described first Function generates encryption function.
Optionally, the template type includes at least one data type;The modification template type, and be based on repairing Template type and first function generation encryption function after changing, including:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of the code of multiple first functions is generated, will be described Encrypted code is used as the encryption function.
Specifically, it is foregoing to have obtained the different first functions for calculating function of combination, it is using default due to calculating function Function template is write, and preset function template includes at least one template type, then can be by changing template type Mode obtain multiple encrypted codes, contain the code of first function in the encrypted code.
In specific implementation process, template parameter T1, T2, T3, T4, T5 in step S101 can be carried out different Instantiation, to realize the modification to template type, for amended template type, compiler can all regenerate a addition Code, so as to write a function, any a variety of encrypted codes can be then generated by changing template type.Implement It is as follows:
Assuming that template type T is int types, the data to be encrypted are 1, and addend is 2, then calls the knot of add operation function It is really as follows:
Int a=1;
Int b=2;
Int c=AddData<int,int,int,int,int,int>(a,b);
Now, compiler can generate a type for int, int, int, int, int, int addition code.
If T1 type is revised as into char types, call the result of add operation function as follows:
Int c=AddData<int,char,int,int,int,int>(a,b);
Likewise, compiler can generate a type for int, char, int, int, int, int addition code.
The result return for calling above two function is 3, but arbitrarily changes a kind of template type, and compiler can all give birth to Into a addition code, for example:
Int c=AddData<int,char,int,int,int,int>(a,b);
Int c=AddData<int,char,char,int,int,int>(a,b);
Int c=AddData<int,char,float,int,int,int>(a,b);
And in C Plus Plus, specific template type has int, char, float, double, int*, customization type etc. Deng, therefore template type is infinite, and by changing any one template type, then different a codes can be obtained, Size of code is so considerably increased, difficulty is cracked so as to improve.
Step S104 is performed again:Based on the encryption function, the data are encrypted.
Specifically, encryption function is generated based on amended template type and the first function in step S103, Data can be then encrypted by encryption function, because modification template type can then obtain different encryption functions Code, and template type be it is infinite multiple, each template can be changed, therefore the code of obtained encryption function is very huge Big, if to be cracked to encryption function, the code of all encryption functions of decompiling is needed, has so added and has cracked number According to the difficulty of encryption function, so improve the security of data encryption.
Alternatively, in order to further improve the complexity of encryption function, changing the template type, and based on modification after Template type and first function generation encryption function, methods described also includes:
Based on the preset function template, the encryption function is converted into the mould corresponding with the preset function template First encryption function of plate type function.
Specifically, because logical operation function is write based on preset function template, adjusted by generic function Use logical operation function, you can to realize the function of stencil function, can be by order to further improve the complexity of encryption function Encryption function is converted into corresponding stencil function, and the stencil function is the further complication on the basis of encryption function, i.e., First encryption function.In specific implementation process, in the first encryption function of stencil function type, the template type of use with Logical operation function is consistent, and is implemented as follows:
template<class T,class T1,class T2,class T3,class T4,class T5>
void EncodeData(T const&pData,T const&add)
{
AddData<T,T1,T2,T3,T4,T5>(pData[i],pKey[i]);
SubData<T,T1,T2,T3,T4,T5>(pData[i],pKey[i]);
XorData<T,T1,T2,T3,T4,T5>(pData[i],pKey[i]);
}
Now, can be to template type if template parameter T1, T2, T3, T4, T5 of modification EncodeData functions Modify, compiler can all generate portion EncodeData code for each type, so as to improve size of code, also increase Add the complexity of code, difficulty is cracked so adding, improve the security of data encryption.
Optionally, the calculating function is in addition function, SUbtractive function, XOR function and shift operation function It is a kind of.
Based on same inventive concept, present invention also offers a kind of dress corresponding with encryption methods for data Put, referring specifically to embodiment two
Embodiment two
The embodiments of the invention provide a kind of encryption device for data, Fig. 2 is referred to, described device includes:
Module 201 is write, it is described to be used to add for writing the logical operation function for encryption based on preset function template Close logical operation function includes at least two and calculates function, and the preset function template includes at least one template type;
Composite module 202, for combining the different calculating functions in the logical operation function, obtains first function;
Generation module 203, for changing the template type, and based on amended template type and the first function Generate encryption function;
Encrypting module 204, for based on the encryption function, the data to be encrypted.
Optionally, described device also includes processing module, for changing the template type described, and is based on after modification Template type and the first function generation encryption function after, based on the preset function template, by the encryption function It is converted into the first encryption function of the stencil function type corresponding with the preset function template.
Optionally, the template type includes at least one data type;The generation module is additionally operable to:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of multiple codes comprising the first function is generated, will The encrypted code is used as the encryption function.
Optionally, the calculating function is in addition function, SUbtractive function, XOR function and shift operation function It is a kind of.
Based on same inventive concept, present invention also offers a kind of calculating corresponding with encryption methods for data Machine readable storage medium storing program for executing, referring specifically to embodiment three.
Embodiment three
The embodiments of the invention provide a kind of computer-readable recording medium 300, computer program 311 is stored thereon with, The program realizes following steps when being executed by processor:
Logical operation function for encryption, the logical operation function for being used to encrypt are write based on preset function template Function is calculated including at least two, the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
Based on same inventive concept, present invention also offers a kind of calculating corresponding with encryption methods for data Machine equipment, referring specifically to example IV.
Example IV
The embodiments of the invention provide a kind of computer equipment, including memory 401, processor 402 and it is stored in storage On device and the computer program 403 that can run on a processor, following steps are realized during the computing device described program:
Logical operation function for encryption, the logical operation function for being used to encrypt are write based on preset function template Function is calculated including at least two, the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
For convenience of description, the part related to the embodiment of the present invention is illustrate only, particular technique details is not disclosed, please With reference to present invention method part.Memory 401 can be used for storage computer program 403, and above computer program includes Software program, module and data, processor 402 perform the computer program 403 for being stored in memory 401 by running, so that Perform various function application and the data processing of computer equipment.
In specific implementation process, memory 401 can be used for storage software program and module, and processor 402 passes through Operation is stored in the software program and module of memory 401, so as to perform the various function application and number of computer equipment According to processing.Memory 401 can mainly include storing program area and storage data field, wherein, storing program area can store operation system Application program needed for system, at least one function etc.;Storage data field can be stored uses what is created according to computer equipment Data etc..In addition, memory 401 can include high-speed random access memory, nonvolatile memory can also be included, for example At least one disk memory, flush memory device or other volatile solid-state parts.Processor 402 is computer equipment Control centre, using various interfaces and the various pieces of the whole computer equipment of connection, by running or performing storage Software program and/or module in memory 401, and the data being stored in memory 401 are called, perform computer and set Standby various functions and processing data, so as to carry out integral monitoring to computer equipment.Optionally, processor 402 may include one Individual or multiple processing units;It is preferred that, processor 402 can integrated application processor, wherein, application processor mainly handles operation System, user interface and application program etc..
The one or more technical schemes provided in the embodiment of the present invention, have at least the following technical effects or advantages:
The encryption method of data provided in an embodiment of the present invention, is primarily based on preset function template and writes patrolling for encryption Operation function is collected, the logical operation function for being used to encrypt includes at least two and calculates functions, the preset function template bag At least one template type is included, the different calculating functions in the logical operation function is then combined, obtains first function, and repair Change the template type, and add based on amended template type and first function generation encryption function, then based on described The data are encrypted by close function.In the method provided due to the present invention, on the one hand, the logical operation letter for encryption Number is write based on preset function template, and is combined with the different calculating functions in the logical operation function, obtains first Function, i.e. logical operation function are write based on preset function template, therefore obtained logical operation function is a kind of template Function, and first function is combined with a variety of logical operation functions, can improve the complexity of function, so as to increase the difficulty cracked Degree, on the other hand, can change template type on the basis of first function, and according to amended template type and the first letter Number can generate different encryption functions, i.e., can just generate the code of many parts of encryption functions by changing template type, so In decompiling, then need to carry out decompiling to many parts of encryption function codes, add the size of code of decompiling, it is so further The difficulty for cracking data encryption function is added, so improve the security of data encryption.Solve in the prior art due to AES for data encryption is easily cracked, and there is the relatively low technical problem of security.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can be using the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the present invention can be used in one or more computers for wherein including computer usable program code The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram are described.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which is produced, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
, but those skilled in the art once know basic creation although preferred embodiments of the present invention have been described Property concept, then can make other change and modification to these embodiments.So, appended claims are intended to be construed to include excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without departing from this hair to the embodiment of the present invention The spirit and scope of bright embodiment.So, if these modifications and variations of the embodiment of the present invention belong to the claims in the present invention And its within the scope of equivalent technologies, then the present invention is also intended to comprising including these changes and modification.

Claims (10)

1. a kind of encryption method for data, it is characterised in that methods described includes:
Logical operation function for encryption is write based on preset function template, the logical operation function for being used to encrypt includes At least two calculate function, and the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
2. the method as described in claim 1, it is characterised in that in the modification template type, and based on amended After template type and first function generation encryption function, methods described also includes:
Based on the preset function template, the encryption function is converted into the template letter corresponding with the preset function template First encryption function of several classes of types.
3. the method as described in claim 1, it is characterised in that the template type includes at least one data type, described The template type is changed, and based on amended template type and first function generation encryption function, including:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of multiple codes comprising the first function is generated, will be described Encrypted code is used as the encryption function.
4. the method as described in any one of claim 1-3 claim, it is characterised in that the calculating function is addition letter One kind in number, SUbtractive function, XOR function and shift operation function.
5. a kind of encryption device for data, it is characterised in that described device includes:
Module is write, it is described to be used for patrolling for encryption for writing the logical operation function for encryption based on preset function template Collecting operation function includes at least two calculating functions, and the preset function template includes at least one template type;
Composite module, for combining the different calculating functions in the logical operation function, obtains first function;
Generation module, is added for changing the template type, and based on amended template type and first function generation Close function;
Encrypting module, for based on the encryption function, the data to be encrypted.
6. device as claimed in claim 5, it is characterised in that described device also includes processing module, in the modification The template type, and be based on after amended template type and first function generation encryption function, based on described pre- If function template, first that the encryption function is converted into the stencil function type corresponding with the preset function template adds Close function.
7. device as claimed in claim 5, it is characterised in that the template type includes at least one data type;It is described Generation module is additionally operable to:
By changing the data type, so as to change the template type, and amended template type is obtained;
According to the amended template type, the encrypted code of multiple codes comprising the first function is generated, will be described Encrypted code is used as the encryption function.
8. the device as described in any one of claim 5-7 claim, it is characterised in that the calculating function is addition letter One kind in number, SUbtractive function, XOR function and shift operation function.
9. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is held by processor Following steps are realized during row:
Logical operation function for encryption is write based on preset function template, the logical operation function for being used to encrypt includes At least two calculate function, and the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
10. a kind of computer equipment, including memory, processor and storage are on a memory and the meter that can run on a processor Calculation machine program, it is characterised in that realize following steps during the computing device described program:
Logical operation function for encryption is write based on preset function template, the logical operation function for being used to encrypt includes At least two calculate function, and the preset function template includes at least one template type;
The different calculating functions in the logical operation function are combined, first function is obtained;
The template type is changed, and based on amended template type and first function generation encryption function;
Based on the encryption function, the data are encrypted.
CN201710524051.8A 2017-06-30 2017-06-30 A kind of encryption method and device for data Active CN107247906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710524051.8A CN107247906B (en) 2017-06-30 2017-06-30 A kind of encryption method and device for data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710524051.8A CN107247906B (en) 2017-06-30 2017-06-30 A kind of encryption method and device for data

Publications (2)

Publication Number Publication Date
CN107247906A true CN107247906A (en) 2017-10-13
CN107247906B CN107247906B (en) 2019-09-10

Family

ID=60013704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710524051.8A Active CN107247906B (en) 2017-06-30 2017-06-30 A kind of encryption method and device for data

Country Status (1)

Country Link
CN (1) CN107247906B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096266A (en) * 2019-05-13 2019-08-06 上海优扬新媒信息技术有限公司 A kind of characteristic processing method and device
CN115021908A (en) * 2022-05-30 2022-09-06 中电长城网际系统应用有限公司 Deprivation method, device, computer equipment and medium of triple composite function

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718765A (en) * 2016-01-26 2016-06-29 国家信息技术安全研究中心 Method for achieving code obfuscation through finite automaton
CN106452776A (en) * 2015-08-12 2017-02-22 航天信息股份有限公司 Data encryption method
US20170076114A1 (en) * 2015-09-11 2017-03-16 Infosys Limited Method and system for masking of cheque image based on user access privileges
CN106709373A (en) * 2017-01-18 2017-05-24 北京许继电气有限公司 Method for achieving encryption of self-defining function of self-controlled database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106452776A (en) * 2015-08-12 2017-02-22 航天信息股份有限公司 Data encryption method
US20170076114A1 (en) * 2015-09-11 2017-03-16 Infosys Limited Method and system for masking of cheque image based on user access privileges
CN105718765A (en) * 2016-01-26 2016-06-29 国家信息技术安全研究中心 Method for achieving code obfuscation through finite automaton
CN106709373A (en) * 2017-01-18 2017-05-24 北京许继电气有限公司 Method for achieving encryption of self-defining function of self-controlled database

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096266A (en) * 2019-05-13 2019-08-06 上海优扬新媒信息技术有限公司 A kind of characteristic processing method and device
CN110096266B (en) * 2019-05-13 2023-12-22 度小满科技(北京)有限公司 Feature processing method and device
CN115021908A (en) * 2022-05-30 2022-09-06 中电长城网际系统应用有限公司 Deprivation method, device, computer equipment and medium of triple composite function

Also Published As

Publication number Publication date
CN107247906B (en) 2019-09-10

Similar Documents

Publication Publication Date Title
CN109831298B (en) Method, node and storage medium for securely updating keys in blockchain
CN108614960B (en) A JavaScript virtualization protection method based on front-end bytecode technology
US8935539B2 (en) System and method for revising boolean and arithmetic operations
JP5643894B2 (en) System and method for dynamically variable timing arithmetic path to withstand side channel attacks and repetitive activation attacks
JP6253862B1 (en) Information processing apparatus, information processing method, and information processing program
CN106873949A (en) Code generating method and its device
US9721120B2 (en) Preventing unauthorized calls to a protected function
CN110825363B (en) Intelligent contract acquisition method and device, electronic equipment and storage medium
KR102352066B1 (en) Method of protecting secret data when used in a cryptographic algorithm
CN107133524A (en) A kind of date storage method and device
CN109409036A (en) Control stream based on redundant code obscures method and device, storage medium and terminal
CN113434148B (en) Decryption-preventing client development compiling method and device, electronic equipment and storage medium
Shrivastava et al. Securator: A fast and secure neural processing unit
CN107247906B (en) A kind of encryption method and device for data
CN112163949A (en) Intelligent contract generation method and device based on contract component imaging
Manikyam Program protection using software based hardware abstraction
CN107180168A (en) File loading, generation method and device, and intelligent terminal
CN111291333A (en) Java application program encryption method and device
CN108932407A (en) A kind of program safety guard method and device
CN107087002A (en) A kind of encipher-decipher method of data, device and electronic equipment
CN110990846B (en) Information storage method, device and computer readable storage medium
CN108415709A (en) A kind of method and device for reinforcing source code based on finite state machine
CN104331827A (en) Transaction configuration generation method and transaction matcher
Li et al. Iollvm: enhance version of ollvm
CN120277697B (en) Data encryption method, device, medium and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230727

Address after: 332000 Room 201, Building 1, next to Sanli Primary School, Sanli Village, Baishuihu Street, Xunyang District, Jiujiang City, Jiangxi Province

Patentee after: Jiangxi Minghang Information Technology Co.,Ltd.

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right