A text-based data stealth writing method and system
By writing third-party information in the microsecond part of the timestamp and using GB2312 encoding and verification code to generate an XOR value, the problem of data changes in structured data protection in the prior art is solved, and the effect of providing protection without affecting data use in data asset security management is achieved.
Patent Information
- Application Number
- CN202210518295.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-05-12
AI Technical Summary
When existing data cryptography technology protects structured data, it usually changes the original data, affecting the correctness of data search, comparison and analysis operations, and it is difficult to provide protection without affecting data use in data asset security management.
A text-based data secret writing method is adopted to randomly write third-party information into the microsecond part of the timestamp, use GB2312 area code, bit number and sequence number to generate a check code, and write different partitions of the timestamp through XOR operation to ensure the concealment and extractability of the information.
Without changing the original data, structured data is provided to ensure that the use of data is not affected, and at the same time, it realizes hidden and efficient extraction of third-party information.
Smart Images

Figure CN115017477B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data asset security management, and in particular, relates to a text-based data secret writing method and system. Background Art
[0002] Data steganography is a technology for hiding information. It can hide relevant information in related files or data through data steganography. It is used in areas such as digital copyright protection.
[0003] Secret writing technology is generally used in unstructured files such as video files, image files, audio files, and semi-structured files such as XML and JSON.
[0004] For ordinary text data, information is generally hidden by adding methods such as changing the case, adding spaces, redundant information, punctuation marks, etc. at specified locations. There is also a method of encoding the hidden information with zero-width characters and then writing it into the text, such as the "Text Watermark Embedding and Extraction Method Based on Unicode Encoding" with application number 201610939806.6. However, these methods cannot be applied to the field of data asset security management. The reason is that no matter whether it is the method of changing the case, adding spaces, or using zero-width characters, the original data is changed, which affects the correctness of the results of operations such as searching, comparing, and analyzing the data. Summary of the invention
[0005] In view of the problems existing in the above background technology introduction, the purpose of the present invention is to provide a text-based data stealth method and system for providing protection for structured data without affecting the use of data in data asset security management.
[0006] The technical solution adopted by the present invention is:
[0007] A text-based data stealth method randomly writes third-party information into the timestamp data in the data to be distributed. The specific steps are as follows:
[0008] Step (1), partitioning the microsecond part of the timestamp into zone 1, zone 2, and zone 3, and obtaining third-party information and its corresponding GB2312 zone code, bit number, and sequence number;
[0009] Step (2), take the first character of the third-party information and select the timestamp value corresponding to any record;
[0010] Step (3), set the third area of the timestamp value selected in step (2) to 00, write the GB2312 area code of the first character into the second area of the timestamp value, calculate the second area and the third area to generate a check code and write it into the first area of the timestamp value;
[0011] Step (4), taking the next character of the third-party information and selecting the timestamp value corresponding to the next record;
[0012] Step (5), taking the GB2312 area code and bit number of the character in step (4), and obtaining the sequence number of the character at the same time, writing the current area code into the second area of the timestamp value selected in step (4), writing the bit number of the previous character into the third area of the timestamp value, and calculating the area code and bit number of the previous character to generate a check code, performing an XOR operation on the check code and the sequence number of the previous character, and then writing the result into the first area of the timestamp value;
[0013] Step (6), determining whether the characters of the third-party information have been processed, if not, repeating steps (4) and (5), if yes, proceeding to step (7);
[0014] Step (7), select the timestamp value corresponding to the next record, set its second area to 00, write the bit number of the last character in the third area, and write the XOR value of the checksum of the last character and the sequence number in the first area.
[0015] Furthermore, the generation formula of the verification code is:
[0016]
[0017] Where i represents the position number of the numerical characters in the second and third areas of the microsecond part from right to left; a i Represents the value at the i-th position; W j Represents the weighting factor at the i-th position. The calculation formula of the weighting factor is: W j =2 i-1 (mod 32).
[0018] Furthermore, the data to be distributed contains a timestamp field. If there is no timestamp field, a date or date time field is selected, the type is changed to a timestamp type and its hours, minutes, seconds and microseconds are randomly filled. If there is no date or date time or timestamp type field, a timestamp field is added and a timestamp is randomly generated.
[0019] Furthermore, the number of characters in the third-party information does not exceed 95. The purpose of using modulo 32 and limiting the number of Chinese characters to 95 is to maximize the number of processed characters while ensuring that the result of the generated check code and sequence number after XOR calculation does not exceed 99.
[0020] Furthermore, each area of the microsecond part is a two-digit digital character.
[0021] Furthermore, the steps for extracting third-party information after secret writing are as follows:
[0022] Step 1, select the record whose timestamp field value in the microsecond part of the third area is "00" and the check code of the first area meets the check rule, and obtain the value of the second area of the microsecond part of the timestamp of the record with the corresponding sequence number. If the value is greater than 0, it means that there are still characters to be extracted;
[0023] Step 2, select the next record, the value stored in the first area of the microsecond part of the record is XORed with the serial number of the previous record to obtain a check code equal to the value of the second area of the microsecond part of the timestamp of the previous record and the value of the third area of the microsecond part of the timestamp of this record, and obtain the serial number of the record, combine the value of the second area of the previous record with the value of the third area of the current record, and obtain the corresponding character through the GB2312 area number check, and determine whether the value of the second area of the record is 0. If not, repeat step 2. If yes, it means that the character extraction is completed.
[0024] A system based on the above-mentioned secret writing method comprises:
[0025] A record selection module is used to select records corresponding to timestamp values;
[0026] A partitioning module for partitioning the microsecond portion of a timestamp value;
[0027] An information acquisition module is used to acquire third-party information, and acquire the GB2312 area code, bit number and sequence number of the third-party information;
[0028] A writing module, used to write the GB2312 area code and bit number, sequence number and check code obtained according to each character of the third-party information into the partition corresponding to the timestamp;
[0029] The determination module is used to determine whether all characters of the third-party information have been written.
[0030] Furthermore, it also includes a check code generation module for generating a check code from the second area and the third area of the microsecond part.
[0031] Furthermore, it also includes an XOR module, which is used to perform an XOR operation on the check code and the sequence number to obtain an XOR value.
[0032] Furthermore, the partition module divides the microsecond part into zone one, zone two, and zone three, the writing module writes the check code and sequence number into zone one, the GB2312 zone code of the character into zone two, and the bit number of the character into zone three.
[0033] Compared with the prior art, the present invention has the following significant advantages: providing protection for structured data without affecting data usage in data asset security management. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1It is a flowchart of the present invention;
[0035] Figure 2 It is a schematic diagram of three areas for writing information of the present invention;
[0036] Figure 3 It is the dislocation method of the present invention;
[0037] Figure 4 It is the object for obtaining the check code and sequence code of the present invention;
[0038] Figure 5 It is a system block diagram of the present invention. DETAILED DESCRIPTION
[0039] The present invention is further described below in conjunction with specific embodiments, but the present invention is not limited to these specific embodiments. Those skilled in the art should recognize that the present invention covers all possible alternatives, improvements and equivalents within the scope of the claims.
[0040] Embodiment 1
[0041] See also Figure 1 This embodiment discloses a text-based data stealth writing method, which randomly writes third-party information into the timestamp data in the data to be distributed. The specific steps are as follows:
[0042] Step (1), partitioning the microsecond part of the timestamp into zone 1, zone 2, and zone 3, and obtaining third-party information and its corresponding GB2312 zone code, bit number, and sequence number;
[0043] Step (2), take the first character of the third-party information and select the timestamp value corresponding to any record;
[0044] Step (3), set the third area of the timestamp value selected in step (2) to 00, write the GB2312 area code of the first character into the second area of the timestamp value, calculate the second area and the third area to generate a check code and write it into the first area of the timestamp value;
[0045] Step (4), taking the next character of the third-party information and selecting the timestamp value corresponding to the next record;
[0046] Step (5), taking the GB2312 area code and bit number of the character in step (4), and obtaining the sequence number of the character at the same time, writing the current area code into the second area of the timestamp value selected in step (4), writing the bit number of the previous character into the third area of the timestamp value, and calculating the area code and bit number of the previous character to generate a check code, performing an XOR operation on the check code and the sequence number of the previous character, and then writing the result into the first area of the timestamp value;
[0047] Step (6), determining whether the characters of the third-party information have been processed, if not, repeating steps (4) and (5), if yes, proceeding to step (7);
[0048] Step (7), select the timestamp value corresponding to the next record, set its second area to 00, write the bit number of the last character in the third area, and write the XOR value of the checksum of the last character and the sequence number in the first area.
[0049] The generation formula of the check code in this embodiment is:
[0050]
[0051] Where i represents the position number of the numerical characters in the second and third areas of the microsecond part from right to left; a i Represents the value at the i-th position; W j Represents the weighting factor at the i-th position. The calculation formula of the weighting factor is: W j =2 i-1 (mod 32).
[0052] In this embodiment, the data to be distributed contains a timestamp field. If there is no timestamp field, a date or date time field is selected, the type is changed to a timestamp type, and its hours, minutes, seconds, and microseconds are randomly filled. If there is no date or date time or timestamp type field, a timestamp field is added and a timestamp is randomly generated.
[0053] The number of characters of the third-party information (company or personal information) described in this embodiment does not exceed 95 characters. If it exceeds, the abbreviation method can be used to limit the number of characters to within 95. The purpose of using modulo 32 and limiting to within 95 Chinese characters in the present invention is to maximize the number of processed characters while ensuring that the result of the generated check code and sequence number after XOR calculation does not exceed 99.
[0054] In this embodiment, each area of the microsecond part is a two-digit digital character. Figure 2 The check code information and sequence number are written in the first area, the area code corresponding to the GB2312 encoding of the character is written in the second area, and the corresponding bit number is written in the third area. Obviously, writing the sequence number and check information in the first area is obviously not enough, and the problem is solved by using the check information and the sequence number to merge through the XOR operation.
[0055] The steps for extracting the third-party information after secret writing in this embodiment are as follows:
[0056] Step 1, select the record whose timestamp field value in the microsecond part of the third area is "00" and the check code of the first area meets the check rule, and obtain the value of the second area of the microsecond part of the timestamp of the record with the corresponding sequence number. If the value is greater than 0, it means that there are still characters to be extracted;
[0057] Step 2, select the next record, the value stored in the first area of the microsecond part of the record is XORed with the serial number of the previous record to obtain a check code equal to the value of the second area of the microsecond part of the timestamp of the previous record and the value of the third area of the microsecond part of the timestamp of this record, and obtain the serial number of the record, combine the value of the second area of the previous record with the value of the third area of the current record, and obtain the corresponding character through the GB2312 area number check, and determine whether the value of the second area of the record is 0. If not, repeat step 2. If yes, it means that the character extraction is completed.
[0058] The present invention adopts the "offset method" to solve the writing problem of the start and end, that is, use the timestamp field value on the n+1 record to write n Chinese characters, and put the area code of the nth Chinese character in the position of the area code of the n+1th Chinese character. In this way, 0 can be set at the area code position of the first Chinese character to indicate the start, and the position number on the last record can be set to 0 to indicate the end. The processing method of the "offset method" is shown in Figure 3 Except for the check code at the beginning, the rest of the check codes and sequence numbers are the area code and bit number of GB2312 corresponding to the nth character, as shown below Figure 4 shown.
[0059] In daily data asset management work, according to normal business needs, exporting data or distributing it to a third party through an interface is a common operation behavior. Once the data is distributed to a third party, it is difficult to ensure that the data is not leaked. In order to write third-party information without affecting the normal use of the data, the present invention provides a technical means for writing third-party information into structured data.
[0060] This embodiment provides a specific application, as follows:
[0061] Assume that the business system needs to export data to a file or distribute it to a third party through an interface. The data to be exported contains a timestamp field named "modification time" and the name of the third-party information is "Zhang Laosan".
[0062] The exported sample data is shown in Table 1:
[0063] Table 1 Example data exported
[0064] Field A Field B Modification time Serial number **** **** 2001-02-03 04:05:01.192660 1 **** **** 2001-02-03 04:05:02.769009 2 **** **** 2001-02-03 04:05:03.501878 3 **** **** 2001-02-03 04:05:04.235667 4 **** **** 2001-02-03 04:05:05.760094 5 **** **** 2001-02-03 04:05:06.657981 6 **** **** 2001-02-03 04:05:07.215559 7 **** **** 2001-02-03 04:05:08.935108 8 **** **** 2001-02-03 04:05:09.376484 9 **** **** 2001-02-03 04:05:10.454711 10 **** **** 2001-02-03 04:05:11.061217 11
[0065] Step (1) obtains third-party information, which is: "Zhang Laosan", and its corresponding GB2312 area code, bit number and sequence number are shown in Table 2:
[0066] Table 2 Area code, bit number and sequence diagram corresponding to characters GB2312
[0067] character Sequence Number Area Code Position No. open 1 53 37 old 2 32 47 three 3 40 93
[0068] In step (2), take the first character "Zhang", and randomly select a record (assuming the serial number is 1) corresponding to the value of the timestamp field 2001-02-03 04:05:01.192660.
[0069] In step (3), set the three - zone in this timestamp to zero, and write the area code corresponding to this character in GB2312 to the two - zone. The value of the microsecond part is: 195300.
[0070] Calculate the check code and put it into the one - zone. The calculation method is shown in Table 3 below:
[0071] Table 3
[0072]
[0073] Calculate x in 52 + x ≡ 1 (mod 32), and get the check code as 13. Write 13 into the one - zone. The result of the microsecond part is 135300. That is, the timestamp value corresponding to the record serial number 1 changes from the original 2001-02-03 04:05:01.192660 to 2001-02-03 04:05:01.135300.
[0074] In step (4), take the second character "Lao", and randomly select one of the remaining records (serial number 3) corresponding to the value of the timestamp field 2001-02-03 04:05:03.501878.
[0075] In step (5), write the position number corresponding to the previous character "Zhang" in GB2312 to the three - zone, and write the area code corresponding to this character "Lao" in GB2312 to the two - zone. The result of the microsecond part is 503237.
[0076] Calculate the check code for the two - zone in the previous record's timestamp and the three - zone in this record's timestamp (i.e., the area code and position number corresponding to the character "Zhang" in GB2312). The calculation process is shown in Table 4:
[0077] Table 4
[0078]
[0079] Calculate x in 65 + x ≡ 1 (mod 32), and get the check code as 30. Calculate the exclusive - OR of the check code 30 and the serial number 1 of the character "Zhang", and the result is 31. Write 31 into the one - zone of this record's timestamp. The value of the microsecond part is 313237. That is, the timestamp value corresponding to the record serial number 3 changes from the original 2001-02-03 04:05:03.501878 to 2001-02-03 04:05:03.313237.
[0080] Step (6) Take the third character '三', randomly select the value of the timestamp field corresponding to the remaining one record (sequence number 9), which is 2001-02-03 04:05:09.376484, write the bit number corresponding to the previous character '老' in GB2312 in the third area, write the area number corresponding to this character '三' in GB2312 in the second area, and the result of the microsecond part is 374047.
[0081] Calculate the checksum for the second area in the timestamp of the previous record and the third area in the timestamp of this record (i.e., the area number and bit number corresponding to the character '老' in GB2312). The calculation process is shown in Table 5:
[0082] Table 5
[0083]
[0084] Calculate x in 47 + x ≡ 1 (mod 32) to get the checksum as 18. Calculate the exclusive OR of the checksum 18 and the sequence number 2 of the character '老', and the result is 16. Write 16 into the first area in the timestamp of this record, and the value of the microsecond part is 164047. That is, the timestamp value corresponding to the record sequence number 3 changes from the original 2001-02-03 04:05:09.376484 to 2001-02-03 04:05:09.164047.
[0085] Step (7) Randomly select the value of the timestamp field corresponding to the remaining one record (sequence number 10), which is 2001-02-03 04:05:10.454711, write the bit number corresponding to the previous character '三' in GB2312 in the third area, set the second area to 00, and the result of the microsecond part is 450093.
[0086] Calculate the checksum for the second area in the timestamp of the previous record and the third area in the timestamp of this record (i.e., the area number and bit number corresponding to the character '三' in GB2312). The calculation process is shown in Table 6:
[0087] Table 6
[0088]
[0089] Calculate x in 53 + x ≡ 1 (mod 32) to get the checksum as 12. Calculate the exclusive OR of the checksum 12 and the sequence number 3 of the character '三', and the result is 15. Write 15 into the first area in the timestamp of this record, and the value of the microsecond part is 150093. That is, the timestamp value corresponding to the record sequence number 10 changes from the original 2001-02-03 04:05:10.454711 to 2001-02-03 04:05:10.150093.
[0090] The result output after the entire processing is as follows:
[0091]
[0092] The steps of information extraction are as follows:
[0093] Step 1: Select the records in which the three - zone value in the microsecond part of the timestamp field in the record is "00" and the check code in the first zone conforms to the check rule. Obtain the value 53 in the second zone of the microsecond of the record timestamp with serial number 1. Since 53 is greater than 0, it indicates that there are still characters to be extracted.
[0094] Step 2: Set the serial number value iOrder = 1. Select the next record. The selection condition is that the value obtained by performing an exclusive - OR calculation between the value stored in the first zone of the microsecond part and the character serial number iOrder is equal to the check code of the combined data of the value 53 and the three - zone value of its timestamp microsecond part. Obtain the record with serial number 3. Combine 53 with the value in the three - zone of the record timestamp microsecond to get 5337. Through the GB2312 area code check, obtain the character "Zhang". At the same time, take the value 32 in the second zone. Since 32 is greater than 0, it indicates that there are still characters to be extracted.
[0095] Step 3: Increment iOrder by 1. Use the same method as in Step 2 to select the next record, and obtain the record with serial number 9. Combine 32 with the value 47 in the microsecond part of the record timestamp to get 3247. Through the GB2312 area code check, obtain the character "Lao". At the same time, take the value 40 in the second zone. Since 40 is greater than 0, it indicates that there are still characters to be extracted.
[0096] Step 4: Increment iOrder by 1. Use the same method as in Step 2 to select the next record, and obtain the record with serial number 10. Combine 40 with the value 93 in the microsecond part of the record timestamp to get 4093. Through the GB2312 area code check, obtain the character "San". At the same time, take the value 00 in the second zone. Since 00 is equal to 0, it indicates that the character extraction is completed.
[0097] Finally, obtain the character information "Zhang Laosan".
[0098] In the data asset security management of the present invention, without affecting data usage, protection is provided for structured data. The third - party information is directly encoded and written into the timestamp. Through the timestamp, the hidden third - party information can be directly restored, as long as the characters of the third - party information are within 95 Chinese characters. At the same time, in order to increase the recognition of the hidden information, check information is added.
[0099] Embodiment 2
[0100] Refer to Figure 5 , this embodiment provides a system based on the hidden - writing method described in Embodiment 1, which includes:
[0101] A record selection module 1, used for selecting records corresponding to timestamp values;
[0102] Partition module 2, used to partition the microsecond part of the timestamp value;
[0103] Information acquisition module 3, used to acquire third-party information, and acquire the GB2312 area code, bit number and sequence number of the third-party information;
[0104] Writing module 4, used for writing the GB2312 area code and bit number, sequence number and check code obtained according to each character of the third-party information into the partition corresponding to the timestamp;
[0105] A determination module 5, used to determine whether all characters of the third-party information have been written;
[0106] The check code generating module 6 is used to generate a check code from the second area and the third area of the microsecond part.
[0107] The XOR module 7 is used to perform an XOR operation on the check code and the sequence number to obtain an XOR value.
[0108] The partition module of this embodiment divides the microsecond part into zone 1, zone 2, and zone 3, and the writing module writes the check code and sequence number into zone 1, the GB2312 zone code of the character into zone 2, and the bit number of the character into zone 3. The present invention adopts the "dislocation method" to solve the writing problem of the start and end, that is, the timestamp field value on the n+1 record is used to write n Chinese characters, and the zone code of the nth Chinese character is placed in the position of the zone code of the n+1th Chinese character, so that 0 can be set at the zone code position of the first Chinese character to indicate the start, and the bit number on the last record is set to 0 to indicate the end.
Claims
1. A text-based data stealth method, in which third-party information is randomly written into the timestamp data in the data to be distributed, characterized in that: The specific steps are as follows: Step (1), partition the microsecond part of the timestamp into zone 1, zone 2, and zone 3, and obtain the third-party information and its corresponding GB2312 zone code, bit number, and sequence number; Step (2), take the first character of the third-party information and select the timestamp value corresponding to any record; Step (3), set the third area of the timestamp value selected in step (2) to 00, write the GB2312 area code of the first character into the second area of the timestamp value, calculate the second area and the third area to generate a check code and write it into the first area of the timestamp value; Step (4), take the next character of the third-party information and select the timestamp value corresponding to the next record; Step (5), taking the GB2312 area code and bit number of the character in step (4), and obtaining the sequence number of the character at the same time, writing the current area code into the second area of the timestamp value selected in step (4), writing the bit number of the previous character into the third area of the timestamp value, and calculating the area code and bit number of the previous character to generate a check code, performing an XOR operation on the check code and the sequence number of the previous character and writing them into the first area of the timestamp value; the generation formula of the check code is: ≡1 , Where i represents the position number of the numerical characters in the second and third areas of the microsecond part from right to left; Represents the value at the i-th position; represents the weighting factor at the i-th position, and the calculation formula of the weighting factor is: = ; Step (6), determining whether the characters of the third-party information have been processed. If not, repeating steps (4) and (5). If yes, proceeding to step (7); Step (7), select the timestamp value corresponding to the next record, set its second area to 00, write the bit number of the last character in the third area, and write the XOR value of the checksum of the last character and the sequence number in the first area.
2. A text-based data stealth method according to claim 1, characterized in that: The data to be distributed contains a timestamp field. If there is no timestamp field, select the date or date time field, change the type to the timestamp type and randomly fill in its hours, minutes, seconds and microseconds. If there is no date or date time or timestamp type field, add a timestamp field and randomly generate a timestamp.
3. A text-based data stealth method according to claim 1, characterized in that: The third-party information may not exceed 95 characters.
4. A text-based data stealth method according to claim 1, characterized in that: Each area of the microsecond portion is a two-digit numeric character.
5. The text-based data stealth method according to claim 1, characterized in that: The steps to extract third-party information after secret writing are as follows: Step 1, select the record whose timestamp field value in the microsecond part of the third area is "00" and the check code of the first area meets the check rule, and obtain the value of the second area of the microsecond part of the timestamp of the record with the corresponding sequence number. If the value is greater than 0, it means that there are still characters to be extracted; Step 2, select the next record, the value stored in the first area of the microsecond part of the record is XORed with the serial number of the previous record to obtain a check code equal to the value of the second area of the microsecond part of the timestamp of the previous record and the value of the third area of the microsecond part of the timestamp of this record, and obtain the serial number of the record, combine the value of the second area of the previous record with the value of the third area of the current record, and obtain the corresponding character through the GB2312 area number check, and determine whether the value of the second area of the record is 0. If not, repeat step 2. If yes, it means that the character extraction is completed.
6. A system based on the text-based data stealth writing method according to claim 1, characterized in that: It includes: A record selection module is used to select records corresponding to timestamp values; A partitioning module for partitioning the microsecond portion of a timestamp value; An information acquisition module is used to acquire third-party information, and acquire the GB2312 area code, bit number and sequence number of the third-party information; A writing module, used to write the GB2312 area code and bit number, sequence number and check code obtained from each character of the third-party information into the partition corresponding to the timestamp; The determination module is used to determine whether all characters of the third-party information have been written.
7. The system of the text-based data stealth method according to claim 6 is characterized in that: It also includes a check code generation module, which is used to generate a check code from the second area and the third area of the microsecond part.
8. The system of the text-based data stealth method according to claim 6, characterized in that: It also includes an XOR module, which is used to perform an XOR operation on the check code and the sequence number to obtain an XOR value.
9. The system of the text-based data stealth writing method according to claim 6, characterized in that: The partition module divides the microsecond part into zone one, zone two and zone three, the writing module writes the check code and sequence number into zone one, the GB2312 zone number of the character into zone two, and the bit number of the character into zone three.
Citation Information
Patent Citations
Unicode-based text watermark embedding and extraction method
CN106570356B
Information identification method and device, equipment and storage medium
CN113472686A
Method for writing data to an electrophoretic display panel
WO1993006585A1