CN107247906B - 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
CN107247906B
CN107247906B CN201710524051.8A CN201710524051A CN107247906B CN 107247906 B CN107247906 B CN 107247906B CN 201710524051 A CN201710524051 A CN 201710524051A CN 107247906 B CN107247906 B CN 107247906B
Authority
CN
China
Prior art keywords
function
encryption
template
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.)
Active
Application number
CN201710524051.8A
Other languages
Chinese (zh)
Other versions
CN107247906A (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; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

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 methods and device for data, the encryption method therein includes: the logical operation function write based on preset function template for encryption, the logical operation function for encryption includes at least two calculating functions, 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 modified, and encryption function is generated based on modified template type and the first function;Based on the encryption function, the data are encrypted.The present invention solves in the prior art since the Encryption Algorithm for data encryption is easy to be cracked, and there are the lower technical problem of safety, realizes the technical effect for improving the safety of 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 methods and device for data.
Background technique
With the development of internet technology, the safety of data is also more and more important, at present would generally be using mature encryption Algorithm encrypts data.
However, it has been found that hacker is when cracking Encryption Algorithm, it will usually checked by decompiling its using What Encryption Algorithm, and judge first above-mentioned Encryption Algorithm whether be existing maturation Encryption Algorithm, and due to existing Using the Encryption Algorithm of existing maturation, such hacker is easy to crack the Encryption Algorithm data ciphering method.
As it can be seen that in the prior art, since the Encryption Algorithm for data encryption is easy to be cracked, it is lower that there are safeties Technical problem.
Summary 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 Encryption Algorithm of encryption is easy to be cracked, and there are the lower technical problems of safety.
First aspect present invention provides a kind of encryption method for data, which comprises
The logical operation function for encryption, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, the data are encrypted.
Optionally, in the modification template type, and based on modified template type and first function life After encryption function, the method also includes:
Based on the preset function template, the encryption function is converted into mould corresponding with the preset function template First encryption function of plate type function.
Optionally, the template type includes at least one data type;The modification template type, and be based on repairing Template type and the first function after changing generate encryption function, comprising:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of multiple codes comprising the first function is generated, it will The encrypted code is as the encryption function.
Optionally, the calculating function is in addition function, SUbtractive function, XOR operation 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 It sets and includes:
Module is write, it is described for encrypting for writing the logical operation function for encryption based on preset function template Logical operation function include at least two calculating functions, the preset function template includes at least one template type;
Composite module obtains first function for combining the different calculating functions in the logical operation function;
Generation module, for modifying the template type, and it is raw based on modified template type and the first function At encryption function;
Encrypting module encrypts the data for being based on the encryption function.
Optionally, described device further includes processing module, for modifying the template type described, and is based on after modifying Template type and the first function generate encryption function after, be based on the preset function template, by the encryption function It is converted into the first encryption function of stencil function type corresponding with the preset function template.
Optionally, the template type includes at least one data type;The generation module is also used to:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of multiple codes comprising the first function is generated, it will The encrypted code is as the encryption function.
Optionally, the calculating function is in addition function, SUbtractive function, XOR operation 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 storage medium, deposits thereon Computer program is contained, which performs the steps of when being executed by processor
The logical operation function for encryption, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first 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 On a memory and the computer program that can run on a processor, when processor execution described program, is realized for device and storage Following steps:
The logical operation function for encryption, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, the data are encrypted.
The one or more technical solutions 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 encryption includes at least two calculating functions, the preset function template packet 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 encryption function is generated based on modified template type and the first function, then add based on described Close function encrypts the data.Due in method provided by the invention, on the one hand, the logical operation letter for encryption Number is to be write based on preset function template, and be combined with the different calculating functions in the logical operation function, obtains first Function, i.e. logical operation function are that the logical operation function write based on preset function template, therefore obtain is a kind of template Function, and first function is combined with a variety of logical operation functions, and the complexity of function can be improved, to increase the difficulty cracked On the other hand degree can modify template type, and according to modified template type and the first letter on the basis of first function Different encryption functions can be generated in number, i.e., can generate the code of more parts of encryption functions by modifying template type, in this way In decompiling, then needs to carry out decompiling to more parts of encryption function codes, increase the size of code of decompiling, it is further in this way The difficulty for cracking data encryption function is increased, so improve the safety of data encryption.Solve in the prior art due to Encryption Algorithm for data encryption is easy to be cracked, and there are the lower technical problems of safety.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair Bright some embodiments for those of ordinary skill in the art without creative efforts, can be with root Other attached drawings are obtained according to these attached drawings.
Fig. 1 is a kind of flow chart of the encryption method for data in the embodiment of the present invention;
Fig. 2 is a kind of structural schematic diagram of the encryption device for data in the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of computer readable storage medium in the embodiment of the present invention;
Fig. 4 is the structural schematic diagram of computer equipment in the embodiment of the present invention.
Specific 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 It is easy to be cracked in Encryption Algorithm, there are the lower technical problems of safety.
Technical solution in the embodiment of the present application, general thought are as follows:
A kind of encryption method for data, which comprises patrolling for encryption is write based on preset function template Operation function is collected, the logical operation function for encryption includes at least two calculating functions, the preset function template packet 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 encryption function is generated based on modified template type and the first function, then add based on described Close function encrypts the data.
Since the present invention provides the above method, on the one hand, the logical operation function for encryption is 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 It is the logical operation function write based on preset function template, therefore obtain 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, to increase the difficulty cracked, second aspect, Ke Yi Template type is modified on the basis of first function, and different add can be generated according to modified template type and first function Close function can generate the codes of more parts of encryption functions by modifying template type, in this way in decompiling, then need pair More parts of encryption function codes carry out decompiling, increase the size of code of decompiling, which further increases crack data encryption The difficulty of function, so improve the safety of data encryption.It solves in the prior art due to the encryption for data encryption Algorithm is easy to be cracked, and there are the lower technical problems of safety.
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Embodiment one
A kind of encryption method for data is present embodiments provided, referring to FIG. 1, the described method includes:
Step S101: the logical operation function for encryption, the patrolling for encryption are write 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;
Step S102: the different calculating functions in the logical operation function are combined, first function is obtained;
Step S103: the template type is modified, and is generated and is added based on modified template type and the first function Close function;
Step S104: it is based on the encryption function, the data are encrypted.
It should be noted that preset function template is a kind of reusability for improving code in this programming language of C++ Programming mode, preset function template is exactly a general template in simple terms, such as writes a comparison size of data Function, function effect are which compares in two data is bigger, it is common practice to be float, int to data type, char, Each type in the types such as double writes a comparison function, however its function content be all it is identical, be only intended to The data type of the data compared is different.And a general function is write then by then can only use based on preset function template All data types can all be supported.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, compiler realize can template instancesization its final code to each type, thus by modification template type, then Available different encrypted code, increases size of code, to improve the difficulty cracked, ensure that the safety of data encryption Property.
In the following, the encryption method provided by the present application for data is described in detail in conjunction with Fig. 1:
Firstly, executing step S101, 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 calculating functions, and the preset function template includes at least one template type.
Specifically, there are many logical operation functions, for example, addition function, SUbtractive function, multiplication function etc., this implementation Logical operation function in example includes at least two kinds, and the preset function template includes at least one template type, specific In implementation process, logical operation function can be write using including the preset function template of various template type.
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 for 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 identifier n>
<return type><function name>(parameter list)
{
Function body
}
Wherein, template is the keyword of preset function template statement, non-data type parameters in subsequent angle brackets Identifier can have one or more, and different data type parameters identifiers indicates different template types, wherein class For the keyword of template type.Then it is followed successively by the return type of function, function name and parameter list, non-function in braces below Body.Preset function template is a general template, and data type parameters identifier is actually a type parameter, is made When with preset function template, the above-mentioned type parameter is instantiated as to determining data type.After the instantiation of type parameter Parameter is known as template argument, is known as stencil function with the function that template argument instantiates.I.e. by by preset function template instances Change, then the corresponding stencil function of available preset function template.Lower mask body is introduced several is write using stencil function The method of logical operation function.
The first, writes add operation function using stencil function.
Wherein, template<class T, class T1, class T2, class T3, class T4, class T5>be The template type of the statement of one stencil function, i.e. the notice compiler stencil function has 6, and the number of template type can root It is configured according to actual needs.In above-mentioned function, inline indicates directly be unfolded when calling function, and data type uses The type that template T is indicated, and being modified data type using const, pData and add are the formal parameter of the function, The type indicated using T, and modified with const, the effect of the function is that this function is to parameter pData plus one Add numerical value, if encrypted using the addition function to data, 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, and details are not described herein.
The third, writes XOR operation function using stencil function.
The effect of the function is to one add numerical value of parameter pData exclusive or, and XorData is function name, other and addition Operation function is identical, and details are not described herein.
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, it is other with plus Method operation function is identical, and details are not described herein.
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, it is other with plus Method operation function is identical, and details are not described herein.
Similarly, other logical operation functions, such as multiplying, division arithmetic etc. can also be designed.
Then it executes step S102: combining the different calculating functions in the logical operation function, obtain first function;
In the specific implementation process, the first letter can be obtained by the logical operation function in combination step S101 Number, combined mode can there are many, such as combination additional calculation function and exclusive or calculate function, combination subtraction function, Subtraction function moves to left function etc., and for a variety of logical operation functions of combination, can be by adjusting each logic The calling of operation function sequentially obtains different first functions, for example, combination additional calculation function and exclusive or calculate function First function is first carried out addition and executes subtraction again as one kind, and it is another first letter that subtraction, which is first carried out, and executes addition again then Number.First function is obtained by combining different logical operation functions, the complexity of first function can be improved.
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 be a long character string, it is however generally that client when being communicated with server, Server can issue a KEY value and be used to encrypt initial data, 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: combined logical operation letter Several sequences is addition function, SUbtractive function, exclusive or 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 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) it is calculated.Above-mentioned code this operation be the data of pData are added with the data of pKey, are subtracted each other, exclusive or, a left side Operation is moved to be encrypted.
On the basis of the above, using generic function come calling logic operation function, to generate first function.
Wherein, EncodeData1 is the function name of first function, remaining parameter declaration has hereinbefore been made relevant It explains and illustrates, details are not described herein, and compiler final for EncodeData1 function can generate very large function generation Code, and the stencil function wherein called can all generate a different logical operation function.
With above-mentioned EncodeData1 function correspondingly, it can be deduced that decryption function, the i.e. inverse process of Encryption Algorithm.Example If Encryption Algorithm carries out addition to data, then decipherment algorithm is then to carry out subtraction, and it is decipherment algorithm that sequence, which is turned around,.
Such as it is then for the decipherment algorithm of function EncodeData1:
Next it executes step S103: modifying the template type, and be based on modified 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 the first function after changing generate encryption function, comprising:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of the code of multiple first functions is generated, it will be described Encrypted code is as the encryption function.
Specifically, aforementioned 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 pass through modification template type Mode obtain multiple encrypted codes, contain the code of first function in the encrypted code.
In the 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 modified template type, compiler can all regenerate a addition Any a variety of encrypted codes then can be generated by changing template type so as to write a function in code.Specific implementation It is as follows:
Assuming that template type T is int type, the data of Yao Jiami are 1, and addend 2 then calls the knot of add operation function Fruit is as follows:
Int a=1;
Int b=2;
Int c=AddData<int, int, int, int, int, int>(a, b);
At this point, it is int, int, int, int, int, the addition code of int that compiler, which can generate a type,.
If the type of T1 is revised as char type, call the result of add operation function as follows:
Int c=AddData<int, char, int, int, int, int>(a, b);
Likewise, it is int, char, int, int, int, the addition code of int that compiler, which can generate a type,.
Calling the result of above two function to return is 3, but arbitrarily modifies a kind of template type, and compiler can all give birth to At a addition code, such as:
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 modifying any one template type, then available different a code, Size of code is considerably increased in this way, cracks difficulty to improve.
Step S104 is executed again: based on the encryption function, the data being encrypted.
Specifically, encryption function is generated based on modified template type and the first function in step S103, Data can then be encrypted by encryption function, due to modification template type then available different encryption function Code, and template type be it is infinite multiple, each template can be modified, therefore the code of obtained encryption function is very huge Big, if to crack to encryption function, the code for the encryption function for needing decompiling all has added crack number in this way According to the difficulty of encryption function, so improve the safety of data encryption.
Optionally, in order to further increase the complexity of encryption function, modifying the template type, and based on modification after Template type and the first function generate encryption function, the method also includes:
Based on the preset function template, the encryption function is converted into mould corresponding with the preset function template First encryption function of plate type function.
Specifically, since logical operation function is write based on preset function template, pass through generic function tune With logical operation function, it can realize the function of stencil function, in order to further increase the complexity of encryption function, can incite somebody to action Encryption function is converted into corresponding stencil function, which is further complication on the basis of encryption function, i.e., First encryption function.In the 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]);
}
At this point, if template parameter T1, T2, T3, T4, T5 of modification EncodeData function, it can be to template type It modifies, the code that compiler all can generate portion EncodeData for each type also increases to improve size of code The complexity for having added code cracks difficulty so increasing, and improves the safety of data encryption.
Optionally, the calculating function is in addition function, SUbtractive function, XOR operation function and shift operation function It is a kind of.
Based on same inventive concept, the present invention also provides it is a kind of with for the corresponding dress of the encryption method of data It sets, referring specifically to embodiment two
Embodiment two
The embodiment of the invention provides a kind of encryption devices for data, refer to Fig. 2, and described device includes:
Module 201 is write, it is described for adding for writing the logical operation function for encryption based on preset function template Close logical operation function includes at least two calculating functions, and the preset function template includes at least one template type;
Composite module 202 obtains first function for combining the different calculating functions in the logical operation function;
Generation module 203 for modifying the template type, and is based on modified template type and the first function Generate encryption function;
Encrypting module 204 encrypts the data for being based on the encryption function.
Optionally, described device further includes processing module, for modifying the template type described, and is based on after modifying Template type and the first function generate encryption function after, be based on the preset function template, by the encryption function It is converted into the first encryption function of stencil function type corresponding with the preset function template.
Optionally, the template type includes at least one data type;The generation module is also used to:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of multiple codes comprising the first function is generated, it will The encrypted code is as the encryption function.
Optionally, the calculating function is in addition function, SUbtractive function, XOR operation function and shift operation function It is a kind of.
Based on same inventive concept, calculating corresponding with the encryption method of data is used for that the present invention also provides a kind of Machine readable storage medium storing program for executing, referring specifically to embodiment three.
Embodiment three
The embodiment of the invention provides a kind of computer readable storage mediums 300, are stored thereon with computer program 311, The program performs the steps of when being executed by processor
The logical operation function for encryption, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, the data are encrypted.
Based on same inventive concept, calculating corresponding with the encryption method of data is used for that the present invention also provides a kind of Machine equipment, referring specifically to example IV.
Example IV
The embodiment of the invention provides 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, the processor perform the steps of when executing described program
The logical operation function for encryption, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, the data are encrypted.
For ease of description, only parts related to embodiments of the present invention are shown, disclosed by specific technical details, asks Referring to present invention method part.Memory 401 can be used for storing computer program 403, and above-mentioned computer program includes Software program, module and data, processor 402 execute the computer program 403 for being stored in memory 401 by running, thus Execute the various function application and data processing of computer equipment.
In the specific implementation process, memory 401 can be used for storing software program and module, and processor 402 passes through Operation is stored in the software program and module of memory 401, thereby executing the various function application and number of computer equipment According to processing.Memory 401 can mainly include storing program area and storage data area, wherein storing program area can store operation system Application program needed for system, at least one function etc.;Storage data area can be stored to be created according to using for computer equipment Data etc..In addition, memory 401 may include high-speed random access memory, it can also include nonvolatile memory, such as At least one disk memory, flush memory device or other volatile solid-state parts.Processor 402 is computer equipment Control centre, using the various pieces of various interfaces and the entire computer equipment of connection, by running or executing storage Software program and/or module in memory 401, and the data being stored in memory 401 are called, it executes computer and sets Standby various functions and processing data, to carry out integral monitoring to computer equipment.Optionally, processor 402 may include one A or multiple processing units;Preferably, processor 402 can integrate application processor, wherein the main processing operation of application processor System, user interface and application program etc..
The one or more technical solutions 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 encryption includes at least two calculating functions, the preset function template packet 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 encryption function is generated based on modified template type and the first function, then add based on described Close function encrypts the data.Due in method provided by the invention, on the one hand, the logical operation letter for encryption Number is to be write based on preset function template, and be combined with the different calculating functions in the logical operation function, obtains first Function, i.e. logical operation function are that the logical operation function write based on preset function template, therefore obtain is a kind of template Function, and first function is combined with a variety of logical operation functions, and the complexity of function can be improved, to increase the difficulty cracked On the other hand degree can modify template type, and according to modified template type and the first letter on the basis of first function Different encryption functions can be generated in number, i.e., can generate the code of more parts of encryption functions by modifying template type, in this way In decompiling, then needs to carry out decompiling to more parts of encryption function codes, increase the size of code of decompiling, it is further in this way The difficulty for cracking data encryption function is increased, so improve the safety of data encryption.Solve in the prior art due to Encryption Algorithm for data encryption is easy to be cracked, and there are the lower technical problems of safety.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, those skilled in the art can carry out various modification and variations without departing from this hair to the embodiment of the present invention The spirit and scope of bright embodiment.In this way, 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 include these modifications and variations.

Claims (10)

1. a kind of encryption method for data, which is characterized in that the described method includes:
The logical operation function for encryption is write based on preset function template, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, the data are encrypted.
2. the method as described in claim 1, which is characterized in that in the modification template type, and based on modified After template type and the first function generate encryption function, the method also includes:
Based on the preset function template, the encryption function is converted into template letter corresponding with the preset function template First encryption function of several classes of types.
3. the method as described in claim 1, which is characterized in that the template type includes at least one data type, described The template type is modified, and encryption function is generated based on modified template type and the first function, comprising:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of multiple codes comprising the first function is generated, it will be described Encrypted code is as the encryption function.
4. the method as described in any one of claim 1-3 claim, which is characterized in that the calculating function is addition letter One of number, SUbtractive function, XOR operation function and shift operation function.
5. a kind of encryption device for data, which is characterized in that described device includes:
Module is write, for writing the logical operation function for encryption, the patrolling 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 obtains first function for combining the different calculating functions in the logical operation function;
Generation module for modifying the template type, and is generated based on modified template type and the first function and is added Close function;
Encrypting module encrypts the data for being based on the encryption function.
6. device as claimed in claim 5, which is characterized in that described device further includes processing module, in the modification The template type, and be based on after modified template type and first function generation encryption function, based on described pre- If function template, first that the encryption function is converted into stencil function type corresponding with the preset function template adds Close function.
7. device as claimed in claim 5, which is characterized in that the template type includes at least one data type;It is described Generation module is also used to:
By modifying the data type, to modify the template type, and modified template type is obtained;
According to the modified template type, the encrypted code of multiple codes comprising the first function is generated, it will be described Encrypted code is as the encryption function.
8. the device as described in any one of claim 5-7 claim, which is characterized in that the calculating function is addition letter One of number, SUbtractive function, XOR operation function and shift operation function.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor It is performed the steps of when row
The logical operation function for encryption is write based on preset function template, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, data are encrypted.
10. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor Calculation machine program, which is characterized in that the processor performs the steps of when executing described program
The logical operation function for encryption is write based on preset function template, the logical operation function for encryption 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 modified, and encryption function is generated based on modified template type and the first function;
Based on the encryption function, 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 CN107247906A (en) 2017-10-13
CN107247906B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096266B (en) * 2019-05-13 2023-12-22 度小满科技(北京)有限公司 Feature processing method and device

Citations (3)

* 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
CN106709373A (en) * 2017-01-18 2017-05-24 北京许继电气有限公司 Method for achieving encryption of self-defining function of self-controlled database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10402590B2 (en) * 2015-09-11 2019-09-03 Infosys Limited Method and system for masking of cheque image based on user access privileges

Patent Citations (3)

* 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
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

Also Published As

Publication number Publication date
CN107247906A (en) 2017-10-13

Similar Documents

Publication Publication Date Title
CN109831298B (en) Method for safely updating key in block chain, node and storage medium
JP5643894B2 (en) System and method for dynamically variable timing arithmetic path to withstand side channel attacks and repetitive activation attacks
CN107819569B (en) The encryption method and terminal device of log-on message
CN109636592A (en) High-performance intelligence Contract Design
CN110825363B (en) Intelligent contract acquisition method and device, electronic equipment and storage medium
CN107341374B (en) Insertion method and device of opaque predicates
CN105022936A (en) Class file encryption and decryption method and class file encryption and decryption device
EP3729306B1 (en) Compiling device and method
CN109947401A (en) The method and device handled by computer executing rule
CN106712928A (en) Big data rainbow table based decryption method and device
CN109918113A (en) Multiple/hot update method of IOS application hot repair, server and storage medium
CN107247906B (en) A kind of encryption method and device for data
CN113434148B (en) Decryption-preventing client development compiling method and device, electronic equipment and storage medium
CN109413189B (en) Electronic transaction system based on bottom translation
CN107087002B (en) A kind of encipher-decipher method of data, device and electronic equipment
CN109409036A (en) Control stream based on redundant code obscures method and device, storage medium and terminal
CN105933111A (en) Bitslicing-KLEIN rapid implementation method based on OpenCL
KR20160108427A (en) Method of protecting secret data when used in a cryptographic algorithm
CN112163949A (en) Intelligent contract generation method and device based on contract component imaging
CN108415709A (en) A kind of method and device for reinforcing source code based on finite state machine
CN104331827B (en) Transaction configuration generating method and deals match device
CN110032832B (en) Web application processing method and device
CN107113160B (en) System, method and computer storage medium for hidden program execution
CN108427559A (en) A kind of script file generates and call method and device
CN110032866B (en) Web application processing method and device

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