CN108494548A - Quote pattern encryption method, device, computer equipment and storage medium - Google Patents
Quote pattern encryption method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN108494548A CN108494548A CN201810312144.9A CN201810312144A CN108494548A CN 108494548 A CN108494548 A CN 108494548A CN 201810312144 A CN201810312144 A CN 201810312144A CN 108494548 A CN108494548 A CN 108494548A
- Authority
- CN
- China
- Prior art keywords
- class name
- titles
- pattern
- encrypted
- encryption
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/16—Implementing security features at a particular protocol layer
- H04L63/168—Implementing security features at a particular protocol layer above the transport layer
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Power Engineering (AREA)
- Computer Security & Cryptography (AREA)
- Storage Device Security (AREA)
Abstract
This application discloses a kind of reference pattern encryption method, device, computer equipment and storage mediums.This method includes:The reference pattern in the HTML of front end is obtained, parsing obtains class name and/or ID titles in reference pattern;Operation is encrypted in the class name quoted in pattern and/or ID titles, ID titles after corresponding to class name after being encrypted and/or encrypting;By the class name for quoting pattern be set to encryption after class name, and/or by the ID titles for quoting pattern be set to encryption after ID titles.Operation is encrypted in the class name for quoting pattern and/or ID titles by this method, obtains encrypted class name and/or ID titles, it is ensured that the pattern title after encrypted conversion is unique, conflict caused by avoiding pattern from bearing the same name.
Description
Technical field
This application involves web displaying technical fields more particularly to a kind of reference pattern encryption method, device, computer to set
Standby and storage medium.
Background technology
Currently, drawing in front end HTML (full name is HyperText Markup Language, indicates hypertext markup language)
With pattern, (i.e. CSS, full name are Cascading Style Sheets, and enough typesettings to element position in webpage carry out Pixel-level
Accurately control, possess the ability to web object and model pattern editor) it is often quoted by other systems as module.Example
Such as, pattern being quoted in the HTML in A systems and being named as CSS1, pattern is similarly quoted in the HTML in B system is named as
CSS1, if needing to quote the reference pattern CSS1 in reference pattern CSS1 and the B system in A systems in C system simultaneously.If of the same name
The reference pattern of title is quoted simultaneously, may lead to naming conflict, be easy to cause problem difficult in maintenance.
Invention content
This application provides a kind of reference pattern encryption method, device, computer equipment and storage mediums, it is intended to solve existing
If there is the reference pattern in technology with title to be quoted simultaneously, naming conflict may be caused, be easy to cause problem difficult in maintenance.
In a first aspect, this application provides a kind of reference pattern encryption methods comprising:
The reference pattern in the HTML of front end is obtained, parsing obtains class name and/or ID titles in reference pattern;
The class name quoted in pattern and/or ID titles are encrypted operation, it is corresponding encrypted after class name and/or
ID titles after encryption;
The class name for quoting pattern is set to class name after encryption, and/or after the ID titles for quoting pattern are set to encryption
ID titles.
Second aspect, this application provides a kind of reference pattern encryption devices comprising:
Pattern resolution unit is quoted, for obtaining the reference pattern in the HTML of front end, parsing obtains the class in reference pattern
Title and/or ID titles;
Encryption unit, for operation to be encrypted in the class name quoted in pattern and/or ID titles, correspondence is encrypted
Afterwards class name and/or encryption after ID titles;
Title replacement unit and/or will quote pattern for the class name for quoting pattern to be set to class name after encryption
ID titles are set to ID titles after encryption.
The third aspect, the application provide a kind of computer equipment again, including memory, processor and are stored in described deposit
On reservoir and the computer program that can run on the processor, the processor realize this when executing the computer program
Any one of them that application provides quotes pattern encryption method.
Fourth aspect, present invention also provides a kind of storage mediums, wherein the storage medium is stored with computer program,
The computer program includes program instruction, and described program instruction makes the processor execute the application when being executed by a processor
Any one of them of offer quotes pattern encryption method.
A kind of reference pattern encryption method of the application offer, device, computer equipment and storage medium.This method is by obtaining
The reference pattern in the HTML of front end, parsing is taken to obtain class name and/or ID titles in reference pattern;The class in pattern will be quoted
Operation is encrypted in title and/or ID titles, ID titles after corresponding to class name after being encrypted and/or encrypting;Pattern will be quoted
Class name be set to encryption after class name, and/or by the ID titles for quoting pattern be set to encryption after ID titles.This method will be quoted
Operation is encrypted in the class name and/or ID titles of pattern, obtains encrypted class name and/or ID titles, it is ensured that through adding
Pattern title after close conversion is unique, conflict caused by avoiding pattern from bearing the same name.
Description of the drawings
It, below will be to needed in embodiment description in order to illustrate more clearly of the embodiment of the present application technical solution
Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is some embodiments of the present application, general for this field
For logical technical staff, without creative efforts, other drawings may also be obtained based on these drawings.
Fig. 1 is a kind of schematic flow diagram of reference pattern encryption method provided by the embodiments of the present application;
Fig. 2 is a kind of sub-process schematic diagram of reference pattern encryption method provided by the embodiments of the present application;
Fig. 3 is a kind of another sub-process schematic diagram of reference pattern encryption method provided by the embodiments of the present application;
Fig. 4 is a kind of another sub-process schematic diagram of reference pattern encryption method provided by the embodiments of the present application;
Fig. 5 is a kind of another sub-process schematic diagram of reference pattern encryption method provided by the embodiments of the present application;
Fig. 6 is a kind of schematic block diagram of reference pattern encryption device provided by the embodiments of the present application;
Fig. 7 is a kind of subelement schematic block diagram of reference pattern encryption device provided by the embodiments of the present application;
Fig. 8 is a kind of another subelement schematic block diagram of reference pattern encryption device provided by the embodiments of the present application;
Fig. 9 is a kind of another subelement schematic block diagram of reference pattern encryption device provided by the embodiments of the present application;
Figure 10 is a kind of another subelement schematic block diagram of reference pattern encryption device provided by the embodiments of the present application;
Figure 11 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific implementation mode
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation describes, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen
Please in embodiment, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall in the protection scope of this application.
It should be appreciated that ought use in this specification and in the appended claims, term " comprising " and "comprising" instruction
Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded
Body, step, operation, element, component and/or its presence or addition gathered.
It is also understood that the term used in this present specification is merely for the sake of the mesh for describing specific embodiment
And be not intended to limit the application.As present specification and it is used in the attached claims, unless on
Other situations are hereafter clearly indicated, otherwise " one " of singulative, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is
Refer to any combinations and all possible combinations of one or more of associated item listed, and includes these combinations.
Referring to Fig. 1, Fig. 1 is a kind of schematic flow diagram of reference pattern encryption method provided by the embodiments of the present application.It should
Method is applied in the terminals such as desktop computer, laptop computer, tablet computer.As shown in Figure 1, the method comprising the steps of S101~
S103。
Reference pattern in S101, acquisition front end HTML, parsing obtain class name and/or ID titles in reference pattern.
In the present embodiment, the reference pattern in the HTML of front end is obtained by getStyle () function in java.It is adopting
Making Xhtml with DIV CSS (DIV+CSS is WEB design standards, it is a kind of page layout format method), (XHTML is that one kind exists
On the basis of HTML optimization and improved newspeak) Webpage when, can often use class titles and ID titles carry out Selection and call
When the attribute namely other systems of CSS style (CSS style is to quote pattern) call reference pattern, class name and/or ID titles
It is the factor that need to be focused first on.Conflict in order to avoid calling, multiple reference patterns that system is called from other multiple systems
It is that cannot bear the same name, therefore in the application after the reference pattern in obtaining front end HTML, the class name in the pattern of parsing reference before this
Claim and/or ID titles are further processed it, to prevent from bearing the same name.
In one embodiment, as shown in Fig. 2, the step S101 includes following sub-step:
Whether include character string .css or #css in S1011, detection reference pattern;
If S1012, reference pattern include character string .css, acquisition character and character between character string and be denoted as class
Title;
If S1013, reference pattern include character string #css, acquisition character and character between character string and be denoted as ID
Title.
In the present embodiment, the written word of class is also named " class " in CSS style.With " point " of small letter in CSS style
Or " " is named, such as:.css5 { attribute:Attribute value;};And Selection and call is then come with class=" css5 " in the html pages,
The CSS style that name is completed is called CSS selector.Moreover, when CSS style defines, ID titles are named to start with " # ",
Such as:#css5 { attributes:Attribute value;, this has similar definition with class, and only class is to start to order with small letter fullstop " "
Name, and ID is to start to define with " # ".Therefore in order to parse reference pattern, often to reference pattern in character string .css or #css into
Row detection, the title of pattern is quoted with quick obtaining.
S102, operation is encrypted in the class name quoted in pattern and/or ID titles, corresponds to class name after being encrypted
And/or ID titles after encryption.
In one embodiment, as shown in figure 3, the step S102 includes following sub-step:
If only including class name in S1021, reference pattern, class name is encrypted by SHA1 algorithms, is encrypted
Class name afterwards;
If only including ID titles in S1022, reference pattern, ID titles are encrypted by SHA1 algorithms, are encrypted
ID titles afterwards;
If S1023, reference pattern include class name and ID titles, class name is encrypted to obtain by SHA1 algorithms
ID titles after being encrypted are encrypted by SHA1 algorithms in ID titles by class name after encryption.
In the present embodiment, operation is encrypted to the class name and/or ID titles of quoting pattern, SHA1 encryptions can be used
Operation or md5 encryption operation, to ensure the problem of reference pattern title after encrypted conversion is unique, avoids duplication of name.
In one embodiment, as shown in figure 4, the step S1021 includes following sub-step:
S10211, the plaintext of class name is divided into multiple 512 clear packets, is denoted as the first clear packets respectively to
N clear packets;Wherein, N is positive integer;
S10212, the sub- clear packets that the first clear packets are divided into 16 32;
S10213, the link variable for creating 5 32, are denoted as A link variables, B link variables, C link variables, D respectively
Link variable, E link variables;
S10214, each sub- clear packets in 16 sub- clear packets included by the first clear packets are extended to 5
One's share of expenses for a joint undertaking clear packets obtain 80 one's share of expenses for a joint undertaking clear packets corresponding with the first clear packets;
S10215,80 one's share of expenses for a joint undertaking clear packets corresponding to the first clear packets carry out SHA1 operations, obtain current link change
Amount;
S10216, the current link variable of the first clear packets and initial link variable are summed, obtains first and divides in plain text
The link variable of group;
S10217, the initial link variable for being grouped the link variable of the first clear packets as second plaintext repeat to count
It calculates until obtaining the chain of the link variable of second plaintext grouping, the link variable of third clear packets, the 4th clear packets respectively
Connect variable, the 5th clear packets link variable;
S10218, the link variable of the 5th clear packets is sequentially concatenated, obtains class name after 160 encryptions.
In the present embodiment, SHA1 operations include 4 wheel operations, and each round includes 20 steps, altogether 80 step, when the 1st wheel
When the 1st step start to process in operation, value elder generation assignment in five link variables of A, B, C, D, E to other 5 recording units
In A ', B ', C ', D ', E '.This 5 value will retain, for the 4th wheel the last one step complete after with link variable A,
B, C, D, E carry out sum operation.
The 4 wheel operations of SHA1, totally 80 steps are as follows using the same operation sequence:
A,B,C,D,E←[(A<<<5)+ft(B,C,D)+E+Wt+Kt],A,(B<<<30),C,D
Wherein ft(B, C, D) is logical function, WtFor sub- clear packets W [t] (t=0,1,2 ... ..., 79), KtFor fixation
Constant, Wt=Mt(when 0≤t≤15), Wt=(Wt-3⊕Wt-8⊕Wt-14⊕Wt-16)<<<1 (when 16≤t≤79).This operation journey
The meaning of sequence is:
By [(A<<<5)+ft(B,C,D)+E+Wt+Kt] result be assigned to link variable A;
Link variable A initial values are assigned to link variable B;
By link variable B initial values ring shift left, 30 are assigned to link variable C;
Link variable C initial values are assigned to link variable D;
Link variable D initial values are assigned to link variable E.
SHA1 provides that the logical function of 4 wheel operations is as shown in table 1:
Table 1
It needs to use fixed constant K in operation sequencei(i=0,1,2 ... 79), and KiValue it is as shown in table 2:
Take turns number | Number of steps (t) | Function defines |
The first round | 0≤t≤19 | Kt=5A827999 |
Second wheel | 20≤t≤39 | Kt=6ED9EBA1 |
Third round | 40≤t≤59 | Kt=8F188CDC |
Fourth round | 60≤t≤79 | Kt=CA62C1D6 |
Table 2
Provide that 4 wheel operations obtain the link variable of the first clear packets by SHA1, and so on, by the first clear packets
The initial link variable that is grouped as second plaintext of link variable, compute repeatedly until obtaining the chain of second plaintext grouping respectively
The link variable of variable, the link variable of third clear packets, the link variable of the 4th clear packets, the 5th clear packets is connect,
Class name after the link variable of above-mentioned five clear packets is sequentially concatenated and is encrypted.Any one character string is encrypted through SHA1
After operation, class name is impossible to repeat after obtained encryption, this just effectively prevents reference pattern and bears the same name and lead to system
Problem difficult in maintenance.
When quoting the ID titles of pattern and carrying out SHA encryptions, only initial input identical as the SHA1 encryption types of class name
Plaintext have any different.
In the present embodiment, in addition to carrying out SHA1 cryptographic calculations to class name and/or ID titles, md5 encryption also can be used
Class name and/or ID titles is encrypted in algorithm.
For example, when use MD5 algorithms are encrypted operation to class name or ID titles and are converted into another character string, first
Class name or ID titles need to be filled, the result that its byte length pair 512 rems is made to be equal to 448.Therefore, the word of information
Section length (Bits Length) will be scaled up to N*512+448, i.e. N*64+56 byte (Bytes), and N is a positive integer.
The method of filling is as follows, and one 1 and numerous 0 is filled behind information, when meeting condition above
Stop the filling of 0 pair of information.Then one is added behind this result again with the letter before the filling of 64 binary representations
Cease length.By the processing of this two step, present information byte length=N*512+448+64=(N+1) * 512, i.e. length is proper
It is 512 integer multiple well.Reason for this is that the requirements to meet in later process to message length.There are four in MD5
32 numeric parameters for being referred to as link variable (ChainingVariable), they are respectively:A=0x01234567, B=
0x89abcdef, C=0xfedcba98, D=0x76543210.After setting this four link variables, begins to enter and calculate
The four-wheel loop computation of method, the number of cycle are the numbers of 512 information blocks in information.
Four link variables above are copied in four additional variable:A to a, B to b, C to c, D to d.Major cycle has four
It takes turns (MD4 only has three-wheel), often wheel cycle is all much like.The first round carries out 16 operations.Operation is to its in a, b, c and d every time
In the nonlinear function operation of three works, then by acquired results plus the 4th variable (subgroup in text and
One constant).
By acquired results, ring moves an indefinite number to the right again, and plus one of a, b, c or d.Finally taken with the result
For one of a, b, c or d.To be once four nonlinear functions (often taking turns one) used in each operation.
Four-wheel operation is as follows:
F (X, Y, Z)=(X ∧ Y) ∨ ((X) ∧ Z);
G (X, Y, Z)=(X ∧ Z) ∨ (Y ∧ (Z));
H (X, Y, Z)=XYZ;
I (X, Y, Z)=Y(X∨(\Z));
Wherein,Exclusive or, ∧ is with, ∨ be or, be inverse symbol.
If X, the correspondence position of Y and Z is independent and uniform, each of result also should be independent and uniform.F
It is the function of a bitwise operation.That is, if X, Y, otherwise Z.Function H is odd even operator by turn.All these completions
Later, A, B, C, D are added into a, b, c, d respectively.Then algorithm is continued to run with next grouped data, last output is A, B,
The cascade of C and D.The A finally obtained, B, C, D are exactly to export as a result, A is low level, and D is a high position, and DCBA forms 128 output knots
Fruit.
In the application, after carrying out operation to class name and/or ID titles by SHA1 Encryption Algorithm or md5 encryption algorithm,
Ensure the problem of pattern title after encrypted conversion is unique, avoids duplication of name.
In one embodiment, as shown in figure 5, further including following sub-step after the step S10218:
S10219, class name after 160 encryptions is subjected to Base64 decodings, class name after the encryption after being simplified.
Base64 is a kind of coding mode, commonly used in the data that binary data coding is writeable character style.
This is a kind of reversible coding mode.Data after coding are a character strings, character wherein included is A-Z, a-z, 0-9,
+ ,/totally 64 characters (26+26+10+1+1=64).
In the present embodiment, Base64 decodings, class after the encryption after being simplified are carried out to class name after 160 encryptions
Title.Class name after 160 encryptions is selected in class name the two first, as class name after encryption after the encryption after simplifying.
S103, the class name for quoting pattern is set to class name after encryption, and/or the ID titles for quoting pattern is set to and are added
ID titles after close.
As it can be seen that operation is encrypted in the class name for quoting pattern and/or ID titles by this method, encrypted class is obtained
Title and/or ID titles, it is ensured that the pattern title after encrypted conversion is unique, conflict caused by avoiding pattern from bearing the same name.
The embodiment of the present application also provides a kind of reference pattern encryption device, and the reference pattern encryption device is aforementioned for executing
Any one quotes pattern encryption method.Specifically, referring to Fig. 6, Fig. 6 is a kind of reference pattern provided by the embodiments of the present application adds
The schematic block diagram of close device.Reference pattern encryption device 100 can be installed on desktop computer, tablet computer, laptop computer, etc.
In terminal.
As shown in fig. 6, reference pattern encryption device 100 includes reference pattern resolution unit 101, encryption unit 102, title
Replacement unit 103.
Pattern resolution unit 101 is quoted, for obtaining the reference pattern in the HTML of front end, parsing obtains in reference pattern
Class name and/or ID titles.
In the present embodiment, the reference pattern in the HTML of front end is obtained by getStyle () function in java.It is adopting
Making Xhtml with DIV CSS (DIV+CSS is WEB design standards, it is a kind of page layout format method), (XHTML is that one kind exists
On the basis of HTML optimization and improved newspeak) Webpage when, can often use class titles and ID titles carry out Selection and call
When the attribute namely other systems of CSS style (CSS style is to quote pattern) call reference pattern, class name and/or ID titles
It is the factor that need to be focused first on.Conflict in order to avoid calling, multiple reference patterns that system is called from other multiple systems
It is that cannot bear the same name, therefore in the application after the reference pattern in obtaining front end HTML, the class name in the pattern of parsing reference before this
Claim and/or ID titles are further processed it, to prevent from bearing the same name.
In one embodiment, as shown in fig. 7, the reference pattern resolution unit 101, including following subelement:
Detection unit 1011, for whether detecting in reference pattern including character string .css or #css;
Class name acquiring unit 1012 obtains character and character { it if including character string .css for quoting pattern
Between character string and be denoted as class name;
ID name acquirings unit 1013 obtains character and character { it if including character string #css for quoting pattern
Between character string and be denoted as ID titles.
In the present embodiment, the written word of class is also named " class " in CSS style.With " point " of small letter in CSS style
Or " " is named, such as:.css5 { attribute:Attribute value;};And Selection and call is then come with class=" css5 " in the html pages,
The CSS style that name is completed is called CSS selector.Moreover, when CSS style defines, ID titles are named to start with " # ",
Such as:#css5 { attributes:Attribute value;, this has similar definition with class, and only class is to start to order with small letter fullstop " "
Name, and ID is to start to define with " # ".Therefore in order to parse reference pattern, often to reference pattern in character string .css or #css into
Row detection, the title of pattern is quoted with quick obtaining.
Encryption unit 102, for operation to be encrypted in the class name quoted in pattern and/or ID titles, correspondence obtains
After encryption class name and/or encryption after ID titles.
In one embodiment, as shown in figure 8, the encryption unit 102, including following subelement:
If first SHA1 encryption units 1021 are calculated class name by SHA1 for quoting in pattern only including class name
Method is encrypted, class name after being encrypted;
If 2nd SHA1 encryption units 1022 are calculated ID titles by SHA1 for quoting in pattern only including ID titles
Method is encrypted, ID titles after being encrypted;
3rd SHA1 encryption units 1023 pass through class name if including class name and ID titles for quoting pattern
SHA1 algorithms are encrypted encrypted after class name, ID titles are encrypted by SHA1 algorithms to after being encrypted ID
Claim.
In the present embodiment, operation is encrypted to the class name and/or ID titles of quoting pattern, SHA1 encryptions can be used
Operation or md5 encryption operation, to ensure the problem of reference pattern title after encrypted conversion is unique, avoids duplication of name.
In one embodiment, as shown in figure 8, the first SHA1 encryption units 1021, including following subelement:
First grouped element 10211, the plaintext for class name are divided into multiple 512 clear packets, are denoted as respectively
One clear packets are to N clear packets;Wherein, N is positive integer;
Second packet unit 10212, the sub- clear packets for the first clear packets to be divided into 16 32;
Link variable creating unit 10213, the link variable for creating 5 32, is denoted as A link variables, B chains respectively
Connect variable, C link variables, D link variables, E link variables;
It is grouped expanding element 10214, for each son in 16 sub- clear packets included by the first clear packets is bright
Text grouping is extended to 5 one's share of expenses for a joint undertaking clear packets, obtains 80 one's share of expenses for a joint undertaking clear packets corresponding with the first clear packets;
SHA1 arithmetic elements 10215 carry out SHA1 operations for 80 one's share of expenses for a joint undertaking clear packets corresponding to the first clear packets,
Obtain current link variable;
Variable summation unit 10216, for the current link variable of the first clear packets and initial link variable to be summed,
Obtain the link variable of the first clear packets;
Unit 10217 is computed repeatedly, it is initial for being grouped using the link variable of the first clear packets as second plaintext
Link variable computes repeatedly until obtaining the link variable of second plaintext grouping, the link variable of third clear packets, the respectively
The link variable of the link variable of four clear packets, the 5th clear packets;
Variable concatenation unit 10218, for the link variable of the 5th clear packets sequentially to be concatenated, obtain 160 plus
Class name after close.
In the present embodiment, SHA1 operations include 4 wheel operations, and each round includes 20 steps, altogether 80 step, when the 1st wheel
When the 1st step start to process in operation, value elder generation assignment in five link variables of A, B, C, D, E to other 5 recording units
In A ', B ', C ', D ', E '.This 5 value will retain, for the 4th wheel the last one step complete after with link variable A,
B, C, D, E carry out sum operation.
Provide that 4 wheel operations obtain the link variable of the first clear packets by SHA1, and so on, by the first clear packets
The initial link variable that is grouped as second plaintext of link variable, compute repeatedly until obtaining the chain of second plaintext grouping respectively
The link variable of variable, the link variable of third clear packets, the link variable of the 4th clear packets, the 5th clear packets is connect,
Class name after the link variable of above-mentioned five clear packets is sequentially concatenated and is encrypted.Any one character string is encrypted through SHA1
After operation, class name is impossible to repeat after obtained encryption, this just effectively prevents reference pattern and bears the same name and lead to system
Problem difficult in maintenance.
When quoting the ID titles of pattern and carrying out SHA encryptions, only initial input identical as the SHA1 encryption types of class name
Plaintext have any different.
In the present embodiment, in addition to carrying out SHA1 cryptographic calculations to class name and/or ID titles, md5 encryption also can be used
Class name and/or ID titles is encrypted in algorithm.
In the application, after carrying out operation to class name and/or ID titles by SHA1 Encryption Algorithm or md5 encryption algorithm,
Ensure the problem of pattern title after encrypted conversion is unique, avoids duplication of name.
In one embodiment, as shown in Figure 10, the first SHA1 encryption units 1021 further include following subelement:
Base coding units 10219, for class name after 160 encryptions to be carried out Base64 decodings, after being simplified
Encryption after class name.
Base64 is a kind of coding mode, commonly used in the data that binary data coding is writeable character style.
This is a kind of reversible coding mode.Data after coding are a character strings, character wherein included is A-Z, a-z, 0-9,
+ ,/totally 64 characters (26+26+10+1+1=64).
In the present embodiment, Base64 decodings, class after the encryption after being simplified are carried out to class name after 160 encryptions
Title.Class name after 160 encryptions is selected in class name the two first, as class name after encryption after the encryption after simplifying.
Title replacement unit 103 and/or will quote sample for the class name for quoting pattern to be set to class name after encryption
The ID titles of formula are set to ID titles after encryption.
As it can be seen that operation is encrypted in the class name for quoting pattern and/or ID titles by the device, encrypted class is obtained
Title and/or ID titles, it is ensured that the pattern title after encrypted conversion is unique, conflict caused by avoiding pattern from bearing the same name.
Above-mentioned reference pattern encryption device can be implemented as a kind of form of computer program, which can be
It is run on computer equipment as shown in figure 11.
Please refer to Fig.1 the schematic block diagram that 1, Figure 11 is a kind of computer equipment provided by the embodiments of the present application.The calculating
500 equipment of machine equipment can be terminal.The terminal can be tablet computer, laptop, desktop computer, personal digital assistant
Equal electronic equipments.
Refering to fig. 11, which includes processor 502, memory and the net connected by system bus 501
Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program
5032 include program instruction, which is performed, and processor 502 may make to execute a kind of reference pattern encryption method.
The processor 502 supports the operation of entire computer equipment 500 for providing calculating and control ability.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should
When computer program 5032 is executed by processor 502, processor 502 may make to execute a kind of reference pattern encryption method.
The network interface 505 such as sends the task dispatching of distribution for carrying out network communication.Those skilled in the art can manage
It solves, structure is not constituted only with the block diagram of the relevant part-structure of application scheme to the application side shown in Figure 11
The restriction for the computer equipment 500 that case is applied thereon, specific computer equipment 500 may include more than as shown in the figure
Or less component, it either combines certain components or is arranged with different components.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following work(
Energy:The reference pattern in the HTML of front end is obtained, parsing obtains class name and/or ID titles in reference pattern;Pattern will be quoted
In class name and/or ID titles be encrypted operation, it is corresponding encrypt after class name and/or ID titles after encrypting;It will draw
With the class name of pattern be set to encryption after class name, and/or by the ID titles for quoting pattern be set to encryption after ID titles.
In one embodiment, processor 502 also executes following operation:Whether include character string .css in detection reference pattern
Or #css;If reference pattern include character string .css, acquisition character and character between character string and be denoted as class name;If
Quote pattern include character string #css, acquisition character and character between character string and be denoted as ID titles.
In one embodiment, processor 502 also executes following operation:If it only includes class name to quote in pattern, by class name
Title is encrypted by SHA1 algorithms, class name after being encrypted;If it only includes ID titles to quote in pattern, ID titles are passed through
SHA1 algorithms are encrypted, ID titles after being encrypted;If it includes class name and ID titles to quote pattern, class name is passed through
SHA1 algorithms are encrypted encrypted after class name, ID titles are encrypted by SHA1 algorithms to after being encrypted ID
Claim.
In one embodiment, processor 502 also executes following operation:The plaintext of class name is divided into multiple 512 bright
Text grouping, is denoted as the first clear packets to N clear packets respectively;Wherein, N is positive integer;First clear packets are divided into
16 32 sub- clear packets;The link variable for creating 5 32 is denoted as A link variables, B link variables, C links respectively
Variable, D link variables, E link variables;By each sub- clear packets in 16 sub- clear packets included by the first clear packets
5 one's share of expenses for a joint undertaking clear packets are extended to, 80 one's share of expenses for a joint undertaking clear packets corresponding with the first clear packets are obtained;To the first clear packets pair
The 80 one's share of expenses for a joint undertaking clear packets answered carry out SHA1 operations, obtain current link variable;By the current link variable of the first clear packets
It sums with initial link variable, obtains the link variable of the first clear packets;Using the link variable of the first clear packets as
The initial link variable of two clear packets computes repeatedly until obtaining the link variable of second plaintext grouping, third respectively in plain text
The link variable of the link variable of grouping, the link variable of the 4th clear packets, the 5th clear packets;By the 5th clear packets
Link variable sequentially concatenates, and obtains class name after 160 encryptions.
In one embodiment, processor 502 also executes following operation:Class name after 160 encryptions is subjected to Base64
Decoding, class name after the encryption after being simplified.
It will be understood by those skilled in the art that the embodiment of computer equipment shown in Figure 11 is not constituted to computer
The restriction of equipment specific composition, in other embodiments, computer equipment may include components more more or fewer than diagram, or
Person combines certain components or different components arrangement.For example, in some embodiments, computer equipment can only include depositing
Reservoir and processor, in such embodiments, the structure and function of memory and processor are consistent with embodiment illustrated in fig. 11,
Details are not described herein.
It should be appreciated that in the embodiment of the present application, processor 502 can be central processing unit (Central
Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital
Signal Processor, DSP), application-specific integrated circuit (Application Specific Integrated Circuit,
ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic
Device, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or
Person's processor can also be any conventional processor etc..
A kind of storage medium is provided in another embodiment of the application.The storage medium can be computer-readable storage
Medium.The storage medium is stored with computer program, and wherein computer program includes program instruction.The program instruction is by processor
It is realized when execution:The reference pattern in the HTML of front end is obtained, parsing obtains class name and/or ID titles in reference pattern;It will
Operation is encrypted in class name and/or ID titles in reference pattern, ID after corresponding to class name after being encrypted and/or encrypting
Claim;By the class name for quoting pattern be set to encryption after class name, and/or by the ID titles for quoting pattern be set to encryption after ID
Claim.
In one embodiment, it is realized when which is executed by processor:Whether include character in detection reference pattern
String .css or #css;If reference pattern include character string .css, acquisition character and character between character string and be denoted as class
Title;If reference pattern include character string #css, acquisition character and character between character string and be denoted as ID titles.
In one embodiment, it is realized when which is executed by processor:If it only includes class name to quote in pattern, will
Class name is encrypted by SHA1 algorithms, class name after being encrypted;If it only includes ID titles to quote in pattern, by ID titles
It is encrypted by SHA1 algorithms, ID titles after being encrypted;If it includes class name and ID titles to quote pattern, by class name
Class name after being encrypted is encrypted by SHA1 algorithms, ID titles are encrypted by SHA1 algorithms to ID after being encrypted
Title.
In one embodiment, it is realized when which is executed by processor:The plaintext of class name is divided into multiple 512
Clear packets, be denoted as the first clear packets respectively to N clear packets;Wherein, N is positive integer;First clear packets are equal
It is divided into 16 32 sub- clear packets;The link variable for creating 5 32, is denoted as A link variables, B link variables, C respectively
Link variable, D link variables, E link variables;In plain text by each son in 16 sub- clear packets included by the first clear packets
Grouping is extended to 5 one's share of expenses for a joint undertaking clear packets, obtains 80 one's share of expenses for a joint undertaking clear packets corresponding with the first clear packets;Divide in plain text first
The corresponding 80 one's share of expenses for a joint undertaking clear packets of group carry out SHA1 operations, obtain current link variable;By the current link of the first clear packets
Variable is summed with initial link variable, obtains the link variable of the first clear packets;The link variable of first clear packets is made
For the initial link variable of second plaintext grouping, compute repeatedly until obtaining the link variable of second plaintext grouping, third respectively
The link variable of the link variable of clear packets, the link variable of the 4th clear packets, the 5th clear packets;5th is divided in plain text
The link variable of group sequentially concatenates, and obtains class name after 160 encryptions.
In one embodiment, it is realized when which is executed by processor:Class name after 160 encryptions is carried out
Base64 is decoded, class name after the encryption after being simplified.
The storage medium can be the internal storage unit of aforementioned device, such as the hard disk or memory of equipment.It is described to deposit
Storage media can also be the plug-in type hard disk being equipped on the External memory equipment of the equipment, such as the equipment, intelligent storage
Block (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..
Further, the storage medium can also both include the equipment internal storage unit and also including External memory equipment.
It is apparent to those skilled in the art that for convenience of description and succinctly, foregoing description is set
The specific work process of standby, device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Those of ordinary skill in the art may realize that units and algorithm described in conjunction with the examples disclosed in the embodiments of the present disclosure
Step can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and software
Interchangeability generally describes each exemplary composition and step according to function in the above description.These functions are studied carefully
Unexpectedly the specific application and design constraint depending on technical solution are implemented in hardware or software.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
In several embodiments provided herein, it should be understood that disclosed unit and method, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of division of logic function, formula that in actual implementation, there may be another division manner can also will have identical work(
The unit set of energy can be combined or can be integrated into another system at a unit, such as multiple units or component, or
Some features can be ignored or not executed.In addition, shown or discussed mutual coupling or direct-coupling or communication link
It can be INDIRECT COUPLING or communication connection by some interfaces, device or unit to connect, and can also be electricity, mechanical or other
Form connection.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the embodiment of the present invention
Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, can also be during two or more units are integrated in one unit.It is above-mentioned integrated
The form that hardware had both may be used in unit is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can be stored in a storage medium.Based on this understanding, technical scheme of the present invention is substantially in other words to existing
The all or part of part or the technical solution that technology contributes can be expressed in the form of software products, should
Computer software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be
Personal computer, server or network equipment etc.) execute all or part of step of each embodiment the method for the present invention
Suddenly.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disc or
The various media that can store program code such as person's CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace
It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right
It is required that protection domain subject to.
Claims (10)
1. a kind of reference pattern encryption method, which is characterized in that including:
The reference pattern in the HTML of front end is obtained, parsing obtains class name and/or ID titles in reference pattern;
Operation is encrypted in the class name quoted in pattern and/or ID titles, corresponds to class name and/or encryption after being encrypted
ID titles afterwards;
By the class name for quoting pattern be set to encryption after class name, and/or by the ID titles for quoting pattern be set to encryption after ID
Claim.
2. reference pattern encryption method according to claim 1, which is characterized in that the parsing obtains in reference pattern
Class name and/or ID titles, including:
Whether include character string .css or #css in detection reference pattern;
If reference pattern include character string .css, acquisition character and character between character string and be denoted as class name;
If reference pattern include character string #css, acquisition character and character between character string and be denoted as ID titles.
3. reference pattern encryption method according to claim 2, which is characterized in that described to quote the class name in pattern
And/or operation is encrypted in ID titles, ID titles after corresponding to class name after being encrypted and/or encrypting, including:
If it only includes class name to quote in pattern, class name is encrypted by SHA1 algorithms, class name after being encrypted;
If it only includes ID titles to quote in pattern, ID titles are encrypted by SHA1 algorithms, ID titles after being encrypted;
If reference pattern includes class name and ID titles, class name is encrypted by SHA1 algorithms to class name after being encrypted
Claim, ID titles are encrypted by SHA1 algorithms to ID titles after being encrypted.
4. reference pattern encryption method according to claim 3, which is characterized in that described that class name is passed through SHA1 algorithms
It is encrypted, class name after being encrypted, including:
The plaintext of class name is divided into multiple 512 clear packets, is denoted as the first clear packets respectively to N clear packets;
Wherein, N is positive integer;
First clear packets are divided into 16 32 sub- clear packets;
The link variable for creating 5 32, is denoted as A link variables, B link variables, C link variables, D link variables, E chains respectively
Connect variable;
Each sub- clear packets in 16 sub- clear packets included by first clear packets are extended to 5 one's shares of expenses for a joint undertaking in plain text to divide
Group obtains 80 one's share of expenses for a joint undertaking clear packets corresponding with the first clear packets;
80 one's share of expenses for a joint undertaking clear packets corresponding to the first clear packets carry out SHA1 operations, obtain current link variable;
The current link variable of first clear packets and initial link variable are summed, the link for obtaining the first clear packets becomes
Amount;
The initial link variable that the link variable of first clear packets is grouped as second plaintext computes repeatedly until obtaining respectively
Take the link variable that second plaintext the is grouped, link variables of third clear packets, the link variable of the 4th clear packets, the 5th bright
The link variable of text grouping;
The link variable of 5th clear packets is sequentially concatenated, class name after 160 encryptions is obtained.
5. reference pattern encryption method according to claim 4, which is characterized in that the link by the 5th clear packets
Variable sequentially concatenates, obtain after 160 encryptions after class name, further include:
Class name after 160 encryptions is subjected to Base64 decodings, class name after the encryption after being simplified.
6. a kind of reference pattern encryption device, which is characterized in that including:
Pattern resolution unit is quoted, for obtaining the reference pattern in the HTML of front end, parsing obtains the class name in reference pattern
And/or ID titles;
Encryption unit corresponds to class after being encrypted for operation to be encrypted in the class name quoted in pattern and/or ID titles
ID titles after title and/or encryption;
Title replacement unit, for the class name for quoting pattern to be set to class name after encryption, and/or ID names that will quote pattern
Title is set to ID titles after encryption.
7. reference pattern encryption device according to claim 6, which is characterized in that the reference pattern resolution unit, packet
It includes:
Detection unit, for whether detecting in reference pattern including character string .css or #css;
Class name acquiring unit, if for quote pattern include character string .css, acquisition character and character between character
It goes here and there and is denoted as class name;
ID name acquiring units, if for quote pattern include character string #css, acquisition character and character between character
It goes here and there and is denoted as ID titles.
8. reference pattern encryption device according to claim 7, which is characterized in that the encryption unit, including:
If first SHA1 encryption units are added class name by SHA1 algorithms for quoting in pattern only including class name
It is close, class name after being encrypted;
If 2nd SHA1 encryption units are added ID titles by SHA1 algorithms for quoting in pattern only including ID titles
It is close, ID titles after being encrypted;
Class name is passed through SHA1 algorithms by the 3rd SHA1 encryption units if including class name and ID titles for quoting pattern
Class name after being encrypted is encrypted, ID titles are encrypted by SHA1 algorithms to ID titles after being encrypted.
9. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor
The computer program of operation, which is characterized in that the processor is realized when executing the computer program as in claim 1-5
Any one of them quotes pattern encryption method.
10. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, the computer program packet
Program instruction is included, described program instruction makes the processor execute such as any one of claim 1-5 institutes when being executed by a processor
The reference pattern encryption method stated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810312144.9A CN108494548A (en) | 2018-04-09 | 2018-04-09 | Quote pattern encryption method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810312144.9A CN108494548A (en) | 2018-04-09 | 2018-04-09 | Quote pattern encryption method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108494548A true CN108494548A (en) | 2018-09-04 |
Family
ID=63315103
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810312144.9A Pending CN108494548A (en) | 2018-04-09 | 2018-04-09 | Quote pattern encryption method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108494548A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116347090A (en) * | 2023-05-26 | 2023-06-27 | 深圳市科盾科技有限公司 | Network information encryption method in big data environment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014090060A1 (en) * | 2012-12-13 | 2014-06-19 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for processing a webpage |
CN105989126A (en) * | 2015-02-15 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Webpage displaying method and device |
CN107122169A (en) * | 2017-03-21 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of method and device of Flash function encryptings |
-
2018
- 2018-04-09 CN CN201810312144.9A patent/CN108494548A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014090060A1 (en) * | 2012-12-13 | 2014-06-19 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for processing a webpage |
CN105989126A (en) * | 2015-02-15 | 2016-10-05 | 阿里巴巴集团控股有限公司 | Webpage displaying method and device |
CN107122169A (en) * | 2017-03-21 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of method and device of Flash function encryptings |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116347090A (en) * | 2023-05-26 | 2023-06-27 | 深圳市科盾科技有限公司 | Network information encryption method in big data environment |
CN116347090B (en) * | 2023-05-26 | 2023-08-11 | 深圳市科盾科技有限公司 | Network information encryption method in big data environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100415410B1 (en) | Encryption device and method, arithmetic unit, and decryption device and method | |
Gabow et al. | An augmenting path algorithm for linear matroid parity | |
US8379843B2 (en) | Data converter, data conversion method, and computer program | |
US20100281182A1 (en) | Extensible binary mark-up language for efficient XML-based data communications and related systems and methods | |
Chou | McBits revisited | |
CN101510781B (en) | Method and device for filling dummy argument for interlace and de-interlace process as well as processing system | |
CN103034605A (en) | Methods and apparatuses to effect a variable width link | |
CN108762764A (en) | Code automatic generation method, device, computer equipment and storage medium | |
KR101770874B1 (en) | Cryptographic processing device, cryptographic processing method, computer readable recording medium, and information processing device | |
CN105471545A (en) | Data packet processing method and device | |
CN102546089B (en) | Method and device for implementing cycle redundancy check (CRC) code | |
CN108052805B (en) | Data encryption and decryption method and device | |
CN113282949B (en) | Data encryption method, data decryption device and power data interaction system | |
CN108459872A (en) | Using packaging method by all kinds of means, device, computer equipment and storage medium | |
CN108830096A (en) | Data processing method, device, electronic equipment and storage medium | |
CN103701566A (en) | Check method and check device | |
CN109885990A (en) | Script management method | |
CN108763546A (en) | A kind of conversion method of data format, device, storage medium and terminal | |
CN108415894A (en) | Report data initial method, device, computer equipment and storage medium | |
CN108494548A (en) | Quote pattern encryption method, device, computer equipment and storage medium | |
CN108270508A (en) | A kind of cyclic redundancy check (CRC) implementation method, device and the network equipment | |
CN116318660B (en) | Message expansion and compression method and related device | |
CN110069735A (en) | JS code is anti-to be repeatedly injected method, apparatus, computer equipment and storage medium | |
CN105793842B (en) | Conversion method and device between serialized message | |
CN102594371B (en) | The method of a kind of Turbo code interleaving process 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180904 |
|
RJ01 | Rejection of invention patent application after publication |