Encryption method and device for reserving original format of Chinese character type data and electronic equipment

By randomly encoding and symmetric encryption of Chinese character data, the problem of difficulty in maintaining the original format of Chinese character data in the prior art is solved, and the consistency of data format after encryption and information security is achieved.

CN119598500AInactive Publication Date: 2025-03-11北京建恒信安科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510143271.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2025-03-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing encryption methods are difficult to maintain the original format of Chinese-shaped data while ensuring information security, affecting business processes and user experience.

Method used

By randomly encoding the original Chinese character data, encoded numbers are generated, and these encoded numbers are symmetrically encrypted to generate encoded numbers. Then, the encoded encrypted digital is decoded to generate encrypted target data in the same format.

Benefits of technology

It realizes that Chinese-like data retains the original format during encryption, without affecting information security, and takes into account data consistency and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598500A_ABST
    Figure CN119598500A_ABST
Patent Text Reader

Abstract

The invention provides an encryption method and device for reserving an original format of Chinese character type data and electronic equipment, and relates to the technical field of data encryption, and the method comprises the following steps: firstly, carrying out random coding on original data which is Chinese character type data including sensitive information to generate coded digits, and then carrying out symmetric encryption on the coded digits to generate coded digits; generating a coded encrypted digit; and decoding the coded encrypted digits to generate encrypted target data, and the format of the target data is the same as that of the original data. Through the method, the technical problem of keeping the original format unchanged during Chinese character type data encryption can be solved, and the technical effects of giving consideration to information security and keeping data consistency and compatibility are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data encryption, and in particular to an encryption method, device and electronic device for retaining the original format of Chinese character data. Background Art

[0002] With the rapid development of the information society, information security has become one of the key issues in various fields. Especially in today's world where data exchange is frequent and information spreads rapidly, the protection of sensitive information is particularly important. Sensitive information covers a wide range, including but not limited to personal privacy, commercial secrets, etc. Among them, Chinese character data, as an important information carrier, is widely used in scenarios such as user names and addresses.

[0003] There are many existing technologies for protecting sensitive information, and encryption technology is an indispensable part of it. It can protect information by transforming the original data, making it difficult for unauthorized persons to interpret its content. However, traditional encryption methods are mainly aimed at data in binary or specific encoding formats. The encrypted results are often quite different from the original data in form, causing the encrypted content to become a random combination of characters or numbers. Although it protects information security, it affects the convenience of use.

[0004] In actual applications, in order to maintain interface consistency and user experience, it is sometimes necessary to present encrypted Chinese characters in Chinese form, but the specific content cannot be recognized. Conventional encryption algorithms are difficult to meet this requirement, which may affect business processes and reduce user experience. Therefore, when processing sensitive Chinese character data, how to ensure information security while keeping the Chinese character format unchanged becomes an important challenge. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide an encryption method, device and electronic device for retaining the original format of Chinese character data, so as to solve the technical problem of ensuring information security while keeping the Chinese character format unchanged when processing sensitive Chinese character data.

[0006] In a first aspect, the present invention provides an encryption method for Chinese character data that retains the original format, the method comprising: randomly encoding the original data to generate a coded number; the original data is Chinese character data, and the Chinese character data includes sensitive information; symmetrically encrypting the coded number to generate a coded encrypted number; decoding the coded encrypted number to generate encrypted target data; the target data has the same format as the original data.

[0007] In some optional implementations, the above-mentioned original data includes at least one Chinese character; the step of randomly encoding the original data to generate a coded number includes: character encoding the Chinese characters in the above-mentioned original data to generate a coded sequence; using the first number of bytes as a sliding window and the second number of bytes as a step size, sliding sampling the above-mentioned coded sequence to generate a coded number.

[0008] In some optional implementations, the above character encoding is UTF-8 character encoding; the above first number is 4; and the above second number is the number of bytes occupied after the Chinese characters are character encoded.

[0009] In some optional implementations, the method further includes: when the sliding window slides to the end of the coding sequence and the sampled bytes are less than the first number, starting from the first position of the coding sequence, taking a corresponding number of bytes for filling.

[0010] In some optional implementations, the step of symmetrically encrypting the above-mentioned coded numbers to generate coded encrypted numbers includes: using a first symmetric encryption algorithm to calculate the MD5 value of a pre-acquired key; generating a set of coded integers based on the MD5 value of the key and the above-mentioned coded numbers; and encrypting based on the above-mentioned set of coded integers and the above-mentioned pre-acquired key using a second symmetric encryption algorithm to generate a coded encrypted number.

[0011] In some optional implementations, the first symmetric encryption algorithm is a DES algorithm; and the second symmetric encryption algorithm is a FPE algorithm.

[0012] In some optional implementations, the step of decoding the above-mentioned coded encryption number to generate the encrypted target data includes: determining the ciphertext corresponding to each Chinese character in the above-mentioned original data in the above-mentioned ciphertext dictionary based on the number of words in the pre-generated ciphertext dictionary and the above-mentioned coded encryption number; and determining that the data composed of the encrypted Chinese characters is the target data according to the ciphertext corresponding to each Chinese character.

[0013] In the second aspect, an embodiment of the present invention provides an encryption device for retaining the original format of Chinese character data, the device comprising: an encoding module, used to randomly encode the original data to generate a coded number; the above original data is Chinese character data, and the above Chinese character data includes sensitive information; an encryption module, used to symmetrically encrypt the above coded number to generate a coded encrypted number; a decoding module, used to decode the above coded encrypted number to generate encrypted target data; the above target data has the same format as the above original data.

[0014] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, the steps of any one of the methods described in the first aspect are implemented.

[0015] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute any method described in the first aspect.

[0016] The present invention provides an encryption method, device and electronic device for retaining the original format of Chinese character data, the method comprising: firstly randomly encoding the original data to generate a coding number, the original data being Chinese character data including sensitive information, then symmetrically encrypting the coding number to generate a coding encryption number; then decoding the coding encryption number to generate encrypted target data, the target data having the same format as the original data. The method can solve the technical problem of retaining the original format when encrypting Chinese character data, and achieve the technical effect of taking into account information security and maintaining data consistency and compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A schematic diagram of a flow chart of an encryption method for Chinese character data that retains the original format provided in an embodiment of the present application; Figure 2 A schematic diagram of the principle of character encoding and sampling provided by an embodiment of the present invention; Figure 3 A schematic diagram of the structure of an encryption device for retaining the original format of Chinese character data provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0020] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. Some embodiments of the present invention are described in detail below in conjunction with the drawings. The following embodiments and features in the embodiments can be combined with each other without conflict.

[0022] Chinese character data is an important information carrier and is widely used in scenarios such as user names and addresses. There are many existing technologies for protecting sensitive information, and encryption technology is an indispensable part of it. It can achieve the purpose of protecting information by transforming the original data, making it difficult for unauthorized persons to interpret its content. However, traditional encryption methods are mostly applicable to binary data or data in a specific encoding format, and the encrypted results are often quite different from the original data form. For example, the encrypted content usually becomes a string of seemingly random characters or digital combinations. Although this achieves effective protection of information, it brings inconvenience in some application scenarios.

[0023] In actual applications, there are a large number of data processing requirements that need to retain the original format requirements. For example, when displaying some desensitized personal information, in order to maintain the consistency of the interface and user experience, it is expected that the encrypted Chinese characters can still be presented in the form of Chinese characters, but the specific content is no longer recognizable. In this case, if a conventional encryption algorithm is used, it will not be able to meet the requirements of retaining the Chinese character format, which will in turn affect the normal operation of related business processes and the user experience. Therefore, in application scenarios involving encryption of sensitive Chinese character data, there is a challenge of how to ensure that the encrypted Chinese characters still maintain the original Chinese character format while ensuring information security.

[0024] Based on this, an embodiment of the present invention provides an encryption method, device and electronic device for retaining the original format of Chinese character data to solve the above technical problems.

[0025] To facilitate understanding of this embodiment, firstly, a method for encrypting Chinese character data in original format disclosed in an embodiment of the present invention is described in detail. Figure 1 The flowchart of a method for encrypting Chinese character data in original format is shown. The method can be executed by an electronic device and mainly includes the following steps S110 to S130: S110: Randomly encode the original data to generate a coded number; the original data is Chinese character data, and the Chinese character data includes sensitive information; Among them, sensitive information can be name, address, company name, file name, etc. Combined with specific scenarios, this method can be applied to: protecting patient identity information in medical information systems, encrypting and storing user names and file names in corporate internal networks, encrypting customer identity information and addresses in financial systems, etc.

[0026] In one embodiment, the original data includes at least one Chinese character; the step of performing random encoding on the original data to generate a coded number in S110 includes: (S11) performing character encoding on Chinese characters in the original data to generate a coding sequence; (S12) Sliding sampling is performed on the coding sequence using the first number of bytes as a sliding window and the second number of bytes as a step length to generate a coding number.

[0027] The character encoding may be UTF-8 character encoding; the first number is 4; and the second number is the number of bytes occupied after the Chinese characters are encoded.

[0028] In one embodiment, the method further includes: when the sliding window slides to the end of the coding sequence and the sampled bytes are less than the first number, starting from the first position of the coding sequence, taking a corresponding number of bytes for filling.

[0029] Taking continuous text ("format-preserving encryption scheme") as an example, convert each Chinese character into UTF-8 encoding. The UTF-encoding of each Chinese character occupies 3 bytes, and a sequence of 3 bytes is obtained. The result is as follows Figure 2 As shown in part (A) of . In the sequence, the sliding window gram is set in units of 4 bytes, and the window step is 3 bytes (the step here is the number of bytes that the sampling window slides each time), and the sliding sampling is performed in the sequence, as shown in Figure 2 As shown in part (B).

[0030] At the first sampling, in addition to the three bytes containing the first character "保", it also includes the first byte of the next adjacent character "留". When the sliding window slides to the last character "案", the first byte in the first character "保" is taken for filling to ensure that each sampling is 4 bytes. The four sampled bytes serve as the encoding basis for the current character. For example, the three bytes of the character "保" and the first byte of the character "留" serve as the encoding basis for the character "保". Pseudo-randomness is achieved by considering the first byte of the subsequent character.

[0031] In another embodiment, the window for sliding sampling in the sequence can also be 5 bytes or 6 bytes, that is, the condition for setting the window for sliding sampling is: at least greater than the number of bytes of one Chinese character (3 bytes) and less than or equal to the number of bytes of two Chinese characters (6 bytes).

[0032] S120: Symmetrically encrypt the encoded number to generate an encoded encrypted number; In one embodiment, the step of S120 symmetrically encrypting the encoded number to generate an encoded encrypted number includes: (S21) Calculate the MD5 value of the pre-obtained key using the first symmetric encryption algorithm; Among them, the pre-obtained key is generally a password randomly input by the user during desensitization. In one embodiment, the first symmetric encryption algorithm is the DES algorithm.

[0033] (S22) Generate an encoded integer set based on the MD5 value of the key and the encoded number; (S23) Encrypt using the second symmetric encryption algorithm based on the encoded integer set and the pre-obtained key to generate an encoded encrypted number.

[0034] In one embodiment, the second symmetric encryption algorithm is the FPE algorithm. FPE (Format-Preserving Encryption) is a special encryption technology that allows data to be encrypted while maintaining the original data format. This feature makes FPE very useful when processing specific types of data. By using FPE, the encrypted data can be seamlessly integrated into existing systems and databases without modifying the data structure of the system. FPE belongs to an application form of symmetric encryption algorithms, and its main purpose is to solve the problem of maintaining the original data format during the data encryption process. Symmetric encryption refers to an encryption technology that uses the same key for encryption and decryption.

[0035] As a specific example, the above process of symmetrically encrypting the encoded number includes: First, use the MD5-32 algorithm to calculate the MD5 value of the 32-bit length key, that is: K = MD5-32(key) {key is the input password} (i.e. the key obtained in advance); Then use this 32-bit K and each 32-bit sample data obtained in the above steps to perform des-32 operation: ; in, S n is the sampling data of the nth word, Z n The integer after the nth word is encoded. Z n Compose an integer set Z, and regard Z as the result of encoding the sequence.

[0036] So far, the encoding work has been completed, that is, the process of converting the original data (plain text) into integers.

[0037] Next, Z n Perform RtE operation: ; The RtE operation is an FPE algorithm for integers, which has been proven to be secure. The key is the pre-obtained key. This step achieves a certain degree of randomness, so the subsequent decoding process can directly look up the table for comparison and decoding.

[0038] This step is to perform a random transformation on the integer obtained after the plaintext is converted. The RtE operation is a relatively mature algorithm for encrypting integers in a format-preserving manner. The output of this step is still an integer.

[0039] S130: Decode the encoded encrypted digital data to generate encrypted target data; the target data has the same format as the original data.

[0040] In one embodiment, the step of decoding the encoded encryption number to generate encrypted target data in S130 includes: (S31) determining the ciphertext corresponding to each Chinese character in the original data in the ciphertext dictionary based on the number of characters in the pre-generated ciphertext dictionary and the encoded encryption number; (S32) According to the ciphertext corresponding to each Chinese character, the encrypted data composed of each Chinese character is determined as the target data.

[0041] In other words, the decoding method needs to be designed according to the business problem. The decoding process is to convert integers into Chinese characters, and this step requires different processing according to different data.

[0042] Since direct arithmetic operations cannot be performed on Chinese characters, during the desensitization of Chinese characters, it is necessary to map Chinese characters to numbers and then perform FPE encryption on the numbers. First, encode the plaintext (encode), map the characters in the Chinese character space to the corresponding integer space, and convert Chinese characters to integers; then, perform FPE encryption on the obtained numbers; finally, decode the result of the operation to the Chinese character space according to business needs to obtain the ciphertext.

[0043] As a specific example, taking the encryption of the name "Zou Jingen" as an example, the process is as follows: Encoding: 1. For "Zou Jingen", each character occupies 3 bytes, totaling 9 bytes. Assume the utf-8 encoding of "Zou Jingen" is: 11101001 10100010 10011111; 11101111 10100010 10011111; 11111111 10100010 10011111. 2. After 4B-gram sampling, the sampling data of "Zou" is obtained: 11101001 10100010 10011111 11101111; And so on, the sampling data of "Jin" is: 11101111 10100010 10011111 11111111; The sampling data of "Gen" is: 11111111 10100010 10011111 11101001; Encryption: 3. Perform des-32 encryption on the above data to obtain an integer. Assume they are 153454, 156455, 5468465 respectively. Then 153454 is considered the encoding of "Zou", 156455 is the encoding of "Jin", and "5468465" is the encoding of "Gen".

[0044] 4. Perform RtE operations on 153454, 156455, and 5468465 respectively to obtain: 1156, 235, 568.

[0045] Decoding: 5. Assume there are 100 surnames and 300 common names, then: 1156 / / 100 = 56. In the surname dictionary, the 56th surname is considered the ciphertext of "Zou"; 235 / / 300 = 235. In the name dictionary, the 235th character is considered the ciphertext of "Jin"; 568 / / 300=268, the 268th character in the name dictionary, is considered to be the ciphertext of "root"; After the above steps, the encryption of "Zou Jingen" is completed.

[0046] The present invention provides an encryption method for Chinese character data retaining the original format, the method comprising: firstly, randomly encoding the original data to generate a coding number, the original data is Chinese character data including sensitive information, then symmetrically encrypting the coding number to generate a coding encryption number; then decoding the coding encryption number to generate encrypted target data, the target data has the same format as the original data. The method can solve the technical problem of retaining the original format when encrypting Chinese character data, and achieve the technical effect of taking into account information security and maintaining data consistency and compatibility.

[0047] Based on the same inventive concept, the present application also provides an encryption device for retaining the original format of Chinese character data, combined with Figure 3 As shown, the device comprises: The encoding module 310 is used to randomly encode the original data to generate a coded number; the original data is Chinese character data, and the Chinese character data includes sensitive information; The encryption module 320 is used to symmetrically encrypt the coded number to generate a coded encrypted number; The decoding module 330 is used to decode the coded encrypted digital data to generate encrypted target data; the target data has the same format as the original data.

[0048] The encryption device for retaining the original format of Chinese character data provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device, etc. The implementation principle and technical effect of the device provided in the embodiment of the present application are the same as those of the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment. Technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here. The encryption device for retaining the original format of Chinese character data provided in the embodiment of the present application has the same technical features as the encryption method for retaining the original format of Chinese character data provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0049] An embodiment of the present application further provides an electronic device. Specifically, the electronic device includes a processor and a storage device. The storage device stores a computer program, and when the computer program is executed by the processor, it executes the method described in any one of the above-mentioned embodiments.

[0050] Figure 4A structural schematic diagram of an electronic device provided in an embodiment of the present application, the electronic device 400 includes: a processor 40, a memory 41, a bus 42 and a communication interface 43, wherein the processor 40, the communication interface 43 and the memory 41 are connected via the bus 42; the processor 40 is used to execute an executable module stored in the memory 41, such as a computer program.

[0051] The memory 41 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 43 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0052] The bus 42 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0053] Among them, the memory 41 is used to store programs, and the processor 40 executes the program after receiving the execution instruction. The method executed by the process definition device disclosed in any embodiment of the above-mentioned embodiment of the present invention can be applied to the processor 40 or implemented by the processor 40.

[0054] The processor 40 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 40. The above processor 40 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as a hardware decoding processor to execute, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 41, and the processor 40 reads the information in the memory 41 and completes the steps of the above method in combination with its hardware.

[0055] Corresponding to the above method, an embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the steps of the above method.

[0056] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0057] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0058] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0059] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0060] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0061] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for encrypting Chinese character data in original format, characterized in that: The method comprises: Randomly encode the original data to generate a coded number; the original data is Chinese character data, and the Chinese character data includes sensitive information; Symmetrically encrypting the coded number to generate a coded encrypted number; The encoded encryption number is decoded to generate encrypted target data; the target data has the same format as the original data.

2. A method for encrypting Chinese character data in original format according to claim 1, characterized in that: The original data includes at least one Chinese character; The steps of randomly encoding the original data and generating the encoded numbers include: Performing character encoding on the Chinese characters in the original data to generate a coding sequence; The encoding sequence is subjected to sliding sampling with the first number of bytes as a sliding window and the second number of bytes as a step length to generate an encoding number.

3. A method for encrypting Chinese character data in original format according to claim 2, characterized in that: The character encoding is UTF-8 character encoding; the first number is 4; the second number is the number of bytes occupied after the Chinese characters are character encoded.

4. A method for encrypting Chinese character data in original format according to claim 3, characterized in that: The method further comprises: When the sliding window slides to the end of the coding sequence and the sampled bytes are less than the first number, a corresponding number of bytes are taken from the first position of the coding sequence for padding.

5. The encryption method for Chinese character data retaining the original format according to claim 2, characterized in that: The step of symmetrically encrypting the coded number to generate the coded encrypted number comprises: Calculate the MD5 value of the pre-acquired key using the first symmetric encryption algorithm; Generate a set of coded integers based on the MD5 value of the key and the coded number; Based on the coded integer set and the pre-acquired key, encryption is performed using a second symmetric encryption algorithm to generate a coded encrypted number.

6. A method for encrypting Chinese character data in original format according to claim 5, characterized in that: The first symmetric encryption algorithm is the DES algorithm; the second symmetric encryption algorithm is the FPE algorithm.

7. The encryption method for Chinese character data retaining the original format according to claim 1, characterized in that: The step of decoding the coded encryption number to generate encrypted target data comprises: Determine the ciphertext corresponding to each Chinese character in the original data in the ciphertext dictionary based on the number of characters in the pre-generated ciphertext dictionary and the encoded encryption number; According to the ciphertext corresponding to each Chinese character, the data composed of the encrypted Chinese characters is determined to be the target data.

8. An encryption device for retaining the original format of Chinese character data, characterized in that: The device comprises: The encoding module is used to randomly encode the original data to generate a coded number; the original data is Chinese character data, and the Chinese character data includes sensitive information; An encryption module, used for symmetrically encrypting the coded number to generate a coded encrypted number; The decoding module is used to decode the coded encrypted digital data to generate encrypted target data; the target data has the same format as the original data.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data encryption method and system, electronic device and storage medium

    CN113268747A

  • Chinese character data desensitization method and device

    CN116980192A

  • Chinese and English mixed reserved format encryption method and system based on SM4 cryptographic algorithm

    CN117614615A