Text content protection method and text content protection apparatus
By replacing the text encoding of the text content on the server side, the problem of existing technologies being unable to balance maintaining the original functionality of the page and preventing users from copying the text content is solved, thus effectively preventing users from copying the text content without affecting the page display.
Patent Information
- Application Number
- CN202311873477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-30
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-12-30
AI Technical Summary
Existing technologies cannot simultaneously address the issues of not affecting the original functionality of the page and preventing users from copying text content.
By obtaining the target mapping table, the text encoding of the text content to be protected is replaced with the modified encoding, and the modified encoding and glyph file are sent to the client to prevent users from copying the text content.
This achieves the goal of preventing users from copying text content without affecting the original functionality of the page, and also avoids the problem of blurry display.
Smart Images

Figure CN117851641B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text protection technology, and more specifically, to a text content protection method, a text content protection device, and a computer-readable storage medium. Background Technology
[0002] When displaying text content on a client-side information system page, some text content needs to be protected from user copying. That is, users should only be allowed to view the text content on the page, but not to copy it. The existing methods for preventing users from copying text content, along with their advantages and disadvantages, are as follows:
[0003] 1) Method 1: The server converts the text content into an image and sends the image to the client. The client's page only displays the image, thus preventing the user from copying it.
[0004] The advantage of method one is that it prevents users from copying text content.
[0005] The disadvantages of method one are: when the page size is adjusted, it is easy to cause misalignment of the display layout; when the page is enlarged or reduced, it is easy to cause problems such as blurry display.
[0006] 2) Method 2: The server sends the encoded text content to the client, and the control logic is added to the page's control script, such as disabling the copy function in the right-click menu to prevent the user from copying.
[0007] The advantage of method two is that it allows for page layout adjustments, zooming in and out, just like normal text content.
[0008] The disadvantages of method two are: the added control logic may conflict with the original functions of the page, and it cannot prevent users from copying text content. Users can obtain text content by disabling the control logic of the page's control scripts. Furthermore, since the page's source code contains the encoding of the text content, the text content can be obtained by checking the page's source code from other ends.
[0009] It is evident that existing methods for preventing users from copying text content cannot simultaneously address the issues of not affecting the original functionality of the page and preventing users from copying text content. Summary of the Invention
[0010] The main objective of this application is to provide a text content protection method, a text content protection device, and a computer-readable storage medium, so as to at least solve the problem that existing methods for preventing users from copying text content cannot simultaneously maintain the original functionality of the page and prevent users from copying text content.
[0011] To achieve the above objectives, according to one aspect of this application, a text content protection method is provided, the text content protection method being applied to a server, the method comprising: obtaining a first target encoding sequence and obtaining a target mapping table, wherein the first target encoding sequence includes a plurality of first target codes, each first target code being the encoding of a character in the text content to be protected, and the order of the first target codes in the first target encoding sequence is the same as the order of the character corresponding to the first target code in the text content to be protected, the target mapping table including a plurality of first target codes and a plurality of second target codes, wherein in the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target codes are encodings distinct from the corresponding first target codes; determining a second target encoding sequence based on the first target encoding sequence and the target mapping table, the second target encoding sequence including a plurality of second target codes, and wherein the characters in the second target encoding sequence are... The second target code corresponds one-to-one with the first target code in the first target code sequence, and the arrangement order of the second target code in the second target code sequence is the same as the arrangement order of the first target code corresponding to the second target code in the first target code sequence; a first target glyph file is obtained, the first target glyph file includes multiple first target codes and multiple target glyphs, in the first target glyph file, the first target code and the target glyph correspond one-to-one, any two first target codes are different, any two target glyphs are different, and the target glyph is the glyph of the character corresponding to the first target code; at least according to the target mapping relationship table, all the first target codes corresponding to the target glyphs in the first target glyph file are replaced with the second target codes corresponding to the first target codes to obtain the second target glyph file; the second target code sequence and the second target glyph file are sent to the client, so that the client displays the target glyph corresponding to the second target code in the second target code sequence according to the second target glyph file.
[0012] Optionally, obtaining the target mapping table includes: obtaining a first target integer, which is any one of a plurality of positive integers; determining a third target encoding sequence based on the first target encoding sequence, wherein the third target encoding sequence includes a plurality of first target codes in the first target encoding sequence, and any two first target codes in the third target encoding sequence are different; calculating at least the sum of each first target code in the third target encoding sequence with the first target integer to obtain a fourth target encoding sequence, wherein the fourth target encoding sequence includes a plurality of second target codes, and the second target codes in the fourth target encoding sequence correspond one-to-one with the first target codes in the third target encoding sequence; and establishing the target mapping table based on the third target encoding sequence and the fourth target encoding sequence.
[0013] Optionally, at least the sum of each of the first target codes and the first target integer in the third target coding sequence is calculated to obtain a fourth target coding sequence, including: a calculation step, calculating at least the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fifth target coding sequence, the fifth target coding sequence including multiple third target codes, one of the third target codes being the sum of one of the first target codes and the first target integer in the third target coding sequence; an acquisition step, acquiring a second target integer and a third target integer, the second target integer being one of multiple positive integers, the third target integer being any one of multiple positive integers, both the second target integer and the third target integer being greater than zero, and both the second target integer and the third target integer being less than M, where M is the number of third target codes included in the fifth target coding sequence; a swapping step, swapping the third target code with the second target integer in the fifth target coding sequence; repeating the acquisition step and the swapping step N times to obtain the fourth target coding sequence, where N≥M / 2.
[0014] Optionally, obtaining the first target glyph file further includes: obtaining a third target glyph file, wherein the third target glyph file includes the glyphs of the characters corresponding to all the first target codes in the first target encoding sequence; and determining the first target glyph file based on the third target glyph file.
[0015] Optionally, the method of replacing the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code according to the target mapping relationship table to obtain the second target glyph file, further includes: replacing the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code according to the target mapping relationship table to obtain the third target glyph file; and sorting all the coded glyph combinations in the third target glyph file in ascending order of the second target codes to obtain the second target glyph file, wherein one coded glyph combination includes one second target code and the target glyph corresponding to the second target code in the third target glyph file.
[0016] Optionally, sending the second target encoding sequence and the second target glyph file to the client includes: sending the second target encoding sequence to the client; and, upon receiving a first request instruction from the client, sending the second target glyph file to the client, wherein the first request instruction is an instruction to request the acquisition of the second target glyph file.
[0017] Optionally, after sending the second target glyph file to the client upon receiving the first request instruction sent by the client, the method further includes: upon receiving the first request instruction sent by the client again, sending a prompt message indicating that the sending of the second target glyph file to the client is refused.
[0018] Optionally, a text content has a tag, and any two text contents have different tags. Before obtaining the first target encoding sequence and the target mapping table, the method further includes: upon receiving a second request instruction sent by the client, obtaining the tag corresponding to the target text content, wherein the second request instruction is an instruction to request the acquisition of the target text content; determining whether the tag corresponding to the target text content is located in a configuration table, wherein the configuration table only stores tags of text content that needs to be protected; and if the tag corresponding to the target text content is located in the configuration table, determining that the target text content is the text content to be protected.
[0019] According to another aspect of this application, a text content protection device is provided, which is applied to a server. The device includes: a first acquisition unit, configured to acquire a first target encoding sequence and acquire a target mapping table, wherein the first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected, and the order of the first target codes in the first target encoding sequence is the same as the order of the character corresponding to the first target code in the text content to be protected; the target mapping table includes multiple first target codes and multiple second target codes, wherein any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in a one-to-one correspondence, and the second target codes are encodings distinct from the corresponding first target codes; and a first determination unit, configured to determine a second target encoding sequence based on the first target encoding sequence and the target mapping table, wherein the second target encoding sequence includes multiple second target codes, and the second target codes in the second target encoding sequence are encodings distinct from the first target codes. The first target codes in the first target encoding sequence are one-to-one correspondences, and the arrangement order of the second target codes in the second target encoding sequence is the same as the arrangement order of the first target codes corresponding to the second target codes in the first target encoding sequence; the second acquisition unit is used to acquire a first target glyph file, the first target glyph file including multiple first target codes and multiple target glyphs, in the first target glyph file, the first target codes and the target glyphs are one-to-one correspondences, any two first target codes are different, any two target glyphs are different, and the target glyphs are the glyphs of the characters corresponding to the first target codes; the replacement unit is used to replace all the first target codes corresponding to the target glyphs in the first target glyph file with the second target codes corresponding to the first target codes according to the target mapping relationship table, to obtain a second target glyph file; the first sending unit is used to send the second target encoding sequence and the second target glyph file to the client, so that the client displays the target glyphs corresponding to the second target codes in the second target encoding sequence according to the second target glyph file.
[0020] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the described text content protection methods.
[0021] Applying the technical solution of this application, firstly, a first target encoding sequence is obtained, that is, the original encoding of all characters in the text content to be protected is obtained, and a target mapping relationship table is obtained. Then, based on the first target encoding sequence and the target mapping relationship table, a second target encoding sequence is determined, that is, based on the target mapping relationship table, the original encoding of all characters in the text content to be protected is modified to obtain the modified encoding of all characters in the text content to be protected. Next, a first target glyph file is obtained, that is, the original encoding of all non-repeating characters in the text content to be protected and the corresponding glyphs are obtained. Then, at least according to the target mapping relationship table, the first target encoding corresponding to all target glyphs in the first target glyph file is replaced with the second target encoding corresponding to the first target encoding to obtain the second target glyph file, that is, the original encoding of the glyphs corresponding to all non-repeating characters in the text content to be protected is modified based on the target mapping relationship table. Finally, the second target encoding sequence and the second target glyph file are sent to the client, so that the client displays the target glyphs corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file, thereby displaying the text content to be protected. In this method, the second target encoding sequence sent by the server to the client is the modified encoding of all the characters in the text content to be protected. The user can only obtain the modified encoding of all the characters in the text content to be protected, but cannot obtain the original encoding of all the characters in the text content to be protected, thus preventing the user from copying the text content. In addition, the server still sends the encoding to the client, not the image, so there will be no display blurring when the page is zoomed in or out, and no new control logic needs to be added. Therefore, it will not affect the original function of the page, thus solving the problem that the existing methods for preventing users from copying text content cannot simultaneously ensure that the original function of the page is not affected and prevent users from copying text content. Attached Figure Description
[0022] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0023] Figure 1 A hardware structure block diagram of a mobile terminal implementing a text content protection method according to an embodiment of this application is shown;
[0024] Figure 2 A flowchart illustrating a text content protection method according to an embodiment of this application is shown.
[0025] Figure 3 A structural block diagram of a text content protection device provided according to an embodiment of this application is shown. Detailed Implementation
[0026] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] As described in the background section, existing methods for preventing users from copying text content cannot simultaneously maintain the original functionality of the page and prevent users from copying text content. To address this issue, embodiments of this application provide a text content protection method, a text content protection device, and a computer-readable storage medium.
[0030] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0031] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a text content protection method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0032] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] This embodiment provides a text content protection method that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0034] Figure 2 This is a flowchart of a text content protection method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0035] Step S201: Obtain the first target encoding sequence and obtain the target mapping relationship table;
[0036] The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the corresponding characters in the text content to be protected. The target mapping table includes multiple first target codes and multiple second target codes. In the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target code is an encoding that is different from the corresponding first target code.
[0037] Step S202: Determine the second target encoding sequence based on the first target encoding sequence and the target mapping table.
[0038] Wherein, the second target coding sequence includes multiple second target codes, and the second target codes in the second target coding sequence correspond one-to-one with the first target codes in the first target coding sequence, and the arrangement order of the second target codes in the second target coding sequence is the same as the arrangement order of the first target codes corresponding to the second target codes in the first target coding sequence;
[0039] Step S203: Obtain the first target glyph file;
[0040] The first target glyph file includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes.
[0041] Step S204: Replace all the first target codes corresponding to the target glyphs in the first target glyph file with the second target codes corresponding to the first target codes according to the target mapping relationship table above, to obtain the second target glyph file;
[0042] Step S205: Send the second target encoding sequence and the second target glyph file to the client, so that the client displays the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
[0043] In the above implementation method, firstly, a first target encoding sequence is obtained, that is, the original encoding of all characters in the text content to be protected is obtained, and a target mapping relationship table is obtained. Then, based on the first target encoding sequence and the target mapping relationship table, a second target encoding sequence is determined, that is, based on the target mapping relationship table, the original encoding of all characters in the text content to be protected is modified to obtain the modified encoding of all characters in the text content to be protected. Next, a first target glyph file is obtained, that is, the original encoding of all non-repeating characters in the text content to be protected and the glyphs corresponding to the original encodings are obtained. Then, at least according to the target mapping relationship table, the first target encoding corresponding to all target glyphs in the first target glyph file is replaced with the second target encoding corresponding to the first target encoding to obtain the second target glyph file, that is, the original encoding of the glyphs corresponding to all non-repeating characters in the text content to be protected is modified based on the target mapping relationship table. Finally, the second target encoding sequence and the second target glyph file are sent to the client, enabling the client to display the target glyphs corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file, thereby displaying the text content to be protected. In this method, the second target encoding sequence sent by the server to the client is the modified encoding of all the characters in the text content to be protected. The user can only obtain the modified encoding of all the characters in the text content to be protected, but cannot obtain the original encoding of all the characters in the text content to be protected, thus preventing the user from copying the text content. In addition, the server still sends the encoding to the client, not an image, so there will be no display blurring when the page is zoomed in or out, and no new control logic needs to be added. Therefore, it will not affect the original functionality of the page, thus solving the problem that existing methods for preventing users from copying text content cannot simultaneously maintain the original functionality of the page and prevent users from copying text content.
[0044] In an optional implementation, obtaining the target mapping table in step S201 above can be achieved as follows:
[0045] Step S2011: Obtain the first target integer, where the first target integer is any one of a plurality of positive integers;
[0046] Step S2012: Based on the first target coding sequence, determine the third target coding sequence, wherein the third target coding sequence includes multiple first target codes in the first target coding sequence, and any two first target codes in the third target coding sequence are different.
[0047] Step S2013: At least calculate the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fourth target coding sequence. The fourth target coding sequence includes multiple second target codes, and the second target codes in the fourth target coding sequence correspond one-to-one with the first target codes in the third target coding sequence.
[0048] Step S2014: Establish the target mapping relationship table based on the third target encoding sequence and the fourth target encoding sequence.
[0049] Specifically, firstly, a first target integer is obtained, which is a random positive integer generated using a random number function. The first target integer is located in the interval (0x01, 0xff). Then, based on the first target encoding sequence, a third target encoding sequence is determined, which is the original encoding of all non-repeating characters in the text content to be protected. After that, the sum of each first target code and the first target integer in the third target encoding sequence is calculated to obtain a fourth target encoding sequence, which is the sum of the original encoding of each non-repeating character in the text content to be protected and the first target integer. Finally, a target mapping table is established based on the third and fourth target encoding sequences. In the target mapping table, the second target code corresponding to the first target code in the third target encoding sequence is the sum of this first target code and the first target integer.
[0050] In an optional implementation, step S2013 can be implemented as follows:
[0051] The calculation steps include at least calculating the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fifth target coding sequence. The fifth target coding sequence includes multiple third target codes, and each of the third target codes is the sum of one of the first target codes and the first target integer in the third target coding sequence.
[0052] Specifically, the first target integer is converted into the base of the first target code and then summed with the first target code.
[0053] The acquisition step involves acquiring a second target integer and a third target integer. The second target integer is one of a plurality of positive integers, and the third target integer is any one of a plurality of positive integers. Both the second target integer and the third target integer are greater than zero, and both the second target integer and the third target integer are less than M, where M is the number of the third target codes contained in the fifth target encoding sequence.
[0054] The swapping step involves swapping the third target code whose sequence number is the second target integer and the third target code whose sequence number is the third target integer in the fifth target encoding sequence.
[0055] Specifically, the subsequent swap is based on the results of the previous swap.
[0056] Repeat the above acquisition steps and the above swapping steps N times to obtain the above fourth target encoding sequence, where N≥M / 2.
[0057] Specifically, firstly, a first target integer is added to the original codes of all non-repeating characters in the text content to be protected, resulting in a fifth target code sequence. Then, a second and third target integer are obtained, i.e., two random positive integers, the first and third target integers, are generated using a random number function. After that, the third target code with the second target integer in the fifth target code sequence and the third target code with the third target integer in the third target code sequence are swapped. The acquisition and swapping steps are repeated N times to obtain a fourth target code sequence, thereby preventing the correspondence between the original codes and the modified codes of all characters in the text content to be protected from being cracked.
[0058] In an optional implementation, step S203 can be implemented as follows:
[0059] Obtain a third target glyph file, which includes the glyphs of the characters corresponding to all the first target codes in the first target encoding sequence;
[0060] Based on the aforementioned third target glyph file, the aforementioned first target glyph file is determined.
[0061] Specifically, first, a third target glyph file is obtained, which is to obtain the glyphs corresponding to the original codes of all characters in the text content to be protected. Then, based on the third target glyph file, a first target glyph file is determined, which is to filter out the glyphs corresponding to the original codes of non-repeating characters from the glyphs corresponding to the original codes of all characters in the text content to be protected.
[0062] In an optional implementation, step S204 can be implemented as follows:
[0063] Based on the target mapping table above, replace all the first target codes corresponding to the target glyphs in the first target glyph file above with the second target codes corresponding to the first target codes above, and obtain the third target glyph file;
[0064] Sort all the coded glyph combinations in the third target glyph file according to the second target code in ascending order to obtain the second target glyph file. Each of the coded glyph combinations includes one of the second target codes in the third target glyph file and the target glyph corresponding to the second target code.
[0065] Specifically, firstly, based on the target mapping table, the first target code corresponding to all target glyphs in the first target glyph file is replaced with the second target code corresponding to the first target code, resulting in the third target glyph file. That is, based on the target mapping table, the original codes of the glyphs corresponding to all non-repeating characters in the text content to be protected are modified. Then, according to the second target code in ascending order, all the coded glyph combinations in the third target glyph file are sorted to obtain the second target glyph file. That is, the order of the target glyphs is shuffled, thereby further preventing the correspondence between the original codes and the modified codes of all characters in the text content to be protected from being cracked.
[0066] In an optional implementation, step S205 can be implemented as follows:
[0067] Step S2051: Send the second target encoded sequence to the client.
[0068] Step S2052: Upon receiving the first request instruction sent by the client, the second target glyph file is sent to the client. The first request instruction is an instruction to request the acquisition of the second target glyph file.
[0069] In an optional implementation, after step S2052, the method further includes:
[0070] Upon receiving the first request instruction from the client again, a prompt message is sent, indicating that the sending of the second target glyph file to the client is refused.
[0071] Specifically, upon receiving the first request instruction from the client again, a prompt message is sent, which refuses to send the second target glyph file to the client, in order to further prevent the correspondence between the original encoding and the modified encoding of all characters in the text content to be protected from being cracked.
[0072] Each piece of text content has a tag, and any two pieces of text content have different tags. In an optional implementation, after step S201, the method further includes:
[0073] Upon receiving the second request instruction sent by the aforementioned client, the tags corresponding to the target text content are obtained. The aforementioned second request instruction is an instruction to request the acquisition of the aforementioned target text content.
[0074] Determine whether the tags corresponding to the target text content are located in the configuration table. The configuration table only stores tags for the text content that needs to be protected.
[0075] If the aforementioned tag corresponding to the aforementioned target text content is located within the aforementioned configuration table, then the aforementioned target text content is determined to be the aforementioned text content to be protected.
[0076] It should be noted that if the target text content is not the text content to be protected, the original encoding of all characters in the target text content will be sent to the client.
[0077] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the text content protection method of this application will be described in detail below with reference to specific embodiments.
[0078] This embodiment relates to a specific method for protecting text content, including the following steps:
[0079] Step S1: Upon receiving the second request instruction sent by the client, obtain the tag corresponding to the target text content. The second request instruction is an instruction to request the target text content.
[0080] Step S2: Determine whether the tag corresponding to the target text content is located in the configuration table. The configuration table only stores tags of the text content that needs to be protected.
[0081] Step S3: If the tag corresponding to the target text content is located in the configuration table, determine that the target text content is the text content to be protected.
[0082] Step S4: Obtain a first target encoding sequence, wherein the first target encoding sequence includes multiple first target codes, each of the first target codes being the encoding of a character in the text content to be protected, and the order of the first target codes in the first target encoding sequence is the same as the order of the characters corresponding to the first target codes in the text content to be protected.
[0083] Step S5: Obtain the first target integer, which is any one of a plurality of positive integers;
[0084] Step S6: Determine a third target encoding sequence based on the first target encoding sequence. The third target encoding sequence includes multiple first target codes from the first target encoding sequence, and any two first target codes in the third target encoding sequence are different.
[0085] Step S7: Calculation step, at least calculate the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fifth target coding sequence. The fifth target coding sequence includes multiple third target codes, and one of the third target codes is the sum of one of the first target codes and the first target integer in the third target coding sequence.
[0086] Step S8: Obtain the second target integer and the third target integer. The second target integer is one of a plurality of positive integers, and the third target integer is any one of a plurality of positive integers. Both the second target integer and the third target integer are greater than zero, and both the second target integer and the third target integer are less than M, where M is the number of the third target codes contained in the fifth target coding sequence.
[0087] Step S9: Swap step, swap the third target code with the sequence number of the second target integer and the third target code with the sequence number of the third target integer in the fifth target code sequence;
[0088] Step S10: Repeat the above acquisition steps and the above swapping steps N times to obtain the above fourth target encoding sequence, where N≥M / 2;
[0089] Step S11: Establish the target mapping relationship table based on the third target encoding sequence and the fourth target encoding sequence;
[0090] Step S12: Obtain the third target glyph file, which includes the glyphs of the characters corresponding to all the first target codes in the first target encoding sequence;
[0091] Step S13: Determine the first target glyph file based on the third target glyph file;
[0092] Step S14: According to the target mapping relationship table above, replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code to obtain the third target glyph file;
[0093] Step S15: Sort all the coded glyph combinations in the third target glyph file according to the second target code in ascending order to obtain the second target glyph file. One of the coded glyph combinations includes one of the second target codes in the third target glyph file and the target glyph corresponding to the second target code.
[0094] Step S16: Send the second target encoded sequence to the client.
[0095] Step S17: Upon receiving the first request instruction sent by the client, the second target glyph file is sent to the client. The first request instruction is an instruction to request the acquisition of the second target glyph file.
[0096] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0097] This application also provides a text content protection device. It should be noted that the text content protection device of this application can be used to execute the text content protection method provided in this application. This device is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0098] The following describes the text content protection device provided in the embodiments of this application.
[0099] Figure 3 This is a schematic diagram of a text content protection device according to an embodiment of this application. Figure 3 As shown, the device includes:
[0100] The first acquisition unit 10 is used to acquire the first target encoding sequence and acquire the target mapping relationship table;
[0101] The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the corresponding characters in the text content to be protected. The target mapping table includes multiple first target codes and multiple second target codes. In the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target code is an encoding that is different from the corresponding first target code.
[0102] The first determining unit 20 is used to determine the second target encoding sequence based on the first target encoding sequence and the target mapping relationship table.
[0103] Wherein, the second target coding sequence includes multiple second target codes, and the second target codes in the second target coding sequence correspond one-to-one with the first target codes in the first target coding sequence, and the arrangement order of the second target codes in the second target coding sequence is the same as the arrangement order of the first target codes corresponding to the second target codes in the first target coding sequence;
[0104] The second acquisition unit 30 is used to acquire the first target glyph file;
[0105] The first target glyph file includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes.
[0106] The replacement unit 40 is used to replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code, based on the target mapping relationship table, to obtain the second target glyph file.
[0107] The first sending unit 50 is used to send the second target encoding sequence and the second target glyph file to the client, so that the client can display the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
[0108] In the above implementation method, firstly, a first target encoding sequence is obtained, that is, the original encoding of all characters in the text content to be protected is obtained, and a target mapping relationship table is obtained. Then, based on the first target encoding sequence and the target mapping relationship table, a second target encoding sequence is determined, that is, based on the target mapping relationship table, the original encoding of all characters in the text content to be protected is modified to obtain the modified encoding of all characters in the text content to be protected. Next, a first target glyph file is obtained, that is, the original encoding of all non-repeating characters in the text content to be protected and the glyphs corresponding to the original encodings are obtained. Then, at least according to the target mapping relationship table, the first target encoding corresponding to all target glyphs in the first target glyph file is replaced with the second target encoding corresponding to the first target encoding to obtain the second target glyph file, that is, the original encoding of the glyphs corresponding to all non-repeating characters in the text content to be protected is modified based on the target mapping relationship table. Finally, the second target encoding sequence and the second target glyph file are sent to the client, enabling the client to display the target glyphs corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file, thereby displaying the text content to be protected. In this method, the second target encoding sequence sent by the server to the client is the modified encoding of all the characters in the text content to be protected. The user can only obtain the modified encoding of all the characters in the text content to be protected, but cannot obtain the original encoding of all the characters in the text content to be protected, thus preventing the user from copying the text content. In addition, the server still sends the encoding to the client, not an image, so there will be no display blurring when the page is zoomed in or out, and no new control logic needs to be added. Therefore, it will not affect the original functionality of the page, thus solving the problem that existing methods for preventing users from copying text content cannot simultaneously maintain the original functionality of the page and prevent users from copying text content.
[0109] In one optional implementation, the first acquisition unit includes:
[0110] The first acquisition module is used to acquire a first target integer, wherein the first target integer is any one of a plurality of positive integers;
[0111] Specifically, the first target integer is converted into the base of the first target code and then summed with the first target code.
[0112] The first determining module is used to determine a third target encoding sequence based on the first target encoding sequence, wherein the third target encoding sequence includes multiple first target codes in the first target encoding sequence, and any two first target codes in the third target encoding sequence are different.
[0113] The calculation module is used to calculate at least the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fourth target coding sequence. The fourth target coding sequence includes multiple second target codes, and the second target codes in the fourth target coding sequence correspond one-to-one with the first target codes in the third target coding sequence.
[0114] The second determining module is used to establish the target mapping relationship table based on the third target encoding sequence and the fourth target encoding sequence.
[0115] Specifically, firstly, a first target integer is obtained, which is a random positive integer generated using a random number function. The first target integer is located in the interval (0x01, 0xff). Then, based on the first target encoding sequence, a third target encoding sequence is determined, which is the original encoding of all non-repeating characters in the text content to be protected. After that, the sum of each first target code and the first target integer in the third target encoding sequence is calculated to obtain a fourth target encoding sequence, which is the sum of the original encoding of each non-repeating character in the text content to be protected and the first target integer. Finally, a target mapping table is established based on the third and fourth target encoding sequences. In the target mapping table, the second target code corresponding to the first target code in the third target encoding sequence is the sum of this first target code and the first target integer.
[0116] In one optional implementation, the above-mentioned computing module includes:
[0117] The calculation submodule is used to perform calculation steps, at least calculating the sum of each of the first target codes and the first target integer in the third target coding sequence to obtain a fifth target coding sequence. The fifth target coding sequence includes multiple third target codes, and one of the third target codes is the sum of one of the first target codes and the first target integer in the third target coding sequence.
[0118] The acquisition submodule is used to acquire the second target integer and the third target integer. The second target integer is one of a plurality of positive integers, and the third target integer is any one of a plurality of positive integers. Both the second target integer and the third target integer are greater than zero, and both the second target integer and the third target integer are less than M, where M is the number of the third target codes contained in the fifth target encoding sequence.
[0119] The swapping submodule is used for the swapping step, swapping the third target code with the second target integer in the fifth target encoding sequence and the third target code with the third target integer in the third target encoding sequence.
[0120] Specifically, the subsequent swap is based on the results of the previous swap.
[0121] The repeating submodule is used to repeat the above acquisition steps and the above swapping steps N times to obtain the above fourth target encoding sequence, where N≥M / 2.
[0122] Specifically, firstly, a first target integer is added to the original codes of all non-repeating characters in the text content to be protected, resulting in a fifth target code sequence. Then, a second and third target integer are obtained, i.e., two random positive integers, the first and third target integers, are generated using a random number function. After that, the third target code with the second target integer in the fifth target code sequence and the third target code with the third target integer in the third target code sequence are swapped. The acquisition and swapping steps are repeated N times to obtain a fourth target code sequence, thereby preventing the correspondence between the original codes and the modified codes of all characters in the text content to be protected from being cracked.
[0123] In one optional implementation, the second acquisition unit includes:
[0124] The second acquisition module is used to acquire a third target glyph file, wherein the third target glyph file includes the glyphs of the characters corresponding to all the first target codes in the first target encoding sequence.
[0125] The third determining module is used to determine the first target glyph file based on the third target glyph file.
[0126] Specifically, first, a third target glyph file is obtained, which is to obtain the glyphs corresponding to the original codes of all characters in the text content to be protected. Then, based on the third target glyph file, a first target glyph file is determined, which is to filter out the glyphs corresponding to the original codes of non-repeating characters from the glyphs corresponding to the original codes of all characters in the text content to be protected.
[0127] In one optional implementation, the replacement unit includes:
[0128] The replacement module is used to replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code according to the target mapping relationship table, so as to obtain the third target glyph file.
[0129] The sorting module is used to sort all the coded glyph combinations in the third target glyph file according to the second target code in ascending order, so as to obtain the second target glyph file. One of the coded glyph combinations includes one of the second target codes in the third target glyph file and the target glyph corresponding to the second target code.
[0130] Specifically, firstly, based on the target mapping table, the first target code corresponding to all target glyphs in the first target glyph file is replaced with the second target code corresponding to the first target code, resulting in the third target glyph file. That is, based on the target mapping table, the original codes of the glyphs corresponding to all non-repeating characters in the text content to be protected are modified. Then, according to the second target code in ascending order, all the coded glyph combinations in the third target glyph file are sorted to obtain the second target glyph file. That is, the order of the target glyphs is shuffled, thereby further preventing the correspondence between the original codes and the modified codes of all characters in the text content to be protected from being cracked.
[0131] In one optional implementation, the first transmitting unit includes:
[0132] The first sending module is used to send the aforementioned second target encoded sequence to the aforementioned client;
[0133] The second sending module is used to send the second target glyph file to the client upon receiving the first request instruction sent by the client, wherein the first request instruction is an instruction to request the acquisition of the second target glyph file.
[0134] In an optional embodiment, the above-described apparatus further includes:
[0135] The second sending unit is configured to send a prompt message upon receiving the first request instruction sent by the client again, wherein the prompt message indicates a refusal to send the second target glyph file to the client.
[0136] Specifically, upon receiving the first request instruction from the client again, a prompt message is sent, which refuses to send the second target glyph file to the client, in order to further prevent the correspondence between the original encoding and the modified encoding of all characters in the text content to be protected from being cracked.
[0137] Each piece of text content has a tag, and any two pieces of text content have different tags. In an optional embodiment, the above-mentioned device further includes:
[0138] The third acquisition unit is used to acquire the tag corresponding to the target text content when it receives the second request instruction sent by the client. The second request instruction is an instruction to request the acquisition of the target text content.
[0139] The second determining unit is used to determine whether the tag corresponding to the target text content is located in the configuration table, which only stores the tags of the text content that needs to be protected.
[0140] The third determining unit is used to determine that the target text content is the text content to be protected when the tag corresponding to the target text content is located in the configuration table.
[0141] It should be noted that if the target text content is not the text content to be protected, the original encoding of all characters in the target text content will be sent to the client.
[0142] The aforementioned text content protection device includes a processor and a memory. The first acquisition unit, first determination unit, second acquisition unit, replacement unit, and first sending unit are all stored as program units in the memory. The processor executes these program units stored in the memory to achieve their respective functions. All of the above modules are located in the same processor; alternatively, the modules may be located in different processors in any combination.
[0143] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, the problem of existing methods for preventing users from copying text content being unable to simultaneously maintain the original page functionality and prevent users from copying text content can be solved.
[0144] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0145] This invention provides a computer-readable storage medium including a stored program, wherein the program, when running, controls the device containing the computer-readable storage medium to execute the text content protection method.
[0146] Specifically, text content protection methods include:
[0147] Step S201: Obtain the first target encoding sequence and obtain the target mapping relationship table;
[0148] The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the corresponding characters in the text content to be protected. The target mapping table includes multiple first target codes and multiple second target codes. In the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target code is an encoding that is different from the corresponding first target code.
[0149] Step S202: Determine the second target encoding sequence based on the first target encoding sequence and the target mapping table.
[0150] Wherein, the second target coding sequence includes multiple second target codes, and the second target codes in the second target coding sequence correspond one-to-one with the first target codes in the first target coding sequence, and the arrangement order of the second target codes in the second target coding sequence is the same as the arrangement order of the first target codes corresponding to the second target codes in the first target coding sequence;
[0151] Step S203: Obtain the first target glyph file;
[0152] The first target glyph file includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes.
[0153] Step S204: Replace all the first target codes corresponding to the target glyphs in the first target glyph file with the second target codes corresponding to the first target codes according to the target mapping relationship table above, to obtain the second target glyph file;
[0154] Step S205: Send the second target encoding sequence and the second target glyph file to the client, so that the client displays the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
[0155] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0156] Step S201: Obtain the first target encoding sequence and obtain the target mapping relationship table;
[0157] The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the corresponding characters in the text content to be protected. The target mapping table includes multiple first target codes and multiple second target codes. In the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target code is an encoding that is different from the corresponding first target code.
[0158] Step S202: Determine the second target encoding sequence based on the first target encoding sequence and the target mapping table.
[0159] Wherein, the second target coding sequence includes multiple second target codes, and the second target codes in the second target coding sequence correspond one-to-one with the first target codes in the first target coding sequence, and the arrangement order of the second target codes in the second target coding sequence is the same as the arrangement order of the first target codes corresponding to the second target codes in the first target coding sequence;
[0160] Step S203: Obtain the first target glyph file;
[0161] The first target glyph file includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes.
[0162] Step S204: Replace all the first target codes corresponding to the target glyphs in the first target glyph file with the second target codes corresponding to the first target codes according to the target mapping relationship table above, to obtain the second target glyph file;
[0163] Step S205: Send the second target encoding sequence and the second target glyph file to the client, so that the client displays the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
[0164] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0165] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0166] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0167] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0170] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0171] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0172] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0173] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0174] 1) In the text content protection method of this application, firstly, a first target encoding sequence is obtained, that is, the original encoding of all characters in the text content to be protected is obtained, and a target mapping relationship table is obtained. Then, according to the first target encoding sequence and the target mapping relationship table, a second target encoding sequence is determined, that is, the original encoding of all characters in the text content to be protected is modified based on the target mapping relationship table to obtain the modified encoding of all characters in the text content to be protected. After that, a first target glyph file is obtained, that is, the original encoding of all non-repeating characters in the text content to be protected and the glyphs corresponding to the original encodings are obtained. Then, at least according to the target mapping relationship table, the first target encoding corresponding to all target glyphs in the first target glyph file is replaced with the second target encoding corresponding to the first target encoding to obtain the second target glyph file, that is, the original encoding of the glyphs corresponding to all non-repeating characters in the text content to be protected is obtained based on the target mapping relationship table. After modification, the second target encoding sequence and the second target glyph file are sent to the client. The client then displays the target glyphs corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file, thereby displaying the text content to be protected. In this method, the second target encoding sequence sent by the server to the client is the modified encoding of all the characters in the text content to be protected. The user can only obtain the modified encoding of all the characters in the text content to be protected, but cannot obtain the original encoding of all the characters in the text content to be protected, thus preventing the user from copying the text content. In addition, the server still sends the encoding to the client, not an image, so there will be no display blurring when the page is zoomed in or out, and no new control logic needs to be added. Therefore, it will not affect the original function of the page, thus solving the problem that existing methods for preventing users from copying text content cannot simultaneously maintain the original function of the page and prevent users from copying text content.
[0175] 2) In the text content protection device of this application, firstly, a first target encoding sequence is obtained, that is, the original encoding of all characters in the text content to be protected is obtained, and a target mapping relationship table is obtained. Then, according to the first target encoding sequence and the target mapping relationship table, a second target encoding sequence is determined, that is, the original encoding of all characters in the text content to be protected is modified based on the target mapping relationship table to obtain the modified encoding of all characters in the text content to be protected. After that, a first target glyph file is obtained, that is, the original encoding of all non-repeating characters in the text content to be protected and the glyphs corresponding to the original encodings are obtained. Then, at least according to the target mapping relationship table, the first target encoding corresponding to all target glyphs in the first target glyph file is replaced with the second target encoding corresponding to the first target encoding to obtain the second target glyph file, that is, the original encoding of the glyphs corresponding to all non-repeating characters in the text content to be protected is obtained based on the target mapping relationship table. After modification, the second target encoding sequence and the second target glyph file are sent to the client. The client then displays the target glyphs corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file, thereby displaying the text content to be protected. In this method, the second target encoding sequence sent by the server to the client is the modified encoding of all the characters in the text content to be protected. The user can only obtain the modified encoding of all the characters in the text content to be protected, but cannot obtain the original encoding of all the characters in the text content to be protected, thus preventing the user from copying the text content. In addition, the server still sends the encoding to the client, not an image, so there will be no display blurring when the page is zoomed in or out, and no new control logic needs to be added. Therefore, it will not affect the original function of the page, thus solving the problem that existing methods for preventing users from copying text content cannot simultaneously maintain the original function of the page and prevent users from copying text content.
[0176] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for protecting text content, characterized in that, The text content protection method is applied to a server, and the method includes: Obtain a first target encoding sequence and a target mapping table. The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the characters corresponding to the first target codes in the text content to be protected. The target mapping table includes multiple first target codes and multiple second target codes. In the target mapping table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target codes are codes that are different from the corresponding first target codes. Based on the first target encoding sequence and the target mapping table, a second target encoding sequence is determined. The second target encoding sequence includes multiple second target codes, and the second target codes in the second target encoding sequence correspond one-to-one with the first target codes in the first target encoding sequence. The order of the second target codes in the second target encoding sequence is the same as the order of the first target codes corresponding to the second target codes in the first target encoding sequence. Obtain a first target glyph file, which includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes. At least according to the target mapping relationship table, replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code to obtain the second target glyph file; The second target encoding sequence and the second target glyph file are sent to the client, so that the client displays the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
2. The method according to claim 1, characterized in that, Obtain the target mapping table, including: Obtain the first target integer, which is any one of a plurality of positive integers; Based on the first target coding sequence, a third target coding sequence is determined, wherein the third target coding sequence includes multiple first target codes in the first target coding sequence, and any two first target codes in the third target coding sequence are different; At least the sum of each of the first target codes in the third target coding sequence and the first target integer is calculated to obtain a fourth target coding sequence. The fourth target coding sequence includes a plurality of second target codes, and the second target codes in the fourth target coding sequence correspond one-to-one with the first target codes in the third target coding sequence. The target mapping table is established based on the third target encoding sequence and the fourth target encoding sequence.
3. The method according to claim 2, characterized in that, At least the sum of each of the first target codes and the first target integer in the third target encoding sequence is calculated to obtain the fourth target encoding sequence, including: The calculation steps include at least calculating the sum of each of the first target codes in the third target coding sequence and the first target integer to obtain a fifth target coding sequence. The fifth target coding sequence includes multiple third target codes, and each third target code is the sum of one of the first target codes in the third target coding sequence and the first target integer. The acquisition step involves acquiring a second target integer and a third target integer. The second target integer is one of a plurality of positive integers, and the third target integer is any one of a plurality of positive integers. Both the second target integer and the third target integer are greater than zero, and both the second target integer and the third target integer are less than M, where M is the number of the third target codes contained in the fifth target encoding sequence. The swapping step involves swapping the third target code whose sequence number is the second target integer and the third target code whose sequence number is the third target integer in the fifth target encoding sequence; Repeat the acquisition step and the swapping step N times to obtain the fourth target encoding sequence, where N≥M / 2.
4. The method according to claim 1, characterized in that, Obtaining the first target glyph file also includes: Obtain a third target glyph file, the third target glyph file including the glyphs of the characters corresponding to all the first target codes in the first target encoding sequence; The first target glyph file is determined based on the third target glyph file.
5. The method according to claim 1, characterized in that, The method at least involves replacing the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code, based on the target mapping relationship table, to obtain the second target glyph file, and further includes: According to the target mapping relationship table, replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code to obtain the third target glyph file; Sort all the coded glyph combinations in the third target glyph file according to the second target code in ascending order to obtain the second target glyph file. Each coded glyph combination includes a second target code in the third target glyph file and the target glyph corresponding to the second target code.
6. The method according to claim 1, characterized in that, Sending the second target encoding sequence and the second target glyph file to the client includes: The second target encoded sequence is sent to the client; Upon receiving a first request instruction from the client, the second target glyph file is sent to the client, wherein the first request instruction is an instruction to request the acquisition of the second target glyph file.
7. The method according to claim 6, characterized in that, After receiving a first request instruction from the client, and sending the second target glyph file to the client, the method further includes: Upon receiving the first request instruction from the client again, a prompt message is sent, indicating that the sending of the second target glyph file to the client is refused.
8. The method according to claim 1, characterized in that, Each text content has a label, and any two text contents have different labels. Before obtaining the first target encoding sequence and the target mapping table, the method further includes: Upon receiving a second request instruction sent by the client, the tags corresponding to the target text content are obtained, wherein the second request instruction is an instruction to request the target text content; Determine whether the tag corresponding to the target text content is located in the configuration table, which only stores tags of text content that needs to be protected; If the tag corresponding to the target text content is located in the configuration table, the target text content is determined to be the text content to be protected.
9. A text content protection device, characterized in that, The text content protection device is applied to a server, and the device includes: The first acquisition unit is used to acquire a first target encoding sequence and acquire a target mapping relationship table. The first target encoding sequence includes multiple first target codes, each first target code being the encoding of a character in the text content to be protected. The order of the first target codes in the first target encoding sequence is the same as the order of the characters corresponding to the first target codes in the text content to be protected. The target mapping relationship table includes multiple first target codes and multiple second target codes. In the target mapping relationship table, any two first target codes are different, any two second target codes are different, the first target codes and the second target codes are in one-to-one correspondence, and the second target codes are codes that are different from the corresponding first target codes. The first determining unit is configured to determine a second target encoding sequence based on the first target encoding sequence and the target mapping relationship table. The second target encoding sequence includes a plurality of second target codes, and the second target codes in the second target encoding sequence correspond one-to-one with the first target codes in the first target encoding sequence. The order of the second target codes in the second target encoding sequence is the same as the order of the first target codes corresponding to the second target codes in the first target encoding sequence. The second acquisition unit is used to acquire a first target glyph file. The first target glyph file includes multiple first target codes and multiple target glyphs. In the first target glyph file, the first target codes and the target glyphs correspond one-to-one. Any two first target codes are different, and any two target glyphs are different. The target glyphs are the glyphs of the characters corresponding to the first target codes. The replacement unit is configured to replace the first target code corresponding to all the target glyphs in the first target glyph file with the second target code corresponding to the first target code, based at least on the target mapping relationship table, to obtain the second target glyph file; The first sending unit is configured to send the second target encoding sequence and the second target glyph file to the client, so that the client displays the target glyph corresponding to the second target encoding in the second target encoding sequence according to the second target glyph file.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the text content protection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Anti-crawler data processing method, device, system and storage medium
CN110990799A
Anti-crawler method and device
CN112182603A
