Adaptive masking method and system, and device and medium

By adaptively generating sensitive vocabulary and regular expressions, combined with multi-threaded concurrent processing and iterative algorithms, the problem that data desensitization methods in existing technologies are unable to resist attacks and maintain readability is solved, and safe and efficient data desensitization is achieved.

WO2025200263A1PCT designated stage Publication Date: 2025-10-02CHENGDU AIRCRAFT INDUSTRY GROUP

Patent Information

Application Number
PCT/CN2024/114259
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-26
Filing Date
2024-08-23
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

Existing data desensitization methods cannot effectively resist collusion attacks and brute force enumeration attacks, and cannot maintain the readability and security of desensitized data.

Method used

By obtaining the keywords of the sender user, adding, deleting and modifying the sensitive word library, generating regular expressions, locating the sensitive words, and adopting multi-threaded concurrent processing, using an iterative algorithm to replace sensitive words and generate a desensitized file.

Benefits of technology

It realizes adaptive desensitization of various types of data, keeps the data type unchanged, improves the desensitization speed and security, prevents the leakage of important information, and ensures the readability of desensitized files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024114259_02102025_PF_FP_ABST
    Figure CN2024114259_02102025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data security, and in particular to an adaptive masking method and system, and a device and a medium. The method comprises: firstly, acquiring a keyword of a current file to be masked of a sender user; then, on the basis of the keyword, performing addition, deletion and modification on a current sensitive word library to obtain a new sensitive word library; and finally, generating a regular expression on the basis of the new sensitive word library, determining the positions of sensitive words on the basis of the regular expression, so as to obtain the sensitive words, and performing masking to obtain a masked file. Therefore, masking of a plurality of types of data is realized, and data types before and after masking remain unchanged, thereby ensuring the readability of a masked file while guaranteeing the security of masked data, and further increasing the masking speed; on the basis of different roles of receiver and sender users, the masking intensity is adaptively selected, thereby preventing important information from being leaked to untrusted persons, and overcoming the defect of an existing masking algorithm failing to resist collusion attacks and brute-force enumeration attacks; and multiple threads are used to concurrently process sensitive word retrieval and sensitive-word masking operations, thereby greatly increasing the masking speed.
Need to check novelty before this filing date? Find Prior Art

Description

Adaptive desensitization method, system, device and medium Technical Field

[0001] The present invention relates to the field of data security technology, and in particular to an adaptive desensitization method, system, device and medium. Background Art

[0002] The adaptive data desensitization method of the prior art comprises the following steps: step one, data extraction utilizes Sqoop technology to extract from common databases, time series databases, and files or FTP interfaces, and the data extraction process ensures the integrity of the original data and the complete logical relationship between the data; step two, data desensitization realizes the conversion of sensitive data by the desensitization algorithm in the data desensitization algorithm library, maintains the relevance and integrity of the data during the desensitization process, and ensures the consistency of the data in the same system; step three, data distribution After data desensitization, it is distributed through databases, files, and FTP interfaces. The present invention is guided by application needs and uses a desensitization strategy to drive the method for dynamically generating desensitization rules, so that the desensitization results are based on evidence and are repeatable. The use cost is low and it is convenient for the expansion of algorithms and applications.

[0003] This desensitization method, based on a desensitization rule library, locates sensitive words before file transfer using regular expression matching and other methods. It then performs operations such as truncation, shifting, and replacement on sensitive fields according to the corresponding rules in the desensitization rule library. For numeric data, existing truncation and shifting operations are incapable of resolving brute-force enumeration attacks. For character data, existing replacement operations lack the ability to resist collusion attacks. Multiple attackers can decipher the true sensitive fields by jointly reviewing the desensitized document.

[0004] Summary of the Invention

[0005] Aiming at the problem that existing data desensitization methods are unable to resist common media attacks and profiteering enumeration attacks, the present invention proposes an adaptive desensitization method, system, device and medium. First, the keywords of the current file to be desensitized by the sender user are obtained; then, the current sensitive word library is added, deleted or modified according to the keywords to obtain a new sensitive word library; finally, a regular expression is generated according to the new sensitive word library, and the position of the sensitive word is located according to the regular expression to obtain the sensitive word, and the desensitized file is obtained; the desensitization of various types of data is realized, and the data type remains unchanged before and after desensitization, which ensures the security of the desensitized data while also ensuring the readability of the desensitized file, and further improves the desensitization speed.

[0006] The specific implementation contents of the present invention are as follows:

[0007] An adaptive desensitization method specifically comprises the following steps:

[0008] Step S1: Obtain keywords of the current file to be desensitized by the sender user;

[0009] Step S2: adding, deleting, and modifying the current sensitive word library according to the keywords to obtain a new sensitive word library;

[0010] Step S3: Generate a regular expression based on the new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

[0011] In order to better implement the present invention, further, before step S1, the adaptive desensitization method includes: judging whether the current user is a registered user; if so, judging whether the user information input by the current user matches the user information managed in the background; if so, outputting a pop-up window indicating a successful login; if not, outputting a pop-up window indicating a username / password error; if not, outputting a registration interface to guide the current user to register.

[0012] In order to better implement the present invention, further, the step S2 specifically includes the following steps:

[0013] Step S21: adding, deleting, and modifying the current sensitive word library according to the keywords to obtain a new sensitive word library;

[0014] Step S22: Obtain the recipient ID input by the sending user, and determine whether the recipient ID belongs to the user ID managed in the background. If so, execute step S3; otherwise, output a pop-up window indicating that the current user ID is invalid.

[0015] In order to better implement the present invention, further, step S3 specifically includes the following steps:

[0016] Step S31: Read the current file to be desensitized in the form of a character stream to obtain a character string;

[0017] Step S32: Generate a regular expression based on the new sensitive word library;

[0018] Step S33: Locate the sensitive word position according to the character string and the regular expression, and save it to a preset file list;

[0019] Step S34: concurrently and cyclically scanning the preset file list, and obtaining sensitive words according to the positions of the sensitive words;

[0020] Step S35: converting the sensitive word into a binary string, and converting the binary string into a matrix;

[0021] Step S36: Determine the number of iterations of the desensitization algorithm according to the type of the sender user and the type of the receiver role;

[0022] Step S37: using the matrix as the input of the desensitization algorithm, performing iterative processing according to the number of rounds, and obtaining an iterative result secret;

[0023] Step S38: replacing the sensitive word position of the current file to be desensitized according to the iteration result secret;

[0024] Step S39: Repeat steps S31 to S38 until all sensitive words in the current file to be desensitized are replaced, and a desensitized file corresponding to the current file to be desensitized is obtained.

[0025] In order to better implement the present invention, further, the specific operation of step S31 is: read the suffix of the current file to be desensitized, if the suffix of the current file to be desensitized is txt, parse the input stream according to BufferReader, if the suffix of the current file to be desensitized is doc / docx, call the WordExtractor class of the poi library to parse the input stream, and then read the parsed input stream result into the string s in units of lines to obtain the string s.

[0026] In order to better implement the present invention, further, step S37 specifically includes the following steps:

[0027] Step S371: cyclically shifting the elements of each row of the matrix to the left by a specific number of bits, to obtain a shifted matrix;

[0028] Step S372: multiplying the shifted matrix and the set eigenvalue matrix to obtain an output matrix;

[0029] Step S373: Use the output matrix as the input of the desensitization algorithm, return to step S371, and complete the number of rounds of loops, and use the output matrix of the last round as the iteration result secret.

[0030] In order to better implement the present invention, further, the eigenvalue matrix set in step S372 is a matrix in which the sum of each column is 1.

[0031] In order to better implement the present invention, further, the sensitive word position in step S33 includes a sensitive word starting position and a sensitive word ending position.

[0032] Based on the above-proposed adaptive desensitization method, in order to better implement the present invention, an adaptive desensitization system is further proposed, including an acquisition unit, an addition, deletion and modification unit, and a desensitization unit;

[0033] The acquisition unit is used to acquire keywords of the current file to be desensitized by the sender user;

[0034] The add, delete, modify and check unit is used to add, delete and modify the current sensitive word library according to the keyword to obtain a new sensitive word library;

[0035] The desensitization unit is used to generate a regular expression according to a new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

[0036] Based on the adaptive desensitization method proposed above, in order to better implement the present invention, an electronic device is further proposed, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the adaptive desensitization method described above is implemented.

[0037] Based on the adaptive desensitization method proposed above, in order to better implement the present invention, a computer-readable storage medium is further proposed, on which computer instructions are stored; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned adaptive desensitization method is implemented.

[0038] The present invention has the following beneficial effects:

[0039] (1) The present invention is applicable to multiple types of data desensitization, and the data type remains unchanged before and after desensitization, which ensures the security of data desensitization while also ensuring the readability of the desensitized file.

[0040] (2) The present invention adaptively selects the desensitization strength according to the different roles of the sending and receiving users to prevent important information from being leaked to untrusted personnel, thereby solving the shortcomings of existing desensitization algorithms that are unable to resist collusion attacks and brute force enumeration attacks.

[0041] (3) The present invention uses multi-threaded concurrent processing of sensitive word retrieval and sensitive word desensitization operations, which greatly speeds up the desensitization speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] FIG1 is a schematic block diagram of the process of the adaptive desensitization method provided by the present invention. DETAILED DESCRIPTION

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.

[0044] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "disposed," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; mechanical connections, electrical connections; direct connections, indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.

[0045] Example 1:

[0046] This embodiment provides an adaptive desensitization method, which specifically includes the following steps:

[0047] Before performing step S1, the method includes:

[0048] Determine whether the current user is a registered user. If so, determine whether the user information entered by the current user matches the user information managed by the backend. If so, a pop-up window indicating a successful login will be displayed. If not, a pop-up window indicating a username / password error will be displayed. If not, a registration interface will be displayed to guide the current user to register.

[0049] Step S1: Obtain keywords of the current file to be desensitized by the sender user.

[0050] Step S2: Add, delete, and modify the current sensitive word library according to the keywords to obtain a new sensitive word library.

[0051] The step S2 specifically includes the following steps:

[0052] Step S21: adding, deleting, and modifying the current sensitive word library according to the keywords to obtain a new sensitive word library;

[0053] Step S22: Obtain the recipient ID input by the sending user, and determine whether the recipient ID belongs to the user ID managed in the background. If so, execute step S3; otherwise, output a pop-up window indicating that the current user ID is invalid.

[0054] Step S3: Generate a regular expression based on the new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

[0055] The step S3 specifically includes the following steps:

[0056] Step S31: Read the current file to be desensitized in the form of a character stream to obtain a character string.

[0057] Furthermore, the specific operation of step S31 is: reading the suffix of the current file to be desensitized, if the suffix of the current file to be desensitized is txt, parsing the input stream according to BufferReader, if the suffix of the current file to be desensitized is doc / docx, calling the WordExtractor class of the poi library to parse the input stream, and then reading the parsed input stream result into the string s in units of lines to obtain the string s.

[0058] Step S32: Generate a regular expression based on the new sensitive word library.

[0059] Step S33: Locate the sensitive word position according to the character string and the regular expression, and save it to a preset file list.

[0060] Furthermore, the sensitive word position in step S33 includes a sensitive word starting position and a sensitive word ending position.

[0061] Step S34: concurrently and cyclically scan the preset file list and obtain sensitive words according to the sensitive word positions.

[0062] Step S35: converting the sensitive word into a binary string, and converting the binary string into a matrix.

[0063] Step S36: Determine the number of iterations of the desensitization algorithm according to the type of the sender user and the type of the receiver role.

[0064] Step S37: using the matrix as the input of the desensitization algorithm, performing iterative processing according to the number of rounds, and obtaining an iterative result secret.

[0065] Furthermore, the step S37 specifically includes the following steps:

[0066] Step S371: cyclically shifting the elements of each row of the matrix to the left by a specific number of bits, to obtain a shifted matrix;

[0067] Step S372: multiply the shifted matrix and the set eigenvalue matrix to obtain an output matrix.

[0068] Furthermore, the eigenvalue matrix set in step S372 is a matrix in which the sum of each column is 1.

[0069] Step S373: Use the output matrix as the input of the desensitization algorithm, return to step S371, and complete the number of rounds of loops, and use the output matrix of the last round as the iterative result secret.

[0070] Step S38: Replace the sensitive word position of the current file to be desensitized according to the iteration result secret.

[0071] Step S39: Repeat steps S31 to S38 until all sensitive words in the current file to be desensitized are replaced, and a desensitized file corresponding to the current file to be desensitized is obtained.

[0072] Working principle: This embodiment first obtains the keywords of the current file to be desensitized by the sender user; then adds, deletes and modifies the current sensitive word library based on the keywords to obtain a new sensitive word library; finally, a regular expression is generated based on the new sensitive word library, and the sensitive word position is located according to the regular expression to obtain the sensitive word, and the desensitized file is obtained by desensitization; it realizes the desensitization of various types of data, and the data type remains unchanged before and after desensitization, which ensures the security of the desensitized data while also ensuring the readability of the desensitized file, further improving the desensitization speed.

[0073] Example 2:

[0074] This embodiment, based on the above embodiment 1, specifically includes the following steps as shown in FIG1 :

[0075] Step S1: Obtain keywords related to the file to be desensitized in the current sender user account;

[0076] Step S2: adding, deleting, and modifying the current sensitive word library according to the relevant keywords to obtain a new sensitive word library;

[0077] Step S3: performing a desensitization operation on the current file to be desensitized based on the new sensitive word library to obtain a desensitized file corresponding to the current file to be desensitized.

[0078] Optionally, before step S1, the adaptive desensitization method includes:

[0079] Determine whether the current user is a registered user. If so:

[0080] Compare the user information entered by the current user with the user information managed by the backend to see if they match. If so, a pop-up window will be displayed indicating a successful login. Otherwise, a pop-up window indicating a username / password error will be displayed.

[0081] Otherwise, a registration interface is output to guide the current user to register.

[0082] Optionally, between step S2 and step S3, the adaptive desensitization method further includes:

[0083] Get the recipient ID input by the sender user;

[0084] Determine whether the recipient ID belongs to the user ID managed by the background. If so, go to step S3. Otherwise, output a pop-up window indicating that the current user ID is invalid.

[0085] Optionally, step S3 includes:

[0086] Step S31: reading the current file to be desensitized in the form of a character stream to obtain a character string;

[0087] Step S32: generating a regular expression according to the new sensitive word library;

[0088] Step S33: Locate the sensitive word position according to the regular expression and the character string and save it in a preset file list, wherein the sensitive word position includes a starting position and an ending position;

[0089] Step S34: concurrently and cyclically scan the data in the preset file list, and locate and obtain sensitive words according to the starting position and the ending position;

[0090] Step S35: converting the sensitive word into a 32-bit hexadecimal string, and converting the 32-bit hexadecimal string into a 4*4 column matrix, where each element in the matrix is ​​a 2-bit hexadecimal number;

[0091] Step S36: Determine the number of rounds of desensitization algorithm iterations based on the type of the sender user and the type of the receiver role;

[0092] Step S37: using the 4*4 column matrix as the input of the desensitization algorithm, performing iterative processing according to the number of rounds, and obtaining an iterative result secret;

[0093] Step S38: using the iteration result secret to replace the position of the sensitive word in the current file to be desensitized;

[0094] Step S39: Repeat steps S31 to S38 until all sensitive words in the file to be desensitized are replaced, thereby obtaining a desensitized file corresponding to the current file to be desensitized.

[0095] Optionally, the step S31 includes: using BufferReader to parse the input stream of the file with the suffix txt in the current desensitized file, and using the WordExtractor class of the poi library to parse the input stream of the file with the suffix doc / docx, and reading the parsed input stream result into the string s in units of lines, that is: Buffer Reader (InputStream) → char[]s WordExtractor (InputStream) → char[]s

[0096] Among them, InputStream is the input stream, BufferReader and WordExtractor are parsers, and s is a string.

[0097] Optionally, the step S32 includes: Select(regex, s)→{[start1, end1], [start2, end2], ...., [startn, endn],}

[0098] Where regex is a regular expression, s is a string, start is the starting position of the sensitive word, and end is the ending position of the sensitive word.

[0099] Optionally, the step S37 includes:

[0100] Step S371: cyclically shifting the elements of each row of the 4*4 column matrix to the left by a specific number of bits to obtain a shifted matrix;

[0101] Step S372: performing a multiplication operation on the shifted matrix and the eigenvalue matrix to obtain an output matrix;

[0102] Step S373: Use the output matrix as the 4*4 column matrix and return to step S371 until the number of rounds of loops are completed, and use the output matrix of the last round as the iterative result secret.

[0103] Optionally, in step S372, the eigenvalue matrix is ​​a matrix in which the sum of each column is 1.

[0104] Working principle: This embodiment can be applied to desensitizing Chinese, English, and digital data at the same time, and the data type remains unchanged before and after desensitization, ensuring security while also ensuring the readability of the file; according to the different roles of the sending and receiving users, the system can adaptively select the desensitization intensity to prevent important information from being leaked to untrusted personnel; it solves the shortcomings of previous desensitization algorithms that cannot resist collusion attacks and brute force enumeration attacks; it uses multi-threaded concurrent processing of sensitive word retrieval and sensitive word desensitization operations, greatly speeding up the desensitization speed.

[0105] The rest of this embodiment is the same as that of the above-mentioned embodiment 1, and therefore will not be described in detail.

[0106] Example 3:

[0107] This embodiment is based on any one of the above-mentioned embodiments 1 to 2, and is described in detail with a specific embodiment as shown in FIG1 .

[0108] As shown in FIG1 , the adaptive desensitization method includes:

[0109] Step S1: Obtain keywords related to the file to be desensitized in the current sender user account;

[0110] Before that, first determine whether the current user is a registered user. If so:

[0111] Compare the user information entered by the current user with the user information managed by the backend to see if they match. If so, a pop-up window will be displayed indicating a successful login. Otherwise, a pop-up window indicating a username / password error will be displayed.

[0112] Otherwise, a registration interface is output to guide the current user to register.

[0113] S2: Add, delete, and modify the current sensitive word library according to the relevant keywords to obtain a new sensitive word library;

[0114] In this embodiment, users can create multiple sensitive word libraries. Therefore, the addition, deletion, and modification of the current sensitive word library are not limited to the original sensitive word library, but also include the addition of new sensitive word libraries. However, the sensitive word library in the current sender's user account is not visible and cannot be operated in other user accounts.

[0115] In addition, between step S2 and step S3, the adaptive desensitization method further includes:

[0116] Get the recipient ID input by the sender user;

[0117] Determine whether the recipient ID belongs to the user ID managed by the background. If so, go to step S3. Otherwise, output a pop-up window indicating that the current user ID is invalid.

[0118] Step S3: performing a desensitization operation on the current file to be desensitized based on the new sensitive word library to obtain a desensitized file corresponding to the current file to be desensitized.

[0119] Optionally, step S3 includes:

[0120] Step S31: reading the current file to be desensitized in the form of a character stream to obtain a character string;

[0121] The file with the suffix txt in the current desensitized file is parsed using BufferReader, and the file with the suffix doc / docx is parsed using the WordExtractor class of the poi library. The parsed input stream result is read into the string s in units of lines, that is: Buffer Reader (InputStream) → char[]s WordExtractor (InputStream) → char[]s

[0122] Among them, InputStream is the input stream, BufferReader and WordExtractor are parsers, and s is a string.

[0123] Step S32: generating a regular expression according to the new sensitive word library;

[0124] The regular expressions for English and Chinese sensitive words are generated differently. In the former, words are separated by spaces. When searching for sensitive words, this method only focuses on truly sensitive fields. Therefore, we use \b to match a word boundary—that is, the position between a word and a space. Otherwise, the search results might indicate that the internal characters of a word are sensitive fields. In contrast, in the latter, spaces are not used as delimiters, so the regular expression can directly use the original string. See Table 1 for details.

[0125] Table 1 Regular expression generation example table

[0126] Step S33: Locate the sensitive word position according to the regular expression and the string and save it in a preset file list, wherein the sensitive word position includes the starting position and the ending position; that is: Select(regex, s) → {[start1, end1], [start2, end2], ..., [startn, endn],}

[0127] Where regex is a regular expression, s is a string, start is the starting position of the sensitive word, and end is the ending position of the sensitive word.

[0128] As an embodiment, the sensitive word positions are saved in an ArrayList list named wordloc, and each element in wordloc is an array with a length of 2 that describes the starting address and the ending address of the string.

[0129] Step S34: concurrently and cyclically scan the data in the preset file list, and locate and obtain sensitive words according to the starting position and the ending position;

[0130] Step S35: Convert the sensitive word into a 32-bit hexadecimal string.

[0131] In the present invention, a single English letter occupies one byte, i.e., two hexadecimal digits, and a single Chinese character occupies two bytes, i.e., four hexadecimal digits; Transform_code(word)→code16

[0132] Among them, word is the original sensitive content located, and code16 is a hexadecimal string;

[0133] The 32-bit hexadecimal string is converted into a 4*4 column matrix, where each element in the matrix is ​​a 2-bit hexadecimal number; Transform_Date(code16)→TRA

[0134] Among them, TRA is the 4*4 column byte matrix generated after conversion.

[0135] S36: Determine the number of rounds of desensitization algorithm iterations based on the type of the sender user and the role type of the receiver. The higher the number of rounds, the lower the possibility of being cracked.

[0136] The number of rounds of the algorithm corresponding to different user roles is shown in Table 2. choose(Role_A,Role_B)→round

[0137] Among them, Role_A is the role information of the sender, Role_B is the role information of the receiver, and round is the number of algorithm iterations.

[0138] Table 2. Iteration rounds corresponding to sending and receiving user roles

[0139] Step S37: Use the 4*4 column matrix as the input of the desensitization algorithm, perform iterative processing according to the number of rounds, and obtain the iterative result secret; that is, use TRA as the input, the desensitization algorithm performs round operations on the matrix, and the calculation result of each round is used as the input of the next round.

[0140] The step S37 includes:

[0141] Step S371: cyclically shifting the elements of each row of the 4*4 column matrix to the left by a specific number of bits to obtain a shifted matrix;

[0142] Step S372: performing a multiplication operation on the shifted matrix and the eigenvalue matrix to obtain an output matrix;

[0143] The eigenvalue matrix is ​​a feature matrix in which the sum of each column is 1. Let F0, F1, F2, and F3 be the four elements of the first column of the feature matrix. F0 = random(0, 1) F1 = random(0, 1-F0) F2 = random(0, 1-F0-F1) F3 = 1-(F0+F1+F2)

[0144] The random function returns a random decimal number greater than 0 and less than two decimal places in the specified range. The matrix generation algorithm first generates the element S1 in the first column and first row. Next, S2 is generated based on the value of S1, and so on. The feature matrix must be regenerated for each round.

[0145] Matrix multiplication uses the M_TRA matrix and the Feature matrix for multiplication. The sum of each column in the Feature matrix is ​​1. Because the numeric ranges of Chinese, English, and numbers after conversion to hexadecimal are different and specific, and the system processes sensitive words of different types, such as Chinese, English, and numbers, separately, the sum of the columns is 1 to ensure that the character attributes are not changed after the multiplication. For example, a numeric character will not be converted to a character type, nor will a Chinese character be converted to an English character. S′0=S0*F0+S4*F1+S8*F2+S12*F3 S′1=S0*F4+S4*F5+S8*F6+S12*F7 S′2=S0*F8+S4*F9+S8*F10+S12*F11 S′3=S0*F12+S4*F13+S8*F14+S12*F15

[0146] The output matrix TRB of each round is used as the input of the next round for cyclic operation.

[0147] Step S373: Use the output matrix as the 4*4 column matrix and return to step S371 until the number of rounds of loops are completed, and use the output matrix of the last round as the iterative result secret.

[0148] Step S38: Use the iterative result secret to replace the position of the sensitive words in the current file to be desensitized; Step S39: Repeat steps S31-S38 until all sensitive words in the file to be desensitized are replaced, and a desensitized file corresponding to the current file to be desensitized is obtained.

[0149] The rest of this embodiment is the same as any of the above-mentioned embodiments 1 and 2, and thus will not be described in detail.

[0150] Example 4:

[0151] This embodiment, based on any one of the above embodiments 1 to 3, proposes an adaptive desensitization system, including an acquisition unit, an addition, deletion, and modification unit, and a desensitization unit;

[0152] The acquisition unit is used to acquire keywords of the current file to be desensitized by the sender user;

[0153] The add, delete, modify and check unit is used to add, delete and modify the current sensitive word library according to the keyword to obtain a new sensitive word library;

[0154] The desensitization unit is used to generate a regular expression according to a new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

[0155] This embodiment also proposes an electronic device, including a memory and a processor; a computer program is stored in the memory; when the computer program is executed on the processor, the above-mentioned adaptive desensitization method is implemented.

[0156] This embodiment further proposes a computer-readable storage medium, on which computer instructions are stored; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned adaptive desensitization method is implemented.

[0157] The rest of this embodiment is the same as any one of the above-mentioned embodiments 1 to 3, and thus will not be described in detail.

[0158] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the scope of protection of the present invention.

Claims

1. An adaptive desensitization method, characterized in that: The specific steps include: Step S1: Obtain keywords of the current file to be desensitized by the sender user; Step S2: adding, deleting, and modifying the current sensitive word library according to the keywords to obtain a new sensitive word library; Step S3: Generate a regular expression based on the new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

2. The adaptive desensitization method according to claim 1, characterized in that: Before step S1, the adaptive desensitization method includes: Determine whether the current user is a registered user. If so, determine whether the user information entered by the current user matches the user information managed by the backend. If so, a pop-up window indicating a successful login will be displayed. If not, a pop-up window indicating an incorrect username or password will be displayed. If not, a registration interface will be displayed to guide the current user to register.

3. The adaptive desensitization method according to claim 1, characterized in that: The step S2 specifically includes the following steps: Step S21: adding, deleting, and modifying the current sensitive word library according to the keywords to obtain a new sensitive word library; Step S22: Obtain the recipient ID input by the sending user, and determine whether the recipient ID belongs to the user ID managed in the background. If so, execute step S3; otherwise, output a pop-up window indicating that the current user ID is invalid.

4. The adaptive desensitization method according to claim 3, characterized in that: The step S3 specifically includes the following steps: Step S31: Read the current file to be desensitized in the form of a character stream to obtain a character string; Step S32: Generate a regular expression based on the new sensitive word library; Step S33: Locate the sensitive word position according to the character string and the regular expression, and save it to a preset file list; Step S34: concurrently and cyclically scanning the preset file list, and obtaining sensitive words according to the positions of the sensitive words; Step S35: converting the sensitive word into a binary string, and converting the binary string into a matrix; Step S36: Determine the number of iterations of the desensitization algorithm according to the type of the sender user and the type of the receiver role; Step S37: using the matrix as the input of the desensitization algorithm, performing iterative processing according to the number of rounds, and obtaining an iterative result secret; Step S38: replacing the sensitive word position of the current file to be desensitized according to the iteration result secret; Step S39: Repeat steps S31 to S38 until all sensitive words in the current file to be desensitized are replaced, and a desensitized file corresponding to the current file to be desensitized is obtained.

5. The adaptive desensitization method according to claim 4, characterized in that: The specific operation of step S31 is: read the suffix of the current file to be desensitized. If the suffix of the current file to be desensitized is txt, parse the input stream according to BufferReader; if the suffix of the current file to be desensitized is doc or docx, call the WordExtractor class of the poi library to parse the input stream, and then read the parsed input stream result into the string s in units of lines to obtain the string s.

6. The adaptive desensitization method according to claim 4, characterized in that: The step S37 specifically includes the following steps: Step S371: cyclically shifting the elements of each row of the matrix to the left by a specific number of bits, to obtain a shifted matrix; Step S372: multiplying the shifted matrix and the set eigenvalue matrix to obtain an output matrix; Step S373: Use the output matrix as the input of the desensitization algorithm, return to step S371, and complete the number of rounds of loops, and use the output matrix of the last round as the iterative result secret.

7. The adaptive desensitization method according to claim 6, characterized in that: The eigenvalue matrix set in step S372 is a matrix in which the sum of each column is 1.

8. The adaptive desensitization method according to claim 4, characterized in that: The sensitive word positions in step S33 include the sensitive word starting position and the sensitive word ending position.

9. An adaptive desensitization system, characterized in that: Including acquisition unit, addition, deletion and modification unit, and desensitization unit; The acquisition unit is used to acquire keywords of the current file to be desensitized by the sender user; The add, delete, modify and check unit is used to add, delete and modify the current sensitive word library according to the keyword to obtain a new sensitive word library; The desensitization unit is used to generate a regular expression according to a new sensitive word library, locate the position of the sensitive word according to the regular expression to obtain the sensitive word, and desensitize the sensitive word to obtain a desensitized file.

10. An electronic device, characterized in that: It comprises a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the adaptive desensitization method according to any one of claims 1 to 8 is implemented.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device according to claim 10, the adaptive desensitization method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Log desensitization method and device, computer equipment and storage medium

    CN113722758A

  • Data protection method and device, computer equipment and storage medium

    CN115238286A

  • Self-adaptive desensitization method, system, equipment and medium

    CN117951747A

  • Converting format strings to regular expressions

    US8261241B2

Cited By

  • Trusted data space-oriented data processing method and device, medium and equipment

    CN121396626A