Private data processing method and device, computer equipment and storage medium

By using the Fibonacci hash algorithm to map the encrypted private data hash value to the target value and convert it into a shorter hash value, the problem of increased data length after encrypted storage is solved and data security and Optimization of storage resources.

CN119337401APending Publication Date: 2025-01-21CHINA ACADEMY OF RAILWAY SCI CORP LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411470321.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

After encrypting the storage of private data, the data length exceeds the original data length, resulting in an increase in storage space and an increase in information interaction pressure.

Method used

By obtaining the first data length of the data to be processed and performing encryption processing using a preset encryption algorithm, the first hash value is obtained. Then, map the first hash value to the target value based on the Fibonacci hash algorithm and convert it to a second hash value of a second data length for storage in the database, the second data length being smaller than the first Data length.

Benefits of technology

It ensures the uniqueness of the target value corresponding to each data to be processed, ensures the security of private data, and reduces storage resource consumption by compressing the data length. At the same time, there is no need to modify the business system module to adapt to national security standards and regulatory requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119337401A_ABST
    Figure CN119337401A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a privacy data processing method, a privacy data processing device, computer equipment and a computer storage medium, and relates to the technical field of data processing and data security. The method comprises the steps of obtaining a first data length of to-be-processed data, and performing encryption processing on the to-be-processed data through a preset encryption algorithm to obtain a first hash value for the to-be-processed data; mapping the first Hash value into a target value based on a Fibonacci Hash algorithm; wherein different to-be-processed data correspond to different target values; the target numerical value is converted into a second hash value of a second data length, so that the second hash value is stored in the database, and the second data length is smaller than the first data length. According to the method, the length of the encrypted data can be smaller than that of the original data, the data storage resource consumption is reduced, and then the information interaction pressure between subsequent systems is reduced.
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 processing and data security, and in particular, to a method for processing privacy data, a device for processing privacy data, a computer device, and a computer storage medium. Background Art

[0002] With the rapid development of computer technology, the amount of data on the Internet has increased. The data integration between multiple systems has broken through the data islands and realized the mining of greater data value. At the same time, it also brings huge security risks for private data such as user names, bank card numbers, ID numbers, mobile phone numbers, etc. Therefore, the security protection method for private data is particularly important.

[0003] In related technical solutions, the system usually encrypts and stores private data to convert it into human-unrecognizable characters, such as using the national secret SM2 algorithm of asymmetric encryption algorithm. However, the length of the encrypted and stored data exceeds the length of the original data, resulting in an increase in data storage space, which in turn increases the pressure of information interaction between subsequent systems. Summary of the invention

[0004] The embodiments of the present application provide a method for processing privacy data, a device for processing privacy data, a computer device, and a computer storage medium, thereby overcoming, at least to a certain extent, the technical problem that, due to the limitations and defects of related technologies, the length of encrypted and stored data exceeds the length of original data, resulting in an increase in data storage space, thereby increasing the pressure of subsequent information interaction between systems.

[0005] A first aspect of an embodiment of the present application provides a method for processing privacy data, the method comprising: obtaining a first data length of data to be processed, encrypting the data to be processed by a preset encryption algorithm, and obtaining a first hash value for the data to be processed; mapping the first hash value to a target value based on a Fibonacci hash algorithm; wherein different data to be processed correspond to different target values; converting the target value into a second hash value of a second data length to store the second hash value in a database, wherein the second data length is less than the first data length.

[0006] In an optional embodiment of the present application, the preset encryption algorithm includes one or more of the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm.

[0007] In an optional embodiment of the present application, mapping a first hash value to a target numerical value based on a Fibonacci hash algorithm includes: obtaining a total value of the quantity of data to be processed; determining, based on the total value, that the space size of a digital hash space corresponding to the Fibonacci hash algorithm is a first space size; wherein a number of space slots corresponding to the first space size is set in the digital hash space, and the label values ​​corresponding to the space slots are different; mapping the first hash value to a target label value in the digital hash space, and determining the target label value as the target numerical value.

[0008] In an optional embodiment of the present application, the method further includes: determining a target parameter value in response to an adjustment operation on the Fibonacci hash parameter; and adjusting the space size of the digital hash space from a first space size to a second space size according to the target parameter value.

[0009] In an optional embodiment of the present application, converting the target value into a second Hash value of a second data length includes: encoding the target value based on a variable-length digital encoding method to obtain the second Hash value of the second data length.

[0010] In an optional embodiment of the present application, the data to be processed includes multiple data to be stored, and converting the target value into a second hash value of a second data length includes: for each data to be stored in the data to be processed, converting the first target value corresponding to each data to be stored into multiple hash values ​​of the first target data length, and superimposing the first target data length corresponding to each data to be stored to obtain a second hash value of the second data length corresponding to the data to be processed; the first target value is a set of multiple target values ​​obtained by mapping the multiple data to be stored based on the Fibonacci hash algorithm;

[0011] Alternatively, for the data to be processed, the second target numerical value corresponding to each data to be stored is converted into a hash value of the second target data length to obtain a second hash value of the second data length.

[0012] In an optional embodiment of the present application, after converting the target numerical value into a second hash value of a second data length, the method further includes: converting the second hash value into recognizable characters through a preset encoding method; wherein the preset encoding method includes one of Base64 encoding, HEX encoding, and UTF-8 encoding.

[0013] According to a second aspect of an embodiment of the present application, a device for processing privacy data is provided, which includes: a data encryption module, used to obtain a first data length of data to be processed, encrypt the data to be processed by a preset encryption algorithm, and obtain a first hash value for the data to be processed; a numerical mapping module, used to map the first hash value to a target numerical value based on the Fibonacci hash algorithm; wherein different data to be processed correspond to different target numerical values; a conversion module, used to convert the target numerical value into a second hash value of a second data length, so as to store the second hash value in a database, wherein the second data length is less than the first data length.

[0014] In an optional embodiment of the present application, the preset encryption algorithm includes one or more of the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm.

[0015] In an optional embodiment of the present application, a numerical mapping module is specifically used to obtain the total value of the quantity of data to be processed; based on the total value, determine that the space size of the digital hash space corresponding to the Fibonacci hash algorithm is the first space size; wherein, the number of space slots corresponding to the first space size is set in the digital hash space, and the label values ​​corresponding to each space slot are different; map the first hash value to the target label value in the digital hash space, and determine the target label value as the target numerical value.

[0016] In an optional embodiment of the present application, the device may also include a determination module and an adjustment module, the determination module being used to determine a target parameter value in response to an adjustment operation on a Fibonacci hash parameter; and the adjustment module being used to adjust the space size of the digital hash space from a first space size to a second space size according to the target parameter value.

[0017] In an optional embodiment of the present application, the conversion module is specifically used to encode the target value based on a variable-length digital encoding method to obtain a second hash value of a second data length.

[0018] In an optional embodiment of the present application, the data to be processed includes multiple data to be stored, and the conversion module is specifically used to convert the first target value corresponding to each data to be stored in the data to be processed into multiple hash values ​​of the first target data length, and superimpose the first target data length corresponding to each data to be stored to obtain a second hash value of the second data length corresponding to the data to be processed; the first target value is a set of multiple target values ​​obtained by mapping the multiple data to be stored based on the Fibonacci hash algorithm;

[0019] Alternatively, the conversion module is specifically configured to convert, for the data to be processed, the second target numerical value corresponding to each data to be stored into a hash value of the second target data length, to obtain a second hash value of the second data length.

[0020] In an optional embodiment of the present application, the conversion module can also be used to convert the second hash value into recognizable characters through a preset encoding method; wherein the preset encoding method includes one of Base64 encoding, HEX encoding, and UTF-8 encoding.

[0021] According to a third aspect of an embodiment of the present application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any of the above methods for processing privacy data are implemented.

[0022] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the privacy data processing method as described in any one of the above items are implemented.

[0023] According to a fifth aspect of the embodiments of the present application, a computer program product is provided, including a computer program, which is executed by a processor to implement the steps of any one of the above methods for processing privacy data.

[0024] The technical solution of this application has the following beneficial effects:

[0025] Through the above-mentioned privacy data processing method, the first data length of the data to be processed is obtained, and the data to be processed is encrypted by a preset encryption algorithm to obtain a first hash value for the data to be processed; the first hash value is mapped to a target value based on the Fibonacci hash algorithm; wherein different target values ​​corresponding to different data to be processed are different; the target value is converted into a second hash value of a second data length to store the second hash value in the database, and the second data length is less than the first data length. On the one hand, the method maps the encrypted first hash value to the digital hash space through the Fibonacci hash algorithm and obtains a unique target value, thereby ensuring the uniqueness of the target value corresponding to each data to be processed, and the plaintext data of the data to be processed cannot be reversely parsed based on the target value, thereby ensuring the security of the privacy data; on the other hand, the Fibonacci hash algorithm can make each target value evenly distributed and not aggregated, ensuring the security of the data. On the other hand, through the above-mentioned method, the original length of the data to be processed is compressed to a second hash value with a smaller length, reducing the resource consumption of data storage, and the method can rewrite the original data into the original field after conversion, that is, it is ensured that the business system module does not need to be modified, and it can also ensure that it adapts to national safety standards and regulatory requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0027] Figure 1 An architectural diagram of a privacy data processing system provided in one embodiment of the present application;

[0028] Figure 2 A flowchart of a method for processing privacy data provided in one embodiment of the present application;

[0029] Figure 3 A flowchart of a method for mapping a first hash value to a target value based on a Fibonacci hash algorithm provided in one embodiment of the present application;

[0030] Figure 4 A schematic diagram of evaluating a Fibonacci hash algorithm provided for one embodiment of the present application;

[0031] Figure 5 A schematic diagram of the structure of a privacy data processing device provided in one embodiment of the present application;

[0032] Figure 6 A schematic diagram of the computer device structure provided for one embodiment of the present application. DETAILED DESCRIPTION

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0034] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps may be decomposed, while some steps may be combined or partially combined, so the actual execution order may change according to the actual situation.

[0036] In the relevant technical background, with the rapid development of computer technology, the data on the Internet has become more and more, and the data fusion between multiple systems has opened up data islands and realized the mining of greater data value. At the same time, it also brings huge security risks for private data such as user names, bank card numbers, ID numbers, mobile phone numbers, etc. Therefore, the security protection method for private data is particularly important. The country has also issued corresponding privacy laws and security restriction rules, stipulating that private data cannot be stored in plain text or written to log files. Existing technical solutions usually encrypt plain text data to convert it into characters that cannot be recognized by humans or hide the plain text data so that it cannot be used for business processing.

[0037] The following will be combined with specific embodiments to exemplify the mainstream encryption methods used in the above-mentioned related technical solutions:

[0038] First, use an asymmetric encryption algorithm to encrypt plaintext data.

[0039] Asymmetric encryption algorithms can be, for example, the national secret SM2 algorithm, the RSA algorithm, etc. Generally, as the key length increases, the difficulty of cracking will also increase significantly. Therefore, in order to ensure security, a key length of at least 1024 bits or even at least 2048 bits is usually used for encryption, which makes the encrypted data longer and increases the data storage space.

[0040] Second, the plaintext data is processed using a hash algorithm.

[0041] A hash algorithm is an algorithm that transforms data of any length into fixed-length data through a specific algorithm. The transformation is one-way and its purpose is to generate a short unique identifier, which can be called a hash value. Common hash algorithms include MD5, SHA-1, SHA-2, SHA-256, etc.

[0042] The length of the hash value generated by the hash algorithm is usually 32 or 64 characters, while the hash generated by the SM2 algorithm is 128 bits of binary data. For the convenience of storage, the above-generated hash value is usually converted into Hex characters or Base64 for storage. Taking the 11-digit mobile phone number as an example, the length of the data generated and stored in the database is usually 64 characters or 44 characters.

[0043] The inventors found that the above-mentioned related technical solutions all make the length of data stored in the database longer, which in turn leads to an increase in data storage space. In particular, when the types and amount of private data are huge, the storage pressure of the database increases dramatically. Correspondingly, the large data length will also increase the subsequent data interaction pressure with the business system or third-party system; and the change in data length also requires corresponding modifications to each module of the business system, resulting in poor stability of the business system.

[0044] In view of the above problems, the exemplary embodiment of the present disclosure proposes a method for processing privacy data. On the one hand, the method maps the encrypted first hash value to the digital hash space through the Fibonacci hash algorithm and obtains a unique target value, thereby ensuring the uniqueness of the target value corresponding to each data to be processed, and the plaintext data of the data to be processed cannot be reversely parsed based on the target value, thereby ensuring the security of the privacy data. On the other hand, the Fibonacci hash algorithm can make each target value evenly distributed and not aggregated, ensuring the security of the data. On the other hand, the original length of the data to be processed is compressed to a second hash value with a smaller length through the above method, reducing the resource consumption of data storage, and the method can rewrite the original data into the original field after conversion, which ensures that the business system module does not need to be modified and can also ensure compliance with national safety standards and regulatory requirements.

[0045] The following will be combined Figure 1 , a privacy data processing method and device proposed in the present disclosure is applied to Figure 1 The embodiments are described in the system architecture of the exemplary application environment shown.

[0046] Figure 1 This is an architectural diagram of a privacy data processing system provided in one embodiment of the present application; refer to Figure 1 As shown, it is a schematic diagram of an application scenario provided by an embodiment of the present application. In this scenario, a terminal device 101 and a server 102 may be included.

[0047] The terminal device 101 can be, for example, a mobile phone, a tablet computer (PAD), a laptop computer, a desktop computer, a smart TV, a smart vehicle-mounted device, a smart wearable device, a smart TV, an aircraft, or any other device that involves privacy data processing. The terminal device 101 can be installed with a target application, and the target application can have functions such as triggering operations for privacy data processing and displaying privacy data processing results. The application involved in the embodiment of the present application can be a software client, or a client such as a web page or a small program. The server 102 is a server corresponding to the software or a web page, a small program, etc., and does not limit the specific type of the client.

[0048] The server 102 may be a background server of the target application, used to provide corresponding background services for it, such as privacy data processing services, etc. It may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, i.e., content delivery networks (CDNs), as well as big data and artificial intelligence platforms, but is not limited thereto.

[0049] The method for processing privacy data in the embodiment of the present application can be executed by the terminal device 101 or the server 102 alone, or by the server 102 and the terminal device 101 together, and the present application does not make specific limitations here. Among them, the server 102 and the terminal device 101 may each include one or more processors, memories, and interactive I / O interfaces, etc. In addition, the server 102 may also be configured with a database for storing privacy data. Among them, the memories of the server 102 and the terminal device 101 may also store the program instructions required to be executed in the method for processing privacy data provided in the embodiment of the present application, and these program instructions can be used to implement the processing process of privacy data provided in the embodiment of the present application when executed by the processor.

[0050] It should be noted that when the privacy data processing method provided in the embodiment of the present application is executed by the server 102 or the terminal device 101 alone, the above-mentioned application scenario may also only include a single device of the server 102 or the terminal device 101, or the server 102 and the terminal device 101 may also be considered to be the same device. Of course, in actual application, when the privacy data processing method provided in the embodiment of the present application is jointly executed by the server 102 and the terminal device 101, the server 102 and the terminal device 101 may also be the same device, that is, the server 102 and the terminal device 101 may be different functional modules of the same device, or virtual devices virtualized from the same physical device.

[0051] In the embodiment of the present application, the terminal device 101 and the server 102 can be directly or indirectly connected to each other through one or more networks 103. The network 103 can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a wireless fidelity (Wireless-Fidelity, WIFI) network. Of course, it can also be other possible networks, which are not limited in the embodiment of the present application. It should be noted that Figure 1 The figure is only an example. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of the present application.

[0052] For example, in an exemplary embodiment, a user may trigger a service request through the terminal device 101, and the server 102 may call the privacy data in the system based on the service request to process the privacy data. That is, the server 102 obtains the first data length of the data to be processed, encrypts the data to be processed through a preset encryption algorithm, and obtains a first hash value for the data to be processed; maps the first hash value to a target value based on the Fibonacci hash algorithm; wherein different data to be processed correspond to different target values; converts the target value into a second hash value of a second data length, so as to store the second hash value in the database, and the second data length is less than the first data length.

[0053] Below, in combination with the application scenarios described above, the method provided by the exemplary implementation of the present application is described with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in this respect. It should be noted that the following method can be executed by the above terminal device or server, or by the terminal device and the server together. Here, it is specifically shown by taking the execution of the terminal device or the server as an example.

[0054] See also Figure 2 As shown, it is a schematic diagram of the training process of the target language model provided in the embodiment of the present application. The method can be executed by a computer device, which can be Figure 1 The terminal device or server shown in the figure, the specific implementation process of the method is shown in steps 201 to 203 as follows:

[0055] Step 201: Obtain a first data length of the data to be processed, encrypt the data to be processed using a preset encryption algorithm, and obtain a first hash value for the data to be processed.

[0056] Step 202: Map the first hash value to a target value based on the Fibonacci hash algorithm; wherein different target values ​​correspond to different data to be processed.

[0057] Step 203: Convert the target numerical value into a second Hash value of a second data length to store the second Hash value in a database, where the second data length is smaller than the first data length.

[0058] In the technical solutions provided by some embodiments of the present disclosure, by obtaining the first data length of the data to be processed, the data to be processed is encrypted by a preset encryption algorithm to obtain a first hash value for the data to be processed; the first hash value is mapped to a target value based on the Fibonacci hash algorithm; wherein different target values ​​corresponding to different data to be processed are different; the target value is converted into a second hash value of a second data length to store the second hash value in a database, and the second data length is less than the first data length. On the one hand, the method maps the encrypted first hash value to a digital hash space by the Fibonacci hash algorithm, and obtains a unique target value, thereby ensuring the uniqueness of the target value corresponding to each data to be processed, and the plaintext data of the data to be processed cannot be reversely parsed based on the target value, thereby ensuring the security of the privacy data. On the other hand, the Fibonacci hash algorithm can make each target value evenly distributed and not aggregated, ensuring the security of the data. On the other hand, the original length of the data to be processed is compressed to a second hash value with a smaller length by the above method, reducing the resource consumption of data storage, and the method can rewrite the original data into the original field after conversion, that is, it is ensured that the business system module does not need to be modified, and it can also ensure that it adapts to national safety standards and regulatory requirements.

[0059] The following will be combined with specific embodiments to Figure 2 The specific implementation methods of each step in the embodiment shown are described in detail:

[0060] In step 201, a first data length of the data to be processed is obtained, and the data to be processed is encrypted using a preset encryption algorithm to obtain a first hash value for the data to be processed.

[0061] Among them, the data to be processed is the privacy data in the business system. The data to be processed in this application especially refers to data with a limited value range, such as user name, bank card number, ID number, mobile phone number, driver's license, user account, password and other data.

[0062] In an optional embodiment of the present disclosure, the data to be processed is a single data to be stored, or a superposition of multiple data to be stored.

[0063] Exemplarily, the data to be processed may be a single data in the private data, or a combination of multiple data. For example, the data to be processed may be an ID card number, a mobile phone number, or a user name, or the data to be processed may be a combination of an ID card number, a mobile phone number, and a user name.

[0064] For example, after obtaining the private data to be processed, the first data length of the data to be processed can be determined. Taking a mobile phone number as an example, the corresponding data length is 11 digits; taking an ID card number as an example, the ID card number is currently 18 digits. After that, the data to be processed can be encrypted using a preset encryption algorithm to obtain a first hash value for the data to be processed.

[0065] In an optional embodiment of the present disclosure, the preset encryption algorithm in step 201 includes one or more of the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm.

[0066] Among them, the SM3 algorithm and the SM2 algorithm are national commercial cryptographic algorithms. The SM2 algorithm is a public key cryptographic algorithm standard based on elliptic curve cryptography issued by the China National Cryptography Administration. Its secret key length is 256 bits and includes digital signatures, key exchange and public key encryption. The SM2 algorithm is often used to replace the foreign RSA algorithm. Compared with RSA, the SM2 algorithm uses a smaller key length at the same security strength and has a faster calculation speed.

[0067] The SM3 algorithm is a cryptographic hash algorithm released by the China National Cryptography Administration. A cryptographic hash algorithm can also be called a hash function, which is an algorithm that converts input data of any length into output data of fixed length (hash value or hash value) through a specific algorithm. The hash value has a fixed length and looks random. Even a slight change in the input data will produce a huge difference in the output hash value. This makes the hash algorithm play an important role in ensuring data integrity and security.

[0068] The MD5 algorithm, SHA-256 algorithm, and SHA-1024 algorithm are currently commonly used hash functions, as well as the CityHash algorithm and HighwayHash algorithm, but they are all foreign hash algorithms.

[0069] It should be explained that the above encryption algorithm cannot be restored to plain text during the encryption process, which is an irreversible encryption process, which improves the security of encrypted transmission of private data. And the above encryption algorithms can all encrypt the private data to be processed, thereby obtaining the first hash value for the data to be processed.

[0070] However, it is preferred to use the SM3 algorithm. From the perspective of national security, the SM algorithm is issued by the National Cryptography Administration, is autonomous and controllable, and all domestic cryptographic machines can support the SM3 algorithm, so there is no need to update the equipment, and security is more guaranteed; from the perspective of implementation, the SM3 algorithm is simpler and faster, and requires fewer computing resources. The SM2 algorithm is relatively complex, and requires central processing unit (CPU) resources and slow encryption speed. The MD5 algorithm and SHA-256 algorithm have been cracked, the algorithm security is relatively low, and they are vulnerable to rainbow attacks; the SHA-1024 algorithm, CityHash algorithm, and HighwayHash algorithm are foreign algorithms, which cannot be guaranteed from the perspective of national security, and the algorithm implementation cannot be autonomous and controllable.

[0071] It should be understood that in addition to the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm, other encryption algorithms may also be used, such as the RSA algorithm. The specific encryption algorithms can be determined according to actual needs. The preset encryption algorithms listed in the above embodiment are not limitations to them and are not enumerated here.

[0072] Through this embodiment, the privacy data to be processed can be encrypted using a preset encryption algorithm, and the data to be processed can be converted into a hash value, which can improve the security of the privacy data.

[0073] In step 202, the first hash value is mapped to a target value based on the Fibonacci hash algorithm; wherein different target values ​​correspond to different data to be processed.

[0074] Among them, the Fibonacci Hash algorithm is a hash algorithm based on the Fibonacci sequence. Its basic idea is to use the Fibonacci sequence to provide a hash space to allocate the slots of the hash table in the hash space. When multiple keys are mapped to the same slot, they can be reallocated through the characteristics of the Fibonacci sequence to ensure that each key can be uniquely mapped to a slot, thereby reducing hash conflicts and improving search efficiency.

[0075] Exemplarily, the encrypted first hash value can be mapped to a unique hash table slot through the Fibonacci hash algorithm to obtain a unique corresponding target value.

[0076] Figure 3 A flowchart of a method for mapping a first hash value to a target value based on the Fibonacci hash algorithm in this exemplary embodiment is schematically shown. Figure 3In an optional embodiment of the present disclosure, the above step 202 maps the first hash value to the target value based on the Fibonacci hash algorithm, including the following steps 301-303:

[0077] Step 301: Obtain the total value of the data to be processed.

[0078] The total value of the data to be processed is usually the estimated maximum total value to ensure the uniqueness of the target value of the subsequent mapping.

[0079] Step 302: Determine the space size of the digital hash space corresponding to the Fibonacci hash algorithm as the first space size according to the total value of the quantity; wherein the number of space slots corresponding to the first space size is set in the digital hash space, and the label values ​​corresponding to the space slots are different.

[0080] Step 303: Map the first hash value to a target label value in the digital hash space, and determine the target label value as the target numerical value.

[0081] Exemplarily, the larger the space of the digital hash space is, the more numerical values ​​of the space slots are set; conversely, the smaller the space of the digital hash space is, the fewer numerical values ​​of the space slots are set. In the digital hash space, the set space slots are numbered so that each space slot corresponds to a unique label value. In this regard, when mapping the first hash value to the digital hash space, the target label value of the assigned target slot is determined to be the target numerical value mapped to the first hash value.

[0082] This not only ensures that each data to be processed is mapped to a unique value, but also ensures that the data length of the target value is smaller than the data length of the original data. Taking a mobile phone number as an example, the original data length is 11 digits, which is mapped to 0~2 ^64 When a target value is found in the digital hash space, its longest data length is 10 bytes, which is smaller than the data length of the original data.

[0083] In the above embodiment, the total value of the quantity of the data to be processed can be determined based on the data type or data attribute of the data to be processed. For example, taking the ID number as an example, assuming that the total population of a country A does not exceed 2 billion, and the data attribute of the ID number is: one person corresponds to a unique ID number, then based on the total value of the quantity of the data to be processed being the ID number does not exceed 2 ^32 .

[0084] For example, if the data to be processed is a mobile phone number or a bank card number, the corresponding data attribute is: one person corresponds to one or more, and the total number that can be determined is usually greater than 2. ^32 , which can be set to 2 ^64 .

[0085] Exemplarily, after determining the size of the hash space based on the Fibonacci hash algorithm and the total value of the data to be processed, the first hash value can be mapped to a target value in the hash space to represent the first hash value of the data to be processed by a unique target value.

[0086] In this embodiment, a digital hash space of finite size is created through Fibonacci, and the first hash values ​​corresponding to a large amount of data to be processed are randomly mapped to different spatial positions in the hash space, so that a large amount of data to be processed will not be concentrated in the same spatial area, ensuring that the values ​​of each data to be processed are unique and uniform and not clustered, thereby reducing the possibility of hash value conflicts.

[0087] For example Figure 4 The Fibonacci hashing algorithm evaluation diagram shown is based on Figure 4 It can be seen that the slashed areas in the figure are target values ​​scattered in different areas to ensure that the values ​​are uniform and not clustered. If the slashed areas are clustered in the same area, it will be difficult to ensure the uniqueness of the target values ​​mapped to the digital hash space for each data to be processed.

[0088] On the basis of the above embodiments, since the total value of the quantity of the data to be processed is usually uncertain, it is very easy for the estimated total value to differ greatly from the actual total value due to specific factors. For example, the estimated total value is much larger than the actual total value. In order to further reduce the character length of the target value and save computing resources, the size of the digital hash space can be adjusted. Alternatively, the estimated total value is much smaller than the actual total value, and it is difficult to ensure that different target values ​​corresponding to different data to be processed are different, that is, it is difficult to ensure the uniqueness of the values ​​mapped to different data to be processed.

[0089] Based on the above technical problems, the embodiment of the present disclosure can provide Fibonacci hash parameters to the outside through the Fibonacci hash algorithm so that the user can manually adjust the Fibonacci hash parameters. In an optional embodiment of the present disclosure, in response to the adjustment operation of the Fibonacci hash parameters, a target parameter value is determined; according to the target parameter value, the space size of the digital hash space is adjusted from the first space size to the second space size.

[0090] Among them, the Fibonacci hash parameter is a key parameter for determining the size of the digital hash space. By adjusting the Fibonacci hash parameter, the size of the digital hash space can be adjusted.

[0091] For example, assuming that for the teacher system, the number of teachers in a school is usually 100, and it is expected to be no more than 10,000, so it is mapped in 2 ^14If the number of teachers in a school reaches 20,000 due to business needs, such as school mergers, the Fibonacci hash parameters can be adjusted to expand the space size, such as mapping in 2 ^15 A target value within the space size.

[0092] In step 203, the target numerical value is converted into a second Hash value of a second data length to store the second Hash value in a database, wherein the second data length is smaller than the first data length.

[0093] Exemplarily, the target value may be converted into a second hash value having a smaller data length, and the second hash value may be stored in a database, thereby achieving the technical effect of compressing data storage space while protecting privacy data.

[0094] When executing step 203, in an optional embodiment of the present disclosure, the target value is encoded based on a variable-length digital encoding method to obtain a second hash value of a second data length.

[0095] Among them, variable-length digital coding is a data encoding and data compression technology, also known as variable length coding (VLC), which is used to convert fixed-length data representation into variable-length representation, thereby achieving the technical effect of reducing storage space and improving transmission efficiency.

[0096] Exemplarily, by encoding the target value using a variable-length digital encoding method, the target value can be converted into characters with a smaller data length, thereby reducing the data length of the encrypted data, and further making the data length of the second hash value stored in the database smaller than the original data length of the data to be processed.

[0097] In addition to the above-described embodiments, other encoding methods can also be used to encode the target value, so as to obtain a second hash value with a smaller data length. For example, GVI (general variable-length integer), Elias Gamma encoding (EliasGamma positive integer variable-length encoding), Punycode encoding, etc. can also be used. The core idea of ​​these encoding methods is to shorten the positive integer data by encoding. The disclosed embodiment does not make any special restrictions on the encoding method used, as long as the effect of shortening the data length can be achieved. However, the variable-length digital encoding method used in this embodiment is relatively simple to implement and the encoding effect is predictable.

[0098] In order to facilitate technical personnel in this field to understand the technical effect of protecting privacy data while reducing the length of data stored in a database through the privacy data processing method provided in the embodiment of the present application, the following will be explained with an example in which the data to be processed is the superposition of multiple data to be stored.

[0099] In an optional embodiment of the present disclosure, for each data to be stored in the data to be processed, the first target numerical value corresponding to each data to be stored is converted into multiple hash values ​​of the first target data length, and the first target data length corresponding to each data to be stored is superimposed to obtain a second hash value of the second data length corresponding to the data to be processed; the first target numerical value is a set of multiple target numerical values ​​obtained by mapping multiple data to be stored based on the Fibonacci hash algorithm.

[0100] In this embodiment, the second Hash values ​​are calculated for each single data to be stored, and the final second data length of the data to be processed is obtained based on the superposition of the data lengths of the Hash values.

[0101] Alternatively, for the data to be processed, the second target numerical value corresponding to each data to be stored is converted into a hash value of the second target data length to obtain a second hash value of the second data length.

[0102] In this embodiment, the plurality of data to be stored in the data to be processed are taken as a whole to determine the second target value and the second data length of the second hash value without superposition of the data lengths.

[0103] Assume that the data to be stored are ID card, mobile phone number, and user name. The size of the digital hash space mapped is 2 ^64 When storing the corresponding data of the original ID card (18 digits) + mobile phone number (11 digits) + user name, the rules for user name, ID card and mobile phone number are set. For example, the name can be set to 15 Chinese characters, corresponding to 30 characters; the mobile phone number is 11 characters, and the ID card number is 18 characters, totaling 59 characters.

[0104] The above ID card, user name, and mobile phone number are processed separately and mapped to 2 ^32 When the digital hash space is used, the second data length of the second hash value finally generated is 6+6+6=18 characters, and the storage resource consumption is reduced to 31% of the original data resource consumption. ^64 In the digital hash space of 12 bits, the second data length of the second hash value finally generated is 12+12+12=36 characters, and the storage resource consumption is reduced to 61% of the original data resource consumption.

[0105] If the ID card, user name, and mobile phone number are taken as a whole to generate a mapping value to a 2^64 space, the second data length of the generated second hash value only needs 12 characters, and the storage resource consumption is reduced to 20% of the original data resource consumption.

[0106] It should be understood that in the actual application of business systems, a single ID number cannot identify the uniqueness of the business. Usually, the user identity is identified through the superposition of multiple private data, such as ID card + name or ID card + name + mobile phone number.

[0107] After executing step 203, the second Hash value is a binary number recognizable by a computer. To facilitate display and storage, in an optional embodiment of the present disclosure, the second Hash value is converted into recognizable characters by a preset encoding method.

[0108] The preset encoding method may be any one of Base64 encoding, HEX encoding, and UTF-8 encoding. The binary second hash value may be converted into recognizable characters through the encoding method.

[0109] For example, the second hash value is similar to the display of “\x47\x56\x56\x56\x56\x56\x56\x56\x56\x56”, which cannot be displayed to the user and cannot be transmitted on the network. It can be converted into a base64 value through Base64 encoding, such as “YwiJxC5d613AD” for storage, processing and transmission.

[0110] It should be explained that in an actual production environment, the method provided in the above embodiment can be integrated in the business system as an external interface for information exchange with a third-party system. For example, a 16-digit fixed-length OpenID is generated from a user ID card to implement interface calls.

[0111] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0112] To implement the above privacy data processing method, please refer to Figure 5 An embodiment of the present application provides a privacy data processing device, and the privacy data processing device 500 may include: a data encryption module 501, a value mapping module 502 and a conversion module 503.

[0113] Among them, the data encryption module 501 is used to obtain a first data length of the data to be processed, encrypt the data to be processed by a preset encryption algorithm, and obtain a first hash value for the data to be processed; the numerical mapping module 502 is used to map the first hash value to a target numerical value based on the Fibonacci hash algorithm; wherein different target numerical values ​​corresponding to different data to be processed are different; the conversion module 503 is used to convert the target numerical value into a second hash value of a second data length to store the second hash value in the database, and the second data length is less than the first data length.

[0114] In an optional embodiment of the present application, the preset encryption algorithm includes one or more of the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm.

[0115] In an optional embodiment of the present application, the numerical mapping module 502 is specifically used to obtain the total value of the quantity of data to be processed; according to the total value, determine that the space size of the digital hash space corresponding to the Fibonacci hash algorithm is the first space size; wherein, the number of space slots corresponding to the first space size is set in the digital hash space, and the label values ​​corresponding to each space slot are different; map the first hash value to the target label value in the digital hash space, and determine the target label value as the target numerical value.

[0116] In an optional embodiment of the present application, the device may also include a determination module and an adjustment module, the determination module being used to determine a target parameter value in response to an adjustment operation on a Fibonacci hash parameter; and the adjustment module being used to adjust the space size of the digital hash space from a first space size to a second space size according to the target parameter value.

[0117] In an optional embodiment of the present application, the conversion module 503 is specifically configured to encode the target value based on a variable-length digital encoding method to obtain a second Hash value of a second data length.

[0118] In an optional embodiment of the present application, the data to be processed includes multiple data to be stored, and the conversion module 503 is specifically used to convert the first target value corresponding to each data to be stored in the data to be processed into multiple hash values ​​of the first target data length, and superimpose the first target data length corresponding to each data to be stored to obtain a second hash value of the second data length corresponding to the data to be processed; the first target value is a set of multiple target values ​​obtained by mapping the multiple data to be stored based on the Fibonacci hash algorithm;

[0119] Alternatively, the conversion module 503 is specifically configured to convert the second target numerical value corresponding to each data to be stored into a hash value of the second target data length for the data to be processed, so as to obtain a second hash value of the second data length.

[0120] In an optional embodiment of the present application, the conversion module 503 can also be used to convert the second hash value into recognizable characters through a preset encoding method; wherein the preset encoding method includes one of Base64 encoding, HEX encoding, and UTF-8 encoding.

[0121] For the specific definition of the above-mentioned privacy data processing device, please refer to the definition of the privacy data processing method above, which will not be repeated here. Each module in the above-mentioned privacy data processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0122] In one embodiment, a computer device is provided, the internal structure diagram of which can be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for processing privacy data as described above is implemented. It includes: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, any step in the method for processing privacy data as described above is implemented.

[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above method for processing privacy data can be implemented.

[0124] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0125] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0126] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0127] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0128] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0129] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for processing private data, characterized in that: include: Obtaining a first data length of the data to be processed, encrypting the data to be processed using a preset encryption algorithm, and obtaining a first hash value for the data to be processed; Mapping the first hash value to a target value based on the Fibonacci hash algorithm; wherein different target values ​​correspond to different data to be processed; The target numerical value is converted into a second hash value of a second data length to store the second hash value in a database, where the second data length is smaller than the first data length.

2. The method according to claim 1, characterized in that: The preset encryption algorithm includes one or more of the national encryption SM3 algorithm, the national encryption SM2 algorithm, the MD5 algorithm, the SHA-256 algorithm, the SHA-1024 algorithm, the CityHash algorithm, and the HighwayHash algorithm.

3. The method according to claim 1, characterized in that Mapping the first hash value to a target value based on the Fibonacci hash algorithm includes: Obtaining the total value of the data to be processed; According to the total value of the quantity, determining that the space size of the digital hash space corresponding to the Fibonacci hash algorithm is a first space size; wherein the number of space slots corresponding to the first space size is set in the digital hash space, and the label values ​​corresponding to the space slots are different; The first hash value is mapped to a target label value in the digital hash space, and the target label value is determined as the target numerical value.

4. The method according to claim 3, characterized in that The method further comprises: In response to an adjustment operation on a Fibonacci hash parameter, determining a target parameter value; According to the target parameter value, the space size of the digital hash space is adjusted from the first space size to a second space size.

5. The method according to claim 1, characterized in that The step of converting the target value into a second Hash value of a second data length includes: The target value is encoded based on a variable-length digital encoding method to obtain a second Hash value of the second data length.

6. The method according to claim 1, characterized in that The data to be processed includes a plurality of data to be stored; The step of converting the target value into a second hash value of a second data length includes: For each data to be stored in the data to be processed, convert the first target value corresponding to each data to be stored into multiple hash values ​​of the first target data length, and superimpose the first target data lengths corresponding to each data to be stored to obtain a second hash value of the second data length corresponding to the data to be processed; the first target value is a set of multiple target values ​​obtained by mapping the multiple data to be stored based on the Fibonacci hash algorithm; Alternatively, for the data to be processed, the second target numerical value corresponding to each data to be stored is converted into a hash value of the second target data length to obtain a second hash value of the second data length.

7. The method according to claim 1, 5 or 6, characterized in that: After converting the target value into a second Hash value of a second data length, the method further includes: The second hash value is converted into recognizable characters through a preset encoding method; wherein the preset encoding method includes one of Base64 encoding, HEX encoding, and UTF-8 encoding.

8. A device for processing private data, characterized in that: include: A data encryption module, used to obtain a first data length of the data to be processed, encrypt the data to be processed by a preset encryption algorithm, and obtain a first hash value for the data to be processed; A numerical mapping module, used for mapping the first hash value to a target numerical value based on a Fibonacci hash algorithm; wherein different target numerical values ​​correspond to different data to be processed; A conversion module is used to convert the target numerical value into a second Hash value of a second data length to store the second Hash value in a database, wherein the second data length is smaller than the first data length.

9. A computer device comprising: The method comprises a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the method for processing privacy data according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for processing privacy data according to any one of claims 1 to 7 are implemented.