Medical record data encryption method and system, storage medium and equipment
ASCII code annotation and byte operations are performed on medical record data through a custom linear symmetric encryption algorithm, which solves the problem that the medical record data encryption method in the existing technology cannot take into account both security and reusability, and achieves high security and easy decryption. Effect.
Patent Information
- Application Number
- CN202411203874.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technology cannot ensure both the security of medical record data and its reusability. The irreversible encryption method makes the data non-reusable, while the reversible encryption method has low security and is easy to be cracked.
Use a custom linear symmetric encryption algorithm to annotate the medical record content with ASCII codes, convert each character into a 4-byte ASCII code value, and form a basic reference code through symmetric exchange and byte cross-bit translation. Repeat the operation to After reaching the preset number of times, it is XORed with 1111 to generate the final ciphertext.
It improves the security and unbreakability of medical record data, while simplifying the decryption process and ensuring the reusability and stability of the data.
Smart Images

Figure CN118734341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption, and in particular to a medical record data encryption method, system, storage medium and device. Background Art
[0002] The patient's medical record data has a relatively high security level. After the patient's medical record data is stored in the database or during network transmission, in order to ensure the security of the data, the medical record-related data needs to be encrypted.
[0003] In the prior art, commonly used encryption methods can be roughly divided into two types: one is an irreversible encryption method with high security, such as MD5. After encryption, the medical record data cannot be encrypted and viewed, which makes the data irreusable; the other encryption method is a reversible encryption method with low security, which is often cracked and leaks data, such as DES, etc. Therefore, the encryption method in the prior art cannot ensure both the security and reusability of medical record data. Summary of the invention
[0004] Based on this, the purpose of the present invention is to provide a medical record data encryption method, system, storage medium and device to solve the technical problem that the encryption method in the prior art cannot ensure both the security and reusability of medical record data.
[0005] In one aspect, the present invention provides a method for encrypting medical record data, the method comprising: Obtaining medical record content, and annotating the medical record content with ASCII codes to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; The upper layer bytes and the lower layer bytes are symmetrically swapped according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across bits to obtain a first reference code; the last byte in each bit of the first reference code is pre-placed and symmetrically swapped to obtain a second reference code; and the step of symmetrically swapping the upper layer bytes and the lower layer bytes according to the center line is returned to be executed until the number of repetitions reaches a preset number, and the Nth reference code is output; XOR the Nth reference code with 1111 to obtain the final ciphertext reference code, and convert the ASCII code according to the final ciphertext reference code to obtain the corresponding character to encrypt the medical record content to form the final ciphertext.
[0006] In addition, the medical record data encryption method according to the present invention may also have the following additional technical features: Furthermore, the preset number of times is 8 times.
[0007] Furthermore, the step of shifting bytes in the basic reference code across bits to obtain the first reference code includes: The bytes in the base reference code are shifted by two bytes to obtain the first reference code.
[0008] Another aspect of the present invention provides a medical record data encryption system, the system comprising: An acquisition module is used to acquire medical record content and annotate the medical record content with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; The conversion module is used to symmetrically swap the upper layer bytes with the lower layer bytes according to the center line to obtain a basic reference code, and to shift the bytes in the basic reference code across bits to obtain a first reference code; to prepend the last byte in each bit of the first reference code, and to symmetrically swap them to obtain a second reference code; and to return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line until the number of repetitions reaches a preset number, and output to obtain an Nth reference code; The encryption module is used to perform XOR operation on the Nth reference code and 1111 to obtain the final ciphertext reference code, and perform ASCII code conversion according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext.
[0009] In addition, the medical record data encryption system according to the present invention may also have the following additional technical features: Furthermore, the preset number of times is 8 times.
[0010] Furthermore, the step of shifting bytes in the basic reference code across bits to obtain the first reference code includes: The bytes in the base reference code are shifted by two bytes to obtain the first reference code.
[0011] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the medical record data encryption method as described above when the program is executed by a processor.
[0012] Another aspect of the present invention provides a data processing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the medical record data encryption method as described above when executing the program.
[0013] The above-mentioned medical record data encryption method, system, storage medium and device, by using a customized linear symmetric encryption algorithm, not only ensure the security of medical record data, but also ensure the reusability of medical record data; specifically, the medical record content is annotated with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; the upper bytes and the lower bytes are symmetrically interchanged according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across to obtain a first reference code; the last byte in each first reference code is One byte is prepended and symmetrically exchanged to obtain a second reference code; and the step of symmetrically exchanging the upper layer bytes with the lower layer bytes according to the center line is returned to execute, until the number of repetitions reaches the preset number of times, and the Nth reference code is output; the Nth reference code is XORed with 1111 to obtain the final ciphertext reference code, and the ASCII code is converted according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext; the present application uses a custom encryption method for encryption, which enhances the unbreakable nature of the medical record; uses a linear symmetric encryption method to improve the stability and simplicity of the medical record when decrypting; uses a key for obfuscation, which increases the difficulty of cracking, thereby ensuring the security of the medical record data while also ensuring the reusability of the medical record data. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 This is a flow chart of a method for encrypting medical record data in a first embodiment of the present invention; Figure 2 This is a flow chart of a method for encrypting medical record data in a second embodiment of the present invention; Figure 3 Schematic diagram of the process of labeling medical record contents with ASCII codes; Figure 4 is a flow chart of obtaining a second reference code according to an ASCII code value; Figure 5 is a flow chart of obtaining the Nth reference code in a cycle according to the obtained second reference code; Figure 6 A schematic diagram of a process for obtaining a final ciphertext reference code according to the Nth reference code; Figure 7 A schematic diagram of a process for obtaining a final ciphertext based on a final ciphertext reference code; Figure 8 This is a system block diagram of a medical record data encryption system in the third embodiment of the present invention.
[0015] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0016] In order to facilitate understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0018] In order to solve the technical problem that the encryption method in the prior art cannot ensure both the security and the reusability of medical record data, the present application provides a medical record data encryption method, system, storage medium and device, which ensures both the security and the reusability of medical record data by using a customized linear symmetric encryption algorithm; specifically, the medical record content is annotated with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; the upper bytes and the lower bytes are symmetrically interchanged according to the center line to obtain a basic reference code, and the bytes in the basic reference code are converted into an ASCII code value. Shift across bits to obtain a first reference code; prepend the last byte in each bit of the first reference code and perform symmetrical swapping to obtain a second reference code; return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line, until the number of repetitions reaches a preset number, and output the Nth reference code; XOR the Nth reference code with 1111 to obtain a final ciphertext reference code, and perform ASCII code conversion according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form a final ciphertext; the present application uses a custom encryption method for encryption, which enhances the unbreakability of the medical record; uses a linear symmetric encryption method to improve the stability and simplicity of decrypting the medical record; uses a key for obfuscation, which increases the difficulty of cracking, thereby ensuring the security of the medical record data while also ensuring the reusability of the medical record data.
[0019] In order to facilitate understanding of the present invention, several embodiments of the present invention will be provided below. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0020] Embodiment 1 See also Figure 1 , which shows a medical record data encryption method in a first embodiment of the present invention, and the method includes steps S101 to S103: S101. Obtain the medical record content, and annotate the medical record content with ASCII code to convert each character in the medical record content into an ASCII code value. Each character corresponds to an ASCII code value. The ASCII code value includes 4 bytes. The 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes. A center line is formed between the upper bytes and the lower bytes.
[0021] S102, symmetrically swap the upper layer bytes with the lower layer bytes according to the center line to obtain a basic reference code, and shift the bytes in the basic reference code across bits to obtain a first reference code; prepend the last byte of each bit in the first reference code, and symmetrically swap them to obtain a second reference code; and return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line, until the number of repetitions reaches a preset number, and output the Nth reference code.
[0022] S103, XOR the Nth reference code with 1111 to obtain the final ciphertext reference code, and convert the final ciphertext reference code into ASCII code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext.
[0023] In summary, the medical record data encryption method in the above embodiment of the present invention, by using a customized linear symmetric encryption algorithm, not only ensures the security of medical record data, but also ensures the reusability of medical record data; specifically, the medical record content is annotated with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; the upper bytes and the lower bytes are symmetrically interchanged according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across to obtain a first reference code; the last byte in each first reference code is One byte is prepended and symmetrically exchanged to obtain a second reference code; and the step of symmetrically exchanging the upper layer bytes with the lower layer bytes according to the center line is returned to execute, until the number of repetitions reaches the preset number of times, and the Nth reference code is output; the Nth reference code is XORed with 1111 to obtain the final ciphertext reference code, and the ASCII code is converted according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext; the present application uses a custom encryption method for encryption, which enhances the unbreakable nature of the medical record; uses a linear symmetric encryption method to improve the stability and simplicity of the medical record when decrypting; uses a key for obfuscation, which increases the difficulty of cracking, thereby ensuring the security of the medical record data while also ensuring the reusability of the medical record data.
[0024] Embodiment 2 See also Figure 2 , which shows a medical record data encryption method in a second embodiment of the present invention, and the method includes steps S201 to S203: S201. Obtain the medical record content, and annotate the medical record content with ASCII code to convert each character in the medical record content into an ASCII code value. Each character corresponds to an ASCII code value. The ASCII code value includes 4 bytes. The 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes. A center line is formed between the upper bytes and the lower bytes.
[0025] As a specific example, taking "Chief complaint: intermittent dyspnea for 2 years, aggravated with edema for 4 days" as an example, the content obtained by annotating the medical record content with ASCII code is as follows Figure 3 shown.
[0026] S202, symmetrically swap the upper layer bytes with the lower layer bytes according to the center line to obtain a basic reference code, and shift the bytes in the basic reference code by two bytes to obtain a first reference code; prepend the last byte of each bit in the first reference code and symmetrically swap them to obtain a second reference code; and return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line, until the number of repetitions reaches 8 times, and output the Nth reference code.
[0027] like Figure 4 As shown, first, the upper layer bytes and the lower layer bytes are symmetrically swapped according to the center line to obtain the basic reference code. Secondly, the bytes in the basic reference code are shifted across two bytes to obtain the first reference code. Finally, the last byte of each bit in the first reference code is pre-placed and symmetrically swapped to obtain the second reference code.
[0028] like Figure 5 As shown, the second reference code is obtained, and the step of symmetrically exchanging the upper layer bytes with the lower layer bytes according to the center line is returned until the number of repetitions reaches 8 times, and the Nth reference code is output. S203, XOR the Nth reference code with 1111 to obtain the final ciphertext reference code, and convert the final ciphertext reference code into ASCII code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext.
[0029] Specifically, the Nth reference code is XORed with 1111 to obtain the final ciphertext reference code, such as Figure 6 The final ciphertext reference code is shown as follows; the final ciphertext reference code is then converted to ASCII code to obtain the final ciphertext, as shown in Figure 7 As shown, in this embodiment, the final ciphertext obtained is a special character.
[0030] In summary, the medical record data encryption method in the above embodiment of the present invention, by using a customized linear symmetric encryption algorithm, not only ensures the security of medical record data, but also ensures the reusability of medical record data; specifically, the medical record content is annotated with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; the upper bytes and the lower bytes are symmetrically interchanged according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across to obtain a first reference code; the last byte in each first reference code is One byte is prepended and symmetrically exchanged to obtain a second reference code; and the step of symmetrically exchanging the upper layer bytes with the lower layer bytes according to the center line is returned to execute, until the number of repetitions reaches the preset number of times, and the Nth reference code is output; the Nth reference code is XORed with 1111 to obtain the final ciphertext reference code, and the ASCII code is converted according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext; the present application uses a custom encryption method for encryption, which enhances the unbreakable nature of the medical record; uses a linear symmetric encryption method to improve the stability and simplicity of the medical record when decrypting; uses a key for obfuscation, which increases the difficulty of cracking, thereby ensuring the security of the medical record data while also ensuring the reusability of the medical record data.
[0031] Embodiment 3 See also Figure 8 , which is a medical record data encryption system in a third embodiment of the present invention, and the system includes: An acquisition module is used to acquire medical record content and annotate the medical record content with ASCII code to convert each character in the medical record content into an ASCII code value. Each character corresponds to an ASCII code value. The ASCII code value includes 4 bytes. The 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes. A center line is formed between the upper bytes and the lower bytes. The conversion module is used to symmetrically swap the upper layer bytes with the lower layer bytes according to the center line to obtain a basic reference code, and to shift the bytes in the basic reference code across bits to obtain a first reference code; to prepend the last byte in each bit of the first reference code, and to symmetrically swap them to obtain a second reference code; and to return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line until the number of repetitions reaches a preset number, and output to obtain an Nth reference code; The encryption module is used to perform XOR operation on the Nth reference code and 1111 to obtain the final ciphertext reference code, and perform ASCII code conversion according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext.
[0032] In summary, the medical record data encryption system in the above embodiment of the present invention, by using a customized linear symmetric encryption algorithm, ensures both the security and reusability of medical record data; specifically, the medical record content is annotated with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; the upper bytes and the lower bytes are symmetrically interchanged according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across to obtain a first reference code; the last byte in each bit of the first reference code is converted into an ASCII code value. One byte is prepended and symmetrically exchanged to obtain a second reference code; and the step of symmetrically exchanging the upper layer bytes with the lower layer bytes according to the center line is returned to execute, until the number of repetitions reaches the preset number of times, and the Nth reference code is output; the Nth reference code is XORed with 1111 to obtain the final ciphertext reference code, and the ASCII code is converted according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext; the present application uses a custom encryption method for encryption, which enhances the unbreakable nature of the medical record; uses a linear symmetric encryption method to improve the stability and simplicity of the medical record when decrypting; uses a key for obfuscation, which increases the difficulty of cracking, thereby ensuring the security of the medical record data while also ensuring the reusability of the medical record data.
[0033] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0034] In addition, an embodiment of the present invention further provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method in the above embodiment when executing the program.
[0035] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0036] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in another suitable manner as necessary, and then stored in a computer memory.
[0037] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0038] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0039] Although embodiments of the present invention have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A medical record data encryption method, characterized in that: The method comprises: Obtaining medical record content, and annotating the medical record content with ASCII codes to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; The upper layer bytes and the lower layer bytes are symmetrically swapped according to the center line to obtain a basic reference code, and the bytes in the basic reference code are shifted across bits to obtain a first reference code; the last byte in each bit of the first reference code is pre-placed and symmetrically swapped to obtain a second reference code; and the step of symmetrically swapping the upper layer bytes and the lower layer bytes according to the center line is returned to be executed until the number of repetitions reaches a preset number, and the Nth reference code is output; XOR the Nth reference code with 1111 to obtain the final ciphertext reference code, and convert the ASCII code according to the final ciphertext reference code to obtain the corresponding character to encrypt the medical record content to form the final ciphertext.
2. The medical record data encryption method according to claim 1, characterized in that: The preset number of times is 8 times.
3. The medical record data encryption method according to claim 1, characterized in that: The step of shifting the bytes in the basic reference code across bits to obtain the first reference code comprises: The bytes in the base reference code are shifted by two bytes to obtain the first reference code.
4. A medical record data encryption system, characterized in that: The system comprises: An acquisition module is used to acquire medical record content and annotate the medical record content with ASCII code to convert each character in the medical record content into an ASCII code value, each character corresponds to an ASCII code value, the ASCII code value includes 4 bytes, and the 4 bytes are evenly divided into two layers to obtain upper bytes and lower bytes, and a center line is formed between the upper bytes and the lower bytes; The conversion module is used to symmetrically swap the upper layer bytes with the lower layer bytes according to the center line to obtain a basic reference code, and to shift the bytes in the basic reference code across bits to obtain a first reference code; to prepend the last byte in each bit of the first reference code, and to symmetrically swap them to obtain a second reference code; and to return to execute the step of symmetrically swapping the upper layer bytes with the lower layer bytes according to the center line until the number of repetitions reaches a preset number, and output to obtain an Nth reference code; The encryption module is used to perform XOR operation on the Nth reference code and 1111 to obtain the final ciphertext reference code, and perform ASCII code conversion according to the final ciphertext reference code to obtain the corresponding character, so as to encrypt the medical record content to form the final ciphertext.
5. The medical record data encryption system according to claim 4, characterized in that: The preset number of times is 8 times.
6. The medical record data encryption system according to claim 4, characterized in that: The step of shifting the bytes in the basic reference code across bits to obtain the first reference code comprises: The bytes in the base reference code are shifted by two bytes to obtain the first reference code.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the medical record data encryption method as described in any one of claims 1 to 3 is implemented.
8. A data processing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the medical record data encryption method as described in any one of claims 1 to 3 is implemented.
