Data desensitization method and device
By using a key-based alternative table encryption method in medical data, desensitization and sharing of medical data are achieved, the problems of data sharing and privacy protection are solved, and the security and reversibility of data are ensured.
Patent Information
- Application Number
- CN202410816340.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-06-24
Smart Images

Figure CN119249465A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a data desensitization method and device. Background Art
[0002] Medical data sharing can improve diagnostic accuracy, facilitate technical exchanges within the industry, improve medical quality, promote medical informatization, etc. It can realize medical data sharing among medical institutions, break down information silos, and enable patients to obtain more comprehensive medical services.
[0003] However, because medical data involves the personal privacy of patients, hospitals or medical institutions cannot share medical data in plain text. If it is shared in ciphertext, it is impossible to establish the association between different medical data, and it is difficult to realize the value and use of medical data. For example, if a patient takes various medical images in multiple hospitals, each hospital encrypts them separately and shares them in ciphertext, it is impossible to establish the association between the patient's medical data in different hospitals.
[0004] Based on this, there is an urgent need for a data desensitization method that can achieve the sharing of medical data without leaking user privacy information, and can also restore the original information when necessary. Summary of the invention
[0005] The purpose of this application is to provide a data desensitization method and device for sharing medical data without leaking user privacy information, and the key holder can restore the original image from the target image after data desensitization.
[0006] This application provides a data desensitization method, including: Obtain an image to be desensitized and matching parameters; the matching parameters include: at least one replacement table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the replacement table is generated based on a key; the information to be desensitized is encrypted based on the matching parameters to obtain encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain a target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one replacement table is used in sequence to encrypt the information to be desensitized in a preset order.
[0007] Optionally, obtaining the image to be desensitized and the matching parameters includes: obtaining the image to be desensitized and identifying the information to be desensitized in the image to be desensitized; identifying the information to be desensitized, determining the information type of the information to be desensitized, and generating at least one replacement table corresponding to the information type of the information to be desensitized.
[0008] Optionally, the information type of the desensitized information includes: English characters, numeric characters, Chinese characters; the replacement table corresponding to the English characters is the first replacement table; the replacement table corresponding to the Chinese characters is the second replacement table; the replacement table corresponding to the numeric characters is the third replacement table;.
[0009] Optionally, encrypting the information to be desensitized based on the matching parameters to obtain encrypted result information includes: when the information type of the desensitized information is the English characters, encrypting the information to be desensitized based on a preset encryption algorithm and at least one first replacement table to obtain the encrypted result information; or, when the information type of the desensitized information is the Chinese characters, encrypting the information to be desensitized based on a preset encryption algorithm and at least one second replacement table to obtain the encrypted result information; or, when the information type of the desensitized information is the numeric characters, encrypting the information to be desensitized based on a preset encryption algorithm and at least one third replacement table to obtain the encrypted result information.
[0010] Optionally, the first replacement table includes: a single-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the third replacement table includes: a singular replacement table; the input value and output value of the singular replacement table have a value range of [0,9]; encrypting the information to be desensitized based on a preset encryption algorithm and at least one replacement table to obtain the encrypted result information includes: encrypting the information to be desensitized based on a preset encryption algorithm and at least one single-letter replacement table, or at least one singular replacement table to obtain the encrypted result information.
[0011] Optionally, the first replacement table includes: a single-letter replacement table and a double-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the input value and output value of the double-letter replacement table have a value range of [0,675]; the third replacement table includes: an odd number replacement table and an even number replacement table; the input value and output value of the odd number replacement table have a value range of [0,9]; the input value and output value of the even number replacement table have a value range of [0,99]; the encryption of the information to be desensitized based on a preset encryption algorithm and at least one replacement table to obtain the encryption result information includes: when the number of characters in the information to be desensitized is an even number, the information to be desensitized is encrypted based on a preset encryption algorithm and at least one even number replacement table, or at least one double-letter replacement table to obtain the encryption result information. Encryption result information; or, in the case that the number of characters in the information to be desensitized is an odd number, the information to be desensitized is encrypted based on a preset encryption algorithm and a first mixed replacement table, or a second mixed replacement table to obtain the encryption result information; wherein the first mixed replacement table includes: an odd-number replacement table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-number replacement table for encrypting the characters of the information to be desensitized except the characters calculated by the odd-number replacement table; the second mixed replacement table includes: a single-letter replacement table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-letter replacement table for encrypting the characters of the information to be desensitized except the characters calculated by the single-letter replacement table.
[0012] Optionally, the preset encryption algorithm includes: obtaining a flag value corresponding to each character among the multiple characters contained in the information to be desensitized; based on the flag value of each character, encrypting each character among the multiple characters in turn by cyclically using multiple replacement tables in a preset order to obtain encryption result information corresponding to the information to be desensitized; wherein the multiple replacement tables are: at least one replacement table; the encryption result information is obtained based on the encryption result sub-information corresponding to each character among the multiple characters.
[0013] Optionally, the method, based on the flag value of each character, cyclically uses multiple replacement tables in a preset order to encrypt each character in the multiple characters in turn to obtain encryption result information corresponding to the information to be desensitized, including: obtaining the flag value corresponding to the first ciphertext symbol used in the current round, and performing a modulo operation on the target sum and the number of variables in the replacement table used in the current round to obtain the first secret value of the current round; the target sum is: the sum of the flag value corresponding to the first ciphertext symbol and the second secret value calculated in the previous round; searching the replacement table used in the current round for a secret value corresponding to the first secret value as the second secret value of the current round, and replacing the first ciphertext symbol with the second ciphertext symbol corresponding to the second secret value; wherein, when the current round is the first round, the preset secret value is used as the second secret value calculated in the previous round; the first ciphertext symbol and the second ciphertext symbol are characters obtained by encrypting the original characters.
[0014] The present application also provides a data desensitization device, comprising: An information acquisition module is used to acquire an image to be desensitized and matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; an information encryption module is used to encrypt the information to be desensitized based on the matching parameters to obtain encryption result information, and replace the information to be desensitized with the encryption result information to obtain a target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one substitution table is used in sequence to encrypt the information to be desensitized in a preset order.
[0015] Optionally, the acquisition module is specifically used to acquire the image to be desensitized and identify the information to be desensitized in the image to be desensitized; the acquisition module is also specifically used to identify the information to be desensitized, determine the information type of the information to be desensitized, and generate at least one replacement table corresponding to the information type of the information to be desensitized.
[0016] Optionally, the information type of the desensitized information includes: English characters, numeric characters, Chinese characters; the replacement table corresponding to the English characters is the first replacement table; the replacement table corresponding to the Chinese characters is the second replacement table; and the replacement table corresponding to the numeric characters is the third replacement table.
[0017] Optionally, the information encryption module is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one first replacement table to obtain the encrypted result information when the information type of the desensitized information is the English characters; the information encryption module is also specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one second replacement table to obtain the encrypted result information when the information type of the desensitized information is the Chinese characters; the information encryption module is also specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one third replacement table to obtain the encrypted result information when the information type of the desensitized information is the numeric characters.
[0018] Optionally, the first replacement table includes: a single-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the third replacement table includes: a singular replacement table; the input value and output value of the singular replacement table have a value range of [0,9]; the information encryption module is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one single-letter replacement table, or at least one singular replacement table, to obtain the encryption result information.
[0019] Optionally, the first replacement table includes: a single-letter replacement table and a double-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the input value and output value of the double-letter replacement table have a value range of [0,675]; the third replacement table includes: an odd number replacement table and an even number replacement table; the input value and output value of the odd number replacement table have a value range of [0,9]; the input value and output value of the even number replacement table have a value range of [0,99]; the information encryption module is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one even number replacement table, or at least one double-letter replacement table, when the number of characters in the information to be desensitized is an even number, to obtain the encryption result information; the information encryption module is also specifically used to When the number of characters in the information to be desensitized is an odd number, the information to be desensitized is encrypted based on a preset encryption algorithm and a first mixed substitution table or a second mixed substitution table to obtain the encryption result information; wherein the first mixed substitution table includes: an odd-number substitution table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-number substitution table for encrypting the characters of the information to be desensitized except the characters calculated by the odd-number substitution table; the second mixed substitution table includes: a single-letter substitution table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-letter substitution table for encrypting the characters of the information to be desensitized except the characters calculated by the single-letter substitution table.
[0020] Optionally, the information acquisition module is also used to obtain a flag value corresponding to each character in the multiple characters contained in the information to be desensitized; the information encryption module is specifically used to encrypt each character in the multiple characters in turn based on the flag value of each character, using multiple replacement tables in a preset order to obtain encryption result information corresponding to the information to be desensitized; wherein the multiple replacement tables are: at least one replacement table; the encryption result information is obtained based on the encryption result sub-information corresponding to each character in the multiple characters.
[0021] Optionally, the information encryption module is specifically used to obtain a flag value corresponding to a first ciphertext symbol used in a current round, and to perform a modulo operation on a target sum and the number of variables in a substitution table used in the current round to obtain a first secret value for the current round; the target sum is: the sum of the flag value corresponding to the first ciphertext symbol and a second secret value calculated in a previous round; the information encryption module is also specifically used to search the substitution table used in the current round for a secret value corresponding to the first secret value as the second secret value for the current round, and to replace the first ciphertext symbol with a second ciphertext symbol corresponding to the second secret value; wherein, when the current round is the first round, a preset secret value is used as the second secret value calculated in the previous round; the first ciphertext symbol and the second ciphertext symbol are characters obtained by encrypting the original characters.
[0022] The present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of any of the data desensitization methods described above.
[0023] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-described data desensitization methods when executing the program.
[0024] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the data desensitization methods described above.
[0025] The data desensitization method and device provided by the present application first obtain an image to be desensitized and matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; then, the information to be desensitized is encrypted based on the matching parameters to obtain encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain a target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and the at least one substitution table is used in sequence in a preset order during the cyclic transformation process to encrypt the information to be desensitized. In this way, medical data sharing can be achieved without leaking user privacy information. Since the encryption method can be reversed, the original image information can be restored from the target image after data desensitization when necessary. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0027] Figure 1 This is one of the flow charts of the data desensitization method provided in this application; Figure 2 This is the second flow chart of the data desensitization method provided by this application; Figure 3 It is a structural schematic diagram of the data desensitization device provided by this application; Figure 4 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] Medical images, such as X-rays, CT scans, and MRI scans, occupy an extremely important position in medical data and are also an important part of data exchange and medical research. These medical images are generally stored or transmitted in the form of electronic data files. These images usually record information such as the patient's name, hospitalization number, and date of birth. In particular, the name and hospitalization number are the main privacy of the patient. Based on the search and paste capabilities of artificial intelligence, the name and hospitalization number in the film can be directly erased, and images without the name and hospitalization number can be shared freely within the medical system.
[0031] However, if a patient has visited many hospitals in recent years and has taken dozens or even hundreds of X-rays, ultrasounds, CT scans, or MRIs, as well as some gastroscopy, colonoscopy, bone density, and electrocardiogram images saved in the form of images, researchers need to bring together multiple or all of the patient's films for comparison and analysis. If the name and hospital number are simply erased from each image, it is impossible to bring together the images of a specific patient by searching and merging patients with the same name.
[0032] In view of the above technical problems existing in the related art, the embodiment of the present application provides a data desensitization method that can retain the original data format, and the method can replace sensitive words or numbers on the image with other words or numbers. When the key is determined and does not change, the same name is always encrypted into the same string of words, and the same hospital number is encrypted into the same string of numbers.
[0033] The data desensitization method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0034] like Figure 1 As shown, a data desensitization method provided in an embodiment of the present application may include the following steps 101 and 102.
[0035] Step 101: Obtain the image to be desensitized and matching parameters.
[0036] The matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations. Different information types of the information to be desensitized use different substitution tables. The number of encryption iterations and the number of substitution tables may be the same or different.
[0037] Exemplarily, the image to be desensitized is a medical image containing sensitive information such as patient name, hospital number, date of birth, etc. The substitution table is used to encrypt characters by looking up the table during the encryption process.
[0038] Exemplarily, the information types of the desensitized information include: English characters, numeric characters, and Chinese characters; the replacement table corresponding to the English characters is the first replacement table; the replacement table corresponding to the Chinese characters is the second replacement table; and the replacement table corresponding to the numeric characters is the third replacement table.
[0039] Exemplarily, taking English characters as an example, the first replacement table corresponding to English characters is in the form of the following Table 1: character a b c d e … r s t u v w x y z Flag value 0 1 2 3 4 … 17 18 19 20 21 22 23 24 25 First secret value 0 1 2 3 4 … 17 18 19 20 21 22 23 24 25 Second secret value 8 7 1 12 11 … 18 20 13 21 24 19 15 17 10 cipher text i h b m 1 … s u n v y t p r k
[0040] Table 1
[0041] Among them, the flag value is used to represent the natural order of each letter; the order of the first secret value and the flag value can be the same or different; the order of the first secret value and the flag value can be the same or different; the second secret value and the first secret value have a one-to-one correspondence.
[0042] It should be noted that, in actual application, the flag value can be input into the substitution table to directly obtain the output result, i.e., the second secret value. In the embodiment of the present application, for ease of understanding, the description of the ciphertext symbol and the first secret value is added to the substitution table to more clearly illustrate the relationship between the ciphertext symbol, the flag value, the first secret value, and the second secret value.
[0043] Specifically, the above step 101 may also include the following steps 101a1 and 101a2.
[0044] Step 101a1, obtaining the image to be desensitized, and identifying the information to be desensitized in the image to be desensitized.
[0045] Exemplarily, the above-mentioned information to be desensitized includes: sensitive information such as patient name, hospitalization number and date of birth.
[0046] Step 102a2: Identify the information to be desensitized, determine the information type of the information to be desensitized, and generate at least one replacement table corresponding to the information type of the information to be desensitized.
[0047] Exemplarily, in the embodiment of the present application, the information to be desensitized in the image to be desensitized and the information type of the information to be desensitized can be identified by image recognition, and a corresponding substitution table can be generated according to the information type of the information to be desensitized. At the same time, the number of substitution tables can also be reasonably selected according to the information type and the set security level. If the number is encrypted, if a 10-yuan substitution table is used (replacing the numbers between 0-9 with numbers between 0-9), the exhaustive number of each substitution table is 10! =3628800≈2 21.79 If six 10-element substitution tables are used, the total amount of substitution table information is (10!) 6 ≈2 130.75 . The key quantity is not less than 2 128 , so 6 10-yuan substitution tables can meet the basic safety requirements. If a 100-yuan substitution table (replacing numbers between 0-99 with numbers between 0-99) and a 10-yuan substitution table are used, the exhaustive number of 100-yuan substitution tables is 100! ≈2 524.76 , not only meets basic security requirements, but also achieves a key quantity of no less than 2 256 If we encrypt English letters, the exhaustive number of two 26-tuple substitution tables is (26!) 2 ≈2 176.76,Two 26-element substitution tables can meet basic security requirements. Three 26-element substitution tables can meet advanced security requirements. If Chinese characters are encrypted, there are about 7,000 commonly used Chinese characters. Because the substitution table is large, one table can meet advanced security requirements.
[0048] It should be noted that the above-mentioned number of encryption iterations can be pre-set or adjusted according to security requirements. The higher the security requirements, the greater the number of encryption iterations.
[0049] Step 102: Encrypt the information to be desensitized based on the matching parameters to obtain encryption result information, and replace the information to be desensitized with the encryption result information to obtain a target image after data desensitization.
[0050] The number of encryption iterations is used to indicate the number of cyclic transformations in the encryption process, and the at least one replacement table is used in sequence in a preset order to encrypt the information to be desensitized during the cyclic transformation process.
[0051] For example, after obtaining the above matching parameters and the information to be desensitized, the matching parameters can be used to encrypt the information to be desensitized to obtain the encrypted result information. After that, a specific deep learning network model can be used to replace the information to be desensitized in the image to be desensitized with the encrypted result information, and a new target image can be generated.
[0052] Specifically, in the above step 102, for the information type of the information to be desensitized, any one of the following steps 102a, 102b and 102c may be included.
[0053] Step 102a: When the information type of the desensitized information is the English characters, encrypt the information to be desensitized based on a preset encryption algorithm and at least one first replacement table to obtain the encryption result information.
[0054] Step 102b: When the information type of the desensitized information is the Chinese characters, encrypt the information to be desensitized based on a preset encryption algorithm and at least one second replacement table to obtain the encryption result information.
[0055] Step 102c: when the information type of the desensitized information is the numeric characters, encrypt the information to be desensitized based on a preset encryption algorithm and at least one third replacement table to obtain the encryption result information.
[0056] For example, in the embodiment of the present application, the above Table 1 is used as an example to encrypt the desensitized information based on the matching parameters in the implementation of the present application to obtain the encrypted result information. If there is a name "Zhang San" in the form of Chinese pinyin in the image, several first replacement tables are generated in the above steps, and the number of first replacement tables is the same as the number of encryption iterations. For example, 3 26-element replacement tables (not distinguishing between uppercase and lowercase English letters) are used, and the number of encryption iterations is 5, that is, each character position is encrypted and replaced 5 times.
[0057] When replacing the first letter Z in the string "Zhang San", because no ciphertext symbol (i.e., the letter obtained in the last replacement) has been generated, at this time, the value 0 can be used as the flag value corresponding to the ciphertext symbol obtained in the last replacement. The flag value of the letter Z is 25. Using the flag value of Z and the flag value corresponding to the ciphertext symbol obtained in the last replacement, we can get 25+0mod 26=25 (i.e., the first secret value shown in Table 1). Use the first secret value 25 to find the corresponding second secret value from the first 26-element replacement table. Assuming that the second secret value corresponding to the first secret value 25 found in the replacement table is 10, then based on the second secret value and the flag value, the letter corresponding to the flag value 25 that matches the second secret value 25 is k. That is, the letter obtained after the letter Z is replaced is k.
[0058] After that, the second letter h (with a flag value of 7) is replaced, and the flag value 10 of the ciphertext symbol k obtained by the previous replacement is calculated to obtain the first secret value corresponding to the letter h: 7+10mod 26=17. The first secret value 17 is used to find the corresponding second secret value from the second 26-element replacement table. Assuming that the second secret value corresponding to the first secret value 17 is 18 found in the replacement table, based on the second secret value and the flag value, the letter corresponding to the flag value 18 that matches the second secret 18 is s, that is, the letter obtained after the letter h is replaced is s.
[0059] Next, the third letter a (with a flag value of 0) is replaced, and the flag value 18 of the ciphertext symbol s obtained by the previous replacement is calculated to obtain the first secret value corresponding to the letter a: 0+18mod=26. The first secret value 26 is used to find the corresponding second secret value from the third 26-element replacement table. Assuming that the second secret value corresponding to the first secret value 26 is 20 found in the replacement table, based on the second secret value and the flag value, the letter corresponding to the flag value 20 that matches the second secret 20 is u, that is, the letter obtained after the letter a is replaced is u.
[0060] After that, the fourth letter n (with a flag value of 13) is replaced again, and the flag value 20 of the ciphertext symbol u obtained by the last replacement is calculated, and the first secret value corresponding to the letter n is obtained as follows: 13+20mod 26=7. The first secret value 7 is used to find the corresponding second secret value from the first 26-element substitution table (there are three substitution tables in total, which need to be used in sequence). Assuming that the second secret value corresponding to the first secret value 7 is 24 found in the substitution table, based on the second secret value and the flag value, the letter corresponding to the flag value 24 that matches the second secret value 24 is y, that is, the letter obtained after the letter n is replaced is y.
[0061] Follow the above steps to replace each letter in turn until the eighth letter n (flag value is 13) is replaced. Assume that the letter after the letter n is replaced is c (flag value is 2), then the second round of replacement is performed, and the first letter k (flag value is 10) after the previous round of replacement is replaced. The flag value of the last ciphertext symbol c in the previous round is 2, and so on. Until the fifth round of replacement is completed, the final 8 ciphertext symbols are used as the ciphertext of the string "Zhang San", where the first and sixth letters can be capitalized (maintaining the uppercase and lowercase positions of the plaintext). The above is described using three 26-element replacement tables as an example. When two 26-element replacement tables are used, the exhaustive hypothesis amount of the table is (26!)2≈2 176.76 , and safe enough.
[0062] For example, if a double letter substitution table is used, a 676 yuan substitution table is safe enough. Split "ZhangSan" into 4 symbol values, namely Zh corresponding to 657, an corresponding to 13, gS corresponding to 174, and an corresponding to 13. Figure 2 The logical architecture shown in the figure takes (657,13,174,13) as the initial input state and performs N rounds of iterative transformation. The final flag value (c1,c2,c3,c4) is converted into letters as the ciphertext of the string "Zhang San".
[0063] It should be noted that there are about 7000 common Chinese characters. One or more 7000-character substitution tables corresponding to the character set can be set by the key. And the Chinese name is encrypted according to the above steps using a similar method as above. If the number of elements in the substitution table is 7030, the modulus is 7030 when adding. If a patient's name has an uncommon Chinese character that is not in the 7030 Chinese characters, leave it as it is (equivalent to replacing itself with itself).
[0064] Optionally, in the embodiment of the present application, when encrypting numeric characters, an odd number replacement table and an even number replacement table may be used for encryption.
[0065] Exemplarily, the third substitution table includes: an odd number substitution table and an even number substitution table; the input value and output value of the odd number substitution table have a value range of [0,9], i.e., {0,1,2,3,4,5,6,7,8,9}; the input value and output value of the even number substitution table have a value range of [0,99], i.e., {0,1,2,3…,99}.
[0066] It should be noted that the third substitution table may also include a plurality of substitution tables, that is, the input value and the output value of the substitution table may be three or more digits. For example, when the input value is 2345, the output value may be 6572.
[0067] Specifically, when the desensitized information is encrypted using a singular replacement table, the above step 102c may further include the following step 102c1.
[0068] Step 102c1, encrypt the information to be desensitized based on a preset encryption algorithm and at least one singular substitution table to obtain the encryption result information.
[0069] For example, if a string of numbers is to be encrypted and is encrypted using a 10-digit substitution table with multiple 0-9 as input and output, encryption can be performed using the encryption method in the above example.
[0070] For example, when using the even number substitution table to encrypt the desensitized information, the parity of the number of characters in the desensitized information needs to be considered. When the number of characters in the desensitized information is an even number, only the even number substitution table can be used to encrypt the desensitized information; when the number of characters in the desensitized information is an odd number, the even number substitution table and the odd number substitution table can be mixed to encrypt the desensitized information.
[0071] Specifically, the above step 102c may also include the following step 102c2 or step 102c3.
[0072] Step 102c2: When the number of characters in the information to be desensitized is an even number, encrypt the information to be desensitized based on a preset encryption algorithm and at least one even number replacement table to obtain the encryption result information.
[0073] Step 102c3: When the number of characters in the information to be desensitized is an odd number, encrypt the information to be desensitized based on a preset encryption algorithm and at least one mixed substitution table to obtain the encryption result information.
[0074] The mixed replacement table includes: an odd-number replacement table for transforming the highest or lowest bit of the character of the information to be desensitized, and at least one even-number replacement table for transforming the remaining characters in the character of the information to be desensitized.
[0075] For example, if the length of the encrypted digital string is an odd number, it can be agreed that the highest or lowest digit uses the 10-yuan substitution table (i.e., the above-mentioned odd-number substitution table), and the other digits are regarded as a change unit every two digits, and the 100-yuan substitution table (i.e., the above-mentioned even-number substitution table) is used. If all 10-yuan substitution tables are used, at least 6 10-yuan tables should be set, otherwise the key change amount may be insufficient. When using a 100-yuan substitution table that can process two digits at a time, only one 100-yuan substitution table can provide 100! ≈2 524.76 The exhaustive computation of .
[0076] Specifically, the preset encryption algorithm used in the above step 102 may include the following steps 102d and 102e.
[0077] Step 102d: Obtain a flag value corresponding to each of the multiple characters contained in the information to be desensitized.
[0078] Step 102e: Based on the flag value of each character, encrypt each character in the multiple characters in turn by cyclically using multiple replacement tables in a preset order to obtain encryption result information corresponding to the information to be desensitized.
[0079] Among them, the multiple replacement tables are: at least one replacement table; the encryption result information is obtained based on the encryption result sub-information corresponding to each character in the multiple characters.
[0080] Specifically, based on the encryption steps described in the above example, the above step 102e may also include the following steps 102e1 and 102e2.
[0081] Step 102e1, obtain the flag value corresponding to the first ciphertext symbol used in the current round, and perform a modulo operation on the sum of the flag value corresponding to the first ciphertext symbol and the second secret value calculated in the previous round and the number of variables in the replacement table used in the current round to obtain the first secret value of the current round.
[0082] Illustratively, the substitution tables used in different rounds may be the same or different.
[0083] Step 102e2: search the replacement table used in the current round for a secret value corresponding to the first secret value as the second secret value of the current round, and replace the first ciphertext symbol with the second ciphertext symbol corresponding to the second secret value.
[0084] Among them, when the current round is the first round, the preset secret value is used as the second secret value calculated in the previous round; the first ciphertext symbol and the second ciphertext symbol are characters obtained by encrypting the original characters.
[0085] For example, after encrypting the information to be desensitized according to the above steps 102e1 and 102e2, the ciphertext symbols corresponding to each character can be obtained, and the encrypted result information can be obtained after combination. After that, the encrypted digitized text or number result can be converted into text or numbers in the form of a picture and pasted to the corresponding position of the picture being processed.
[0086] It should be noted that the data desensitization method in the embodiment of the present application can generate the same substitution table as that used for encryption when the same key is used. Decryption is performed in reverse order from the last encrypted character, and the substitution table is searched in reverse order, and the result is subtracted from the value of the previous secret character to achieve decryption.
[0087] It should be noted that in addition to processing medical imaging photos or pictures, prescriptions in pharmacies can also be processed. A prescription is usually saved as a file, such as word, wps or excel format. Hospital staff can open the file, check or modify the information, and then resave the file. Today's artificial intelligence technology can completely imitate human behavior, open the file with a tool in a suitable format, find the name, outpatient number or hospitalization number and other information involving privacy, encrypt these sensitive information in the format, and then resave the document. If the name, outpatient number or hospitalization number and other information are simply erased or adjusted to the symbol *, it will be inconvenient for subsequent statistical analysis. For example, 100 patients are randomly selected to calculate the number of prescriptions and the cumulative amount of drug expenses for each of these 100 people in the past three years. The above encryption method can ensure that the same name is encrypted to the same secret name, and two different secret names are different names after decryption.
[0088] The data desensitization method provided in the embodiment of the present application first obtains the image to be desensitized and the matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on the key; then, the information to be desensitized is encrypted based on the matching parameters to obtain the encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain the target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and the at least one substitution table is used in sequence to encrypt the information to be desensitized in a preset order during the cyclic transformation process. In this way, the sharing of medical data can be achieved without leaking the user's privacy information, and the key holder can restore the original image from the target image after data desensitization.
[0089] It should be noted that the data desensitization method provided in the embodiment of the present application can be executed by a data desensitization device, or a control module in the data desensitization device for executing the data desensitization method. In the embodiment of the present application, the data desensitization device provided in the embodiment of the present application is illustrated by taking the data desensitization method executed by the data desensitization device as an example.
[0090] It should be noted that in the embodiments of the present application, the data desensitization methods shown in the above-mentioned method drawings are all illustrated by taking one of the drawings in the embodiments of the present application as an example. In specific implementation, the data desensitization methods shown in the above-mentioned method drawings can also be implemented in combination with any other drawings that can be combined as shown in the above-mentioned embodiments, which will not be repeated here.
[0091] The data desensitization device provided by the present application is described below, and the data desensitization method described below and above can be referenced to each other.
[0092] Figure 2 A schematic diagram of the structure of the data desensitization device provided in the embodiment of the present application is shown in FIG. Figure 2 As shown, it specifically includes the following contents.
[0093] The information acquisition module 301 is used to obtain the image to be desensitized and the matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; the information encryption module 302 is used to encrypt the information to be desensitized based on the matching parameters to obtain encryption result information, and replace the information to be desensitized with the encryption result information to obtain the target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one substitution table is used in sequence to encrypt the information to be desensitized in a preset order.
[0094] Optionally, the acquisition module is specifically used to acquire the image to be desensitized and identify the information to be desensitized in the image to be desensitized; the acquisition module is also specifically used to identify the information to be desensitized, determine the information type of the information to be desensitized, and generate at least one replacement table corresponding to the information type of the information to be desensitized.
[0095] Optionally, the information type of the desensitized information includes: English characters, numeric characters, Chinese characters; the replacement table corresponding to the English characters is the first replacement table; the replacement table corresponding to the Chinese characters is the second replacement table; and the replacement table corresponding to the numeric characters is the third replacement table.
[0096] Optionally, the information encryption module 302 is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one first replacement table to obtain the encrypted result information when the information type of the desensitized information is the English characters; the information encryption module 302 is also specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one second replacement table to obtain the encrypted result information when the information type of the desensitized information is the Chinese characters; the information encryption module 302 is also specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one third replacement table to obtain the encrypted result information when the information type of the desensitized information is the digital characters.
[0097] Optionally, the first replacement table includes: a single-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the third replacement table includes: a singular replacement table; the input value and output value of the singular replacement table have a value range of [0,9]; the information encryption module 302 is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one single-letter replacement table, or at least one singular replacement table, to obtain the encryption result information.
[0098] Optionally, the first replacement table includes: a single-letter replacement table and a double-letter replacement table; the input value and output value of the single-letter replacement table have a value range of [0,25]; the input value and output value of the double-letter replacement table have a value range of [0,675]; the third replacement table includes: an odd number replacement table and an even number replacement table; the input value and output value of the odd number replacement table have a value range of [0,9]; the input value and output value of the even number replacement table have a value range of [0,99]; the information encryption module 302 is specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one even number replacement table, or at least one double-letter replacement table when the number of characters in the information to be desensitized is an even number, to obtain the encryption result information; the information encryption module 302 is also specifically used to encrypt the information to be desensitized based on a preset encryption algorithm and at least one even number replacement table, or at least one double-letter replacement table to obtain the encryption result information. Used to encrypt the information to be desensitized based on a preset encryption algorithm and a first mixed replacement table or a second mixed replacement table to obtain the encryption result information when the number of characters in the information to be desensitized is an odd number; wherein the first mixed replacement table includes: an odd-number replacement table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-number replacement table for encrypting the characters of the information to be desensitized except the characters calculated by the odd-number replacement table; the second mixed replacement table includes: a single-letter replacement table for encrypting the highest or lowest bits of the characters of the information to be desensitized, and at least one even-letter replacement table for encrypting the characters of the information to be desensitized except the characters calculated by the single-letter replacement table.
[0099] Optionally, the information acquisition module 301 is also used to obtain the flag value corresponding to each character in the multiple characters contained in the information to be desensitized; the information encryption module 302 is specifically used to encrypt each character in the multiple characters in turn based on the flag value of each character, using multiple replacement tables in a preset order to obtain encryption result information corresponding to the information to be desensitized; wherein the multiple replacement tables are: at least one replacement table; the encryption result information is obtained based on the encryption result sub-information corresponding to each character in the multiple characters.
[0100] Optionally, the information encryption module 302 is specifically used to obtain the flag value corresponding to the first ciphertext symbol used in the current round, and perform a modulo operation on the target sum and the number of variables in the replacement table used in the current round to obtain the first secret value of the current round; the target sum is: the sum of the flag value corresponding to the first ciphertext symbol and the second secret value calculated in the previous round; the information encryption module 302 is also specifically used to search the replacement table used in the current round for a secret value corresponding to the first secret value as the second secret value of the current round, and replace the first ciphertext symbol with a second ciphertext symbol corresponding to the second secret value; wherein, when the current round is the first round, a preset secret value is used as the second secret value calculated in the previous round; the first ciphertext symbol and the second ciphertext symbol are characters obtained by encrypting the original characters.
[0101] The data desensitization device provided by the present application first obtains the image to be desensitized and the matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on the key; then, the information to be desensitized is encrypted based on the matching parameters to obtain the encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain the target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and the at least one substitution table is used in sequence in a preset order during the cyclic transformation process to encrypt the information to be desensitized. In this way, the sharing of medical data can be achieved without leaking the user's privacy information, and the key holder can restore the original image from the target image after data desensitization.
[0102] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the data desensitization method, which includes: obtaining an image to be desensitized and a matching parameter; the matching parameter includes: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; the information to be desensitized is encrypted based on the matching parameter to obtain encryption result information, and the information to be desensitized is replaced by the encryption result information to obtain the target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and the at least one substitution table is used in sequence in a preset order during the cyclic transformation process to encrypt the information to be desensitized.
[0103] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0104] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the data desensitization method provided by the above methods, and the method includes: obtaining an image to be desensitized and matching parameters; the matching parameters include: at least one replacement table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the replacement table is generated based on a key; the information to be desensitized is encrypted based on the matching parameters to obtain encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain a target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one replacement table is used in sequence in a preset order to encrypt the information to be desensitized.
[0105] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute the above-mentioned data desensitization methods, the method comprising: obtaining an image to be desensitized and matching parameters; the matching parameters comprising: at least one replacement table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the replacement table is generated based on a key; the information to be desensitized is encrypted based on the matching parameters to obtain encryption result information, and the information to be desensitized is replaced with the encryption result information to obtain a target image after data desensitization; wherein the number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one replacement table is used in sequence in a preset order to encrypt the information to be desensitized.
[0106] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0107] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data desensitization method, characterized in that: include: Obtain the image to be desensitized and matching parameters; The matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; Encrypting the information to be desensitized based on the matching parameters to obtain encryption result information, and replacing the information to be desensitized with the encryption result information to obtain a target image after data desensitization; The number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one replacement table is used in sequence in a preset order to encrypt the information to be desensitized.
2. The method according to claim 1, characterized in that The obtaining of the image to be desensitized and the matching parameters includes: obtaining the image to be desensitized, and identifying the information to be desensitized in the image to be desensitized; The information to be desensitized is identified, the information type of the information to be desensitized is determined, and at least one replacement table corresponding to the information type of the information to be desensitized is generated.
3. The method according to claim 1 or 2, characterized in that: The information types of the desensitized information include: English characters, numeric characters, and Chinese characters; the replacement table corresponding to the English characters is the first replacement table; the replacement table corresponding to the Chinese characters is the second replacement table; and the replacement table corresponding to the numeric characters is the third replacement table.
4. The method according to claim 3, characterized in that The step of encrypting the information to be desensitized based on the matching parameters to obtain encryption result information includes: When the information type of the desensitized information is the English characters, encrypting the information to be desensitized based on a preset encryption algorithm and at least one first substitution table to obtain the encryption result information; or, When the information type of the desensitized information is the Chinese characters, encrypting the information to be desensitized based on a preset encryption algorithm and at least one second substitution table to obtain the encryption result information; or, In the case where the information type of the desensitized information is the numeric characters, the information to be desensitized is encrypted based on a preset encryption algorithm and at least one third replacement table to obtain the encryption result information.
5. The method according to claim 4, characterized in that The first substitution table includes: a single-letter substitution table; the input value and output value of the single-letter substitution table have a value range of [0, 25]; the third substitution table includes: a singular substitution table; the input value and output value of the singular substitution table have a value range of [0, 9]; The step of encrypting the information to be desensitized based on a preset encryption algorithm and at least one substitution table to obtain the encryption result information includes: The information to be desensitized is encrypted based on a preset encryption algorithm and at least one single-letter replacement table, or at least one singular replacement table, to obtain the encryption result information.
6. The method according to claim 4, characterized in that The first substitution table includes: a single-letter substitution table and a double-letter substitution table; the input value and output value of the single-letter substitution table have a value range of [0, 25]; the input value and output value of the double-letter substitution table have a value range of [0, 675]; the third substitution table includes: an odd-number substitution table and an even-number substitution table; the input value and output value of the odd-number substitution table have a value range of [0, 9]; the input value and output value of the even-number substitution table have a value range of [0, 99]; The step of encrypting the information to be desensitized based on a preset encryption algorithm and at least one substitution table to obtain the encryption result information includes: When the number of characters in the information to be desensitized is an even number, encrypting the information to be desensitized based on a preset encryption algorithm and at least one even number replacement table, or at least one double letter replacement table, to obtain the encryption result information; or, When the number of characters in the information to be desensitized is an odd number, encrypting the information to be desensitized based on a preset encryption algorithm and a first mixed substitution table or a second mixed substitution table to obtain the encryption result information; Among them, the first mixed replacement table includes: an odd-number replacement table for encrypting the highest or lowest bit of the character of the information to be desensitized, and at least one even-number replacement table for encrypting the other characters in the information to be desensitized except the characters calculated by the odd-number replacement table; the second mixed replacement table includes: a single-letter replacement table for encrypting the highest or lowest bit of the character of the information to be desensitized, and at least one even-letter replacement table for encrypting the other characters in the information to be desensitized except the characters calculated by the single-letter replacement table.
7. The method according to any one of claims 4 to 6, characterized in that The preset encryption algorithm includes: Obtaining a flag value corresponding to each of the multiple characters included in the information to be desensitized; Based on the flag value of each character, encrypt each character in the multiple characters in turn by cyclically using multiple replacement tables in a preset order to obtain encryption result information corresponding to the information to be desensitized; Among them, the multiple replacement tables are: at least one replacement table; the encryption result information is obtained based on the encryption result sub-information corresponding to each character in the multiple characters.
8. The method according to claim 7, characterized in that The method of encrypting each of the multiple characters in turn by cyclically using multiple substitution tables based on the flag value of each character in a preset order to obtain encryption result information corresponding to the information to be desensitized includes: Obtaining a flag value corresponding to a first ciphertext symbol used in the current round, and performing a modulo operation on a target sum and the number of variables in the substitution table used in the current round to obtain a first secret value of the current round; the target sum is the sum of the flag value corresponding to the first ciphertext symbol and the second secret value calculated in the previous round; Searching for a secret value corresponding to the first secret value from a substitution table used in the current round as the second secret value of the current round, and replacing the first ciphertext symbol with the second ciphertext symbol corresponding to the second secret value; Among them, when the current round is the first round, the preset secret value is used as the second secret value calculated in the previous round; the first ciphertext symbol and the second ciphertext symbol are characters obtained by encrypting the original characters.
9. A data desensitization device, characterized in that: The device comprises: An information acquisition module, used to acquire an image to be desensitized and matching parameters; the matching parameters include: at least one substitution table corresponding to the information type of the information to be desensitized contained in the image to be desensitized, and the number of encryption iterations; the substitution table is generated based on a key; An information encryption module, used for encrypting the information to be desensitized based on the matching parameters to obtain encryption result information, and replacing the information to be desensitized with the encryption result information to obtain a target image after data desensitization; The number of encryption iterations is used to indicate the number of encryption cyclic transformations, and during the cyclic transformation process, the at least one replacement table is used in sequence in a preset order to encrypt the information to be desensitized.
10. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the data desensitization method as claimed in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Desensitization and restoration method and system for webpage screenshots
CN113806806A
Data desensitization and restoration method and device
CN114491624A
Information processing method and device
CN115391826A
Image processing method and device, electronic equipment and readable storage medium
CN116108464A
Desensitization processing method and device for interactive data
CN116663030A
