Data Processing Method, Data Processing Device, Electronic Device and Medium

By iterating the hash value of the key generation factor through dynamic loop iteration, complex keys are generated, which solves the problem that keys are easily cracked in the prior art and improves the security and privacy protection of data encryption.

CN112765642BActive Publication Date: 2025-08-05TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110157310.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-04
Publication Date
2025-08-05
Estimated Expiration
2041-02-04

AI Technical Summary

Technical Problem

In the existing data encryption technology, the key generation process is simple, easy to be cracked, and has low security, resulting in high risk of data leakage.

Method used

Iteratively calculates the hash value of the key generation factor until a target hash value that is not less than the preset value is obtained as the key. The hash value is updated using the identification information, random numbers and salt values in the key generation factor to generate complex keys to enhance security.

Benefits of technology

Improve the security of data encryption, avoid the problem of static key leakage, and enhance the privacy and security of data and protection strength.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112765642B_ABST
    Figure CN112765642B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a data processing method, a data processing device, an electronic device, and a computer-readable medium; relating to the field of network security technology. The data processing method includes: obtaining a key generation factor corresponding to the data to be processed; calculating a hash value of the key generation factor, and when the hash value is less than a preset value, updating the hash value to the key generation factor, and returning to calculate the hash value of the key generation factor, and when the hash value is less than the preset value, continuing to execute the step of updating the hash value to the key generation factor until the current hash value is not less than the preset value, taking the current hash value as the target hash value; using the target hash value as a key to encrypt or decrypt the data to be processed. The technical solution of this embodiment can generate a key with relatively high security through a dynamic cyclic iteration method when storing a file, improve the protection intensity of the storage, and thus ensure privacy security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of network security technology. Specifically, it relates to a data processing method, a data processing device, an electronic device, and a computer-readable medium. Background Art

[0002] In the era of rapid development of information technology, data is transmitted through the network quickly and widely. Once important data is leaked, it will bring serious consequences. Therefore, data encryption has received increasing attention.

[0003] Data encryption technology is a secrecy technology in which both communication parties perform special transformations on information according to agreed rules. The process of transforming the original plaintext data or file into ciphertext according to specific rules is encryption; the process of restoring the ciphertext to the original plaintext is called decryption. The ciphertext after encryption can only show the original content after inputting the corresponding key. Encryption and decryption using the same key is symmetric encryption, and using different keys is asymmetric encryption. Common encryption technologies all use built-in keys for encryption and decryption, or use a Key Derivation Function (KDF) to generate keys for encryption and decryption. The key generation process is relatively simple, easy to be cracked, and has low security.

[0004] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure. Therefore, it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention

[0005] The purpose of the embodiments of the present disclosure is to provide a data processing method, a data processing device, an electronic device, and a computer-readable medium, which can iterate the hash value of a key generation factor and finally obtain a hash value that meets the requirements as the key. Without using a static key, the problem of key leakage can be avoided, and the security of data can be enhanced.

[0006] Other features and advantages of the present disclosure will become apparent through the following detailed description, or be learned in part through the practice of the present disclosure.

[0007] According to the first aspect of the embodiments of the present disclosure, a data processing method is provided, including: obtaining a key generation factor corresponding to the data to be processed; calculating a hash value of the key generation factor, and when the hash value is less than a preset value, updating the hash value to the key generation factor, and returning to calculate the hash value of the key generation factor, and continuing to execute the step of updating the hash value to the key generation factor when the hash value is less than the preset value until the current hash value is not less than the preset value, and taking the current hash value as the target hash value; using the target hash value as a key to encrypt or decrypt the data to be processed.

[0008] In an exemplary embodiment of the present disclosure, the calculating a hash value of the key generation factor, and when the hash value is less than a preset value, updating the hash value to the key generation factor, and returning to calculate the hash value of the key generation factor, and continuing to execute the step of updating the hash value to the key generation factor when the hash value is less than the preset value until the current hash value is not less than the preset value, and taking the current hash value as the target hash value includes: obtaining a loop count, the initial value of the loop count being zero; calculating a hash value of the key generation factor; when the hash value is less than the preset value and the loop count is less than a first threshold, updating the hash value to the key generation factor and incrementing the loop count by 1; turning to the step of calculating the hash value of the key generation factor; when the hash value is not less than the preset value or the loop count is not less than the first threshold, taking the hash value as the target hash value.

[0009] In an exemplary embodiment of the present disclosure, the method further includes: when the hash value is not less than the preset value and the loop count is less than a second threshold, updating the hash value to the key generation factor and incrementing the loop count by 1; turning to the step of calculating the hash value of the key generation factor, where the second threshold is less than the first threshold.

[0010] In an exemplary embodiment of the present disclosure, the method further includes: generating a parameter acquisition page and displaying the parameter acquisition page; obtaining the first threshold and the second threshold through the parameter acquisition page.

[0011] In an exemplary embodiment of the present disclosure, obtaining a key generation factor corresponding to the data to be processed includes; obtaining identification information, a random number, and a salt value corresponding to the data to be processed as the key generation factor.

[0012] In an exemplary embodiment of the present disclosure, the method further includes: sending a network request to a server, where the network request includes identification information corresponding to the data to be processed; receiving a salt value corresponding to the identification information sent by the server.

[0013] In an exemplary embodiment of the present disclosure, after calculating a hash value not less than the preset value as the target hash value, it further includes: storing the target hash value as a key to decrypt the data to be processed by using the stored key and the salt value.

[0014] According to a second aspect of the embodiments of the present disclosure, there is provided a data processing apparatus, which may include a data acquisition module, a key determination module, and a data encryption processing module.

[0015] The data acquisition module is configured to acquire a key generation factor corresponding to the data to be processed.

[0016] The key determination module is configured to calculate a hash value of the key generation factor. When the hash value is less than the preset value, update the hash value to the key generation factor, and return to the step of calculating the hash value of the key generation factor. When the hash value is less than the preset value, continue to execute the step of updating the hash value to the key generation factor until the current hash value is not less than the preset value, and use the current hash value as the target hash value.

[0017] The data encryption processing module is configured to use the target hash value as a key to encrypt or decrypt the data to be processed.

[0018] In an exemplary embodiment of the present disclosure, the key determination module may include a loop count acquisition module, a hash value calculation module, a loop module, and an exit loop module.

[0019] The loop count acquisition module is configured to acquire a loop count, and the initial value of the loop count is zero.

[0020] The hash value calculation module is configured to calculate a hash value of the key generation factor.

[0021] The loop module is configured to, when the hash value is less than the preset value and the loop count is less than a first threshold, update the hash value to the key generation factor, increment the loop count by 1; and transfer to the step of calculating the hash value of the key generation factor.

[0022] The exit loop module is configured to, when the hash value is not less than the preset value or the loop count is not less than the first threshold, use the hash value as the target hash value.

[0023] In an exemplary embodiment of the present disclosure, the device further includes a loop count determination module, configured to update the hash value to the key generation factor and increment the loop count by 1 when the hash value is not less than the preset value and the loop count is less than a second threshold; and then proceed to the step of calculating the hash value of the key generation factor, where the second threshold is less than the first threshold.

[0024] In an exemplary embodiment of the present disclosure, the device further includes a page generation module and a threshold acquisition module.

[0025] The page generation module is configured to generate a parameter acquisition page and display the parameter acquisition page.

[0026] The threshold acquisition module is configured to acquire the first threshold and the second threshold through the parameter acquisition page.

[0027] In an exemplary embodiment of the present disclosure, the data acquisition module may be configured to: acquire the identification information corresponding to the data to be processed, a random number, and the salt value corresponding to the data to be processed as the key generation factor.

[0028] In an exemplary embodiment of the present disclosure, the device further includes a network request module and a salt value acquisition module.

[0029] The network request module is configured to send a network request to a server, where the network request includes the identification information corresponding to the data to be processed.

[0030] The salt value acquisition module is configured to receive the salt value corresponding to the identification information sent by the server.

[0031] In an exemplary embodiment of the present disclosure, the device further includes a key storage module, configured to store the target hash value as a key to decrypt the data to be processed by using the stored key and the salt value.

[0032] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including: one or more processors; a storage device configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the data processing method as described in the first aspect of the foregoing embodiment.

[0033] According to a fourth aspect of an embodiment of the present disclosure, there is provided a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the data processing method as described in the first aspect of the foregoing embodiment is implemented.

[0034] In the data processing method, data processing device, electronic device, and computer-readable medium provided by the embodiments of the present disclosure, a key generation factor corresponding to the data to be processed is used to dynamically calculate the corresponding hash value. There is no need to store static keys, which can save storage resources. At the same time, it can also avoid security problems caused by key leakage. Moreover, the hash value is repeatedly iterated to finally obtain a target hash value that meets the requirements as the key, with higher encryption strength, which can enhance data security and privacy security.

[0035] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:

[0037] Figure 1 Schematically shows an exemplary system architecture diagram of a data processing method or data processing device applied to the embodiments of the present disclosure;

[0038] Figure 2 Schematically shows a flowchart of a data processing method according to an embodiment of the present disclosure;

[0039] Figure 3 Schematically shows a flowchart of steps for calculating a target hash value according to an embodiment of the present disclosure;

[0040] Figure 4 Schematically shows a flowchart of steps for calculating a target hash value according to another embodiment of the present disclosure;

[0041] Figure 5 Schematically shows a flowchart of steps for calculating a target hash value according to an embodiment of the present disclosure;

[0042] Figure 6 Schematically shows an application scenario diagram of the data processing method according to the embodiments of the present disclosure;

[0043] Figure 7 Schematically shows a block diagram of a data processing device according to an embodiment of the present disclosure;

[0044] Figure 8 Shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.

[0046] In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be employed. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present disclosure.

[0047] The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0048] The flowcharts shown in the drawings are merely illustrative and do not necessarily include all the contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.

[0049] In this specification, the terms "a", "one", "the", "said", and "at least one" are used to indicate the existence of one or more elements / components / etc.; the terms "comprising", "including", and "having" are used to mean an open inclusion, and mean that there may be additional elements / components / etc. in addition to the listed elements / components / etc.; the terms "first", "second", "third", etc. are only used as labels and are not a limitation on the quantity of their objects.

[0050] The example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0051] Figure 1 A schematic diagram of a system architecture of an exemplary application environment to which a data processing method or a data processing device applicable to the embodiments of the present disclosure can be applied is shown.

[0052] As Figure 1As shown, the system architecture 100 may include one or more of the terminal devices 101, 102, 103, the network 104, and the server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0053] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Among them, the terminal devices 101, 102, 103 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, wearable devices, virtual reality devices, smart homes, etc.

[0054] The server 105 can be a server that provides various services, such as a background management server that supports the devices operated by users using the terminal devices 101, 102, 103. The background management server can analyze and process data such as received requests, and feedback the processing results to the terminal devices. It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in

[0055] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. For example, the server 105 can be a server cluster composed of multiple servers, etc.

[0056] Cloud technology refers to the general term of network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, be used as needed, and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the background system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system backing, which can only be achieved through cloud computing.

[0057] Cloud storage is a new concept extended and developed from the cloud computing concept. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that combines a large number of different types of storage devices (storage devices are also called storage nodes) in the network through cluster applications, grid technology, and distributed storage file systems, etc., and works together through application software or application interfaces to jointly provide data storage and business access functions externally.

[0058] The server in this technical solution can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be 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, CDN, as well as big data and artificial intelligence platforms.

[0059] The application scenario of the data processing method provided by this technical solution can be: when the cloud storage system needs to store data, the data to be stored is encrypted through the data processing method provided by this technical solution; when the cloud storage system receives a data reading instruction from a user, the data to be read is decrypted through the data processing method provided by this technical solution, so as to obtain the actual content of the data and return it to the user.

[0060] Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity (anti-counterfeiting) of the information and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0061] The underlying blockchain platform may include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for managing the identity information of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and maintaining the correspondence between the real identity of users and blockchain addresses (permission management). And under authorization, it supervises and audits the transaction situations of certain real identities, and provides rule configuration for risk control (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and after consensus on valid requests, records them in storage. For a new business request, the basic service first performs interface adaptation parsing and authentication processing (interface adaptation), then encrypts the business information through a consensus algorithm (consensus management), and after encryption, transmits it to the shared ledger completely and consistently (network communication), and records and stores it; the smart contract module is responsible for the registration and issuance of contracts, contract triggering, and contract execution. Developers can define contract logic through a certain programming language, publish it to the blockchain (contract registration), and according to the logic of contract terms, call keys or other events to trigger execution, complete the contract logic, and at the same time provide functions for contract upgrade and cancellation; the operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation during the product release process, and visual output of the real-time status during product operation, such as: alarming, monitoring network conditions, monitoring the health status of node devices, etc.

[0062] The platform product service layer provides the basic capabilities and implementation frameworks of typical applications. Developers can build on these basic capabilities and overlay the characteristics of the business to complete the blockchain implementation of business logic. The application service layer provides application services based on the blockchain solution for business participants to use.

[0063] The terminal device in this technical solution can be a blockchain node device, and multiple blockchain node devices can form a blockchain storage system through network communication.

[0064] The application scenario of the data processing method provided by this technical solution can also be: when a blockchain node device receives a business request, the business information is encrypted through the data processing method provided by this technical solution, and after encryption, it is transmitted to the shared ledger and stored in the blockchain as a new data block.

[0065] The following elaborates on the data processing method provided by this exemplary embodiment in detail:

[0066] As Figure 2 shown, the data processing method provided by the embodiments of the present disclosure may include step S21, step S22, and step S23.

[0067] In step S21, obtain the key generation factor corresponding to the data to be processed.

[0068] A key generation factor is data used to generate a key. To maximize the security of encrypted data, the key generation factor can include various types of data. Exemplarily, the key generation factor can include identification information corresponding to the data to be processed. This identification information can be composed of a terminal device ID, a user ID, and a service ID. For example, when encrypting the data to be processed on a mobile terminal device, the terminal device ID can be used to identify the mobile terminal device; the user ID can identify the account logged in to the mobile terminal device; the service ID can be used to identify the APP in the system. Moreover, the key generation factors for the data to be processed on different terminal devices are different. Even if a certain key is compromised, the affected scope is limited to specific users on specific devices, thus ensuring the security of encrypted data.

[0069] In an exemplary embodiment, in addition to including the identification information corresponding to the data to be recognized, the key generation factor can also include a random number corresponding to the data to be recognized and a salt value to increase the key security. Specifically, the terminal device can generate a random number for each data to be processed that needs to be encrypted, and associate and store the random number with the identification information corresponding to the data to be processed, thereby increasing the randomness of the generated secret key and enhancing the difficulty of key cracking. The salt value can refer to a random value generated for each user, and there are no duplicate values among users. When encrypting and decrypting the data to be processed, the salt value can be concatenated with the data to be encrypted, and then the concatenated value is encrypted and decrypted.

[0070] The salt value generated for each user can be stored using the network, thus avoiding the problem that it is easily compromised when stored locally. When encrypting the data to be processed, a network request can be sent to the server. This network request can include the identification information corresponding to the data to be processed. For example, this network request can be an HTTP request, and the identification information corresponding to the data to be processed can be included in the request header or entity data of this request. When the terminal device sends this network request to the server, the server can generate a salt value for this terminal device and store the salt value and the received identification information, such as storing it in the form of key-value, etc., so that the corresponding salt value can be indexed through the identification information. At the same time, the server can return the generated salt value to the terminal device in response to this network request. When the terminal device needs to encrypt or decrypt again next time, it can send a request to the server again. When the server receives the request, it can query the stored salt value according to the identification information and thus respond to the terminal device. The terminal device can receive the salt value sent by the server, thereby using the salt value as a key generation factor to generate a key and using the salt value for encryption or decryption during the encryption and decryption processes.

[0071] In other embodiments of the present disclosure, the key generation factor may further include other types of data, such as the data type of the data to be recognized, the storage time, and for example, specific values, etc., which also fall within the protection scope of the present disclosure.

[0072] In step S22, calculate the hash value of the key generation factor. When the hash value is less than the preset value, update the hash value to the key generation factor, and return to calculate the hash value of the key generation factor. When the hash value is less than the preset value, continue to execute the step of updating the hash value to the key generation factor until the current hash value is not less than the preset value. Then, use the current hash value as the target hash value.

[0073] In an exemplary embodiment, the hash value of the key generation factor can be calculated through a key derivation function (KDF). For example, use the identification information, random number, and salt value corresponding to the data to be processed as input parameters, and call the KDF to obtain the corresponding output hash value. In addition, other algorithms can also be used to calculate the hash value, such as SHA-256, MD5, etc. This embodiment is not limited thereto.

[0074] Among them, the preset value can be set according to the actual situation, such as 5, 6, 7, etc., or it can be other numbers, such as 8, 10, etc. This embodiment does not make special limitations on this.

[0075] After calculating the corresponding hash value using the key generation factor, it is determined whether the calculated hash value is less than a preset value. If the obtained hash value is less than the preset value, the hash value is added to the key generation factor and the hash value is recalculated. It should be understood that in this embodiment, the hash value is calculated using the key generation factor, and the process of updating the calculated hash value to the key generation factor when the hash value is less than the preset value is looped. Each loop updates one hash value and the key generation factor. When the hash value of the updated key generation factor is not less than the preset value, the loop ends, and the hash value not less than the preset value is used as the target hash value. For example, assume that the key generation factor A=(device ID, user ID, service ID, random number random, salt value salt), and the hash value of the key generation factor A is calculated as x1. When x1 is less than the preset value, x1 is updated to the key generation factor, and the updated key generation factor A is (device ID, user ID, service ID, random number random, salt value salt, x1). Then, the hash value x2 is recalculated using the updated key generation factor. When x2 is less than the preset value, x2 is updated to the key generation factor, and the updated key generation factor is (device ID, user ID, service ID, random number random, salt value salt, x1, x2). Iterate in turn until the hash value of the key generation factor is not less than the preset value and the loop ends. The finally output hash value is the target hash value.

[0076] The specific flowchart of the loop is as Figure 3 shown. Refer to Figure 3 , in step S301, obtain the key generation factor of the data to be processed; in step S302, calculate the hash value of the key generation factor, denoted as X; in step S303, determine whether X is less than the preset value N; if X < N, execute step S304, if X >= N, execute step S305; in step S304, update the key generation factor; merge the hash value X into the key generation factor to obtain the updated key generation factor, and then go to step S302 for looping; in step S305, end the loop and use the currently calculated hash value as the target hash value. In this embodiment, each time the key generation factor is updated, the corresponding hash value also changes. For the hash algorithm, the hash values of the same information are the same, and different key generation factors can obtain different hash values. Therefore, the number of loops for different data to be processed is different, and it takes longer for an attacker to guess the key when maliciously reading privacy data, which can greatly enhance privacy security.

[0077] In an exemplary embodiment, the method for determining the target hash value may include the following steps S401 to step S404, as Figure 4 shown.

[0078] In step S401, the number of loops is obtained, and the initial value of the number of loops is zero. The number of loops can be denoted as loop, that is, loop = 0. The number of loops is used to count the loops, and it increments by 1 for each loop. In step S402, the hash value X of the key generation factor is calculated. In step S403, when the calculated hash value X is less than the preset value N and the number of loops loop is less than the first threshold, the hash value is updated to the key generation factor, the number of loops is incremented by 1, and then it goes back to step S402 to recalculate the hash value X. In step S404, when the hash value is not less than the preset value or the number of loops is not less than the first threshold, the loop is exited, and the currently calculated hash value is used as the target hash value. Since the currently calculated hash value is added to the key generation factor for each iteration, the key generation factor becomes more and more complex as the number of iterations increases, and the time cost required to calculate the hash value increases. Therefore, to control the computational complexity, the loop count parameter can be increased, and the number of loops is controlled within a certain period through the first threshold, so as to achieve the purpose of controlling the complexity.

[0079] The more loops there are, the more complex the key generation factor is, and the higher the security of the key. Therefore, considering the key security issue, this embodiment can also increase the second threshold, and the final target hash value is output after the loop reaches a certain degree through the second threshold. As Figure 5 shown, the method can include steps S501 to step S506.

[0080] In step S501, obtain the loop count with an initial value of zero, i.e., loop = 0. In step S502, calculate the hash value X of the key generation factor. In step S503, determine whether the calculated hash value X is less than the preset value N and whether the loop count is less than the first threshold; if the condition that the hash value X is less than the preset value N is satisfied and the condition that the loop count is less than the first threshold is also satisfied, then execute step S505. If the condition that the hash value X is less than the preset value N is not satisfied, i.e., X >= N, or the condition that the loop count is less than the first threshold is not satisfied, then execute step S504. In step S504, determine whether the hash value X is greater than or equal to the preset value N and whether the loop count loop is less than the second threshold. If so, execute step S505 to enter the next round of the loop; if the loop count loop is not less than the second threshold, i.e., loop >= the second threshold, then execute step S506 to exit the loop. Here, the second threshold is less than the first threshold. That is to say, the second threshold can be used as the minimum value of the loop count, and the first threshold can be used as the maximum value of the loop count. The value range of the loop count loop is between the second threshold and the first threshold. When the loop count exceeds this value range, for example, when the loop count is equal to the first threshold, the loop will be exited and the final target hash value will be output. In step S505, update the key generation factor and increment the loop count by 1; the updated key generation factor can be obtained by merging the currently calculated hash value X into the current key generation factor. If the currently calculated hash value X is less than the preset value, then merge the current hash value into the key generation factor to obtain the updated key generation factor. If the currently calculated hash value X is greater than or equal to the preset value N, then the hash value meets the condition. Then, determine whether the loop has been executed for a certain period. If the loop count is not less than the minimum value, i.e., the second threshold, then the loop can be exited, and the currently obtained hash value not less than the preset value N is used as the target hash value.

[0081] In this embodiment, when the loop count is less than the minimum value, the loop can be controlled to continue. The more the loop count, the better the key security, which can ensure the security of the key; while when the loop count is greater than or equal to the maximum value, calculating the hash value requires a relatively large cost. Therefore, controlling the loop count between the minimum value and the maximum value can reduce the computational complexity and computational resources while ensuring the key security, and guarantee the efficiency.

[0082] The maximum and minimum values of the number of cycles can be flexibly determined according to different scenarios. In an exemplary embodiment, a parameter acquisition page may be provided and displayed. The parameter acquisition page may be generated by writing in HyperText Markup Language, such as H5, etc. After displaying the parameter acquisition page to the user, each user sets their own first threshold and second threshold on the page. After the user finishes inputting, the information input by the user into the page can be saved to obtain the first threshold and the second threshold.

[0083] The preset value can be determined according to the first threshold and the second threshold. For example, according to the first threshold and the second threshold determined by the user, a value can be randomly selected from this range as the preset value. For another example, the intermediate value of the first threshold and the second threshold can be used as the preset value, and so on. In addition, the preset value can also be determined by other means, such as pre-determining a specific value, etc. This embodiment is not limited thereto.

[0084] Continue to refer to Figure 2 , in step S23, the target hash value is used as a key to encrypt or decrypt the data to be processed.

[0085] After finally obtaining a target hash value not less than the preset value through the loop, the target hash value can be used as the key for encryption or decryption, so as to encrypt or decrypt the data to be processed. For example, the terminal device can first encrypt the stored data to be processed using the key. When receiving an instruction to read the data to be processed, it obtains the key generation factor corresponding to the data to be processed and executes the Figure 3 shown loop process to calculate the target hash value, obtain the key, and then decrypt the data to be processed using the key. The key in this exemplary embodiment is obtained through loop calculation, and the number of times of each loop may be different. Therefore, the uncertainty of the keys obtained for different data to be processed is greatly increased, improving the security of the keys and being able to improve the protection intensity of the data.

[0086] Exemplarily, each time data needs to be encrypted or decrypted, the identification information, random number, and salt value of the data can be used to calculate the corresponding key for the data, thereby avoiding the problem that the key is easily leaked due to the storage of the key, and enhancing the security of the data. However, calculating the key each time data is read has low efficiency. Therefore, when encrypting the data to be processed for the first time, after obtaining the target hash value, the target hash value can be stored locally as the key, so that when the data to be processed needs to be decrypted, the stored key can be read for decryption, and the stored key can also be used to encrypt the data to be processed multiple times. In addition, multiple encryption methods can be adopted to encrypt the data to be processed. For example, after encrypting with the key, the obtained ciphertext can be encrypted again, or a pre-agreed key can be used. The calculated target hash value and the pre-agreed key are combined to form the final key, and then the data to be processed is encrypted, and so on.

[0087] In an exemplary embodiment, the security of simply encrypting and decrypting the data to be processed using only the key can be further enhanced, that is, using the key and the salt value to encrypt and decrypt the data to be processed. Specifically, when the data to be processed needs to be encrypted, the data to be processed can be concatenated with the salt value. For example, the salt value can be concatenated to the end of the data to be processed, and then the concatenated data is encrypted using the key.

[0088] Figure 6 Schematically shows an application scenario of an embodiment of the present disclosure. As Figure 6As shown, in step S601, the terminal device obtains the device ID, user ID, and service ID. In step S602, the terminal device sends a salt acquisition request to the server. In step S603, after receiving the request, the server generates salt and persists the generated salt. The stored salt can be indexed by the device ID, user ID, and service ID. In step S604, the server returns the salt to the terminal device. In step S605, the terminal device generates a random number random and persists the random number, for example, stores it in the SE (Secure Element) or the private directory of the APP of the terminal device. In step S606, the terminal device generates a key. The key generation factors include random, device ID, user ID, service ID, and the obtained salt value. For example, using the stored random, device ID, user ID, service ID, and the obtained salt value, call the KDF algorithm to calculate the corresponding hash value. If the hash value is less than the preset value, add the hash value to the key generation factors and recalculate the hash value. Iterate repeatedly until a target hash value not less than the preset value is calculated, and use this target hash value as the key. In step S607, the terminal device encrypts the local sensitive data. The local sensitive data is the data to be processed stored on the terminal device, such as the user's account information, payment password, transaction details, etc. The decryption scenario is the same as the above encryption scenario and will not be elaborated here. To ensure that the hash values calculated in each encryption and decryption cycle are the same, the algorithm for calculating the hash value must be consistent. For example, if the KDF algorithm is used to calculate the hash value during the encryption process, the KDF algorithm is also used to calculate the hash value during the decryption process.

[0089] The following describes an embodiment of the data processing device of the present disclosure, which can be used to execute the above data processing method of the present disclosure. Refer to Figure 7 , the data processing device 70 provided in the embodiment of the present disclosure may include: a data acquisition module 71, a key determination module 72, and a data encryption processing module 73.

[0090] Among them, the data acquisition module 71 is used to obtain the key generation factors corresponding to the data to be processed.

[0091] The key determination module 72 is used to calculate the hash value of the key generation factors. When the hash value is less than the preset value, update the hash value to the key generation factors, and return to calculate the hash value of the key generation factors. When the hash value is less than the preset value, continue to execute the step of updating the hash value to the key generation factors until the current hash value is not less than the preset value. Use the current hash value as the target hash value.

[0092] A data encryption processing module 73, configured to use the target hash value as a key to encrypt or decrypt the data to be processed.

[0093] In an exemplary embodiment of the present disclosure, the key determination module 72 may include a loop count acquisition module, a hash value calculation module, a loop module, and a loop exit module.

[0094] Among them, the loop count acquisition module is configured to acquire a loop count, and the initial value of the loop count is zero.

[0095] The hash value calculation module is configured to calculate the hash value of the key generation factor.

[0096] The loop module is configured to, when the hash value is less than a preset value and the loop count is less than a first threshold, update the hash value to the key generation factor and increment the loop count by 1; then go to the step of calculating the hash value of the key generation factor.

[0097] The loop exit module is configured to, when the hash value is not less than the preset value or the loop count is not less than the first threshold, use the hash value as the target hash value.

[0098] In an exemplary embodiment of the present disclosure, the device 70 further includes a loop count judgment module, configured to, when the hash value is not less than the preset value and the loop count is less than a second threshold, update the hash value to the key generation factor and increment the loop count by 1; then go to the step of calculating the hash value of the key generation factor, where the second threshold is less than the first threshold.

[0099] In an exemplary embodiment of the present disclosure, the device 70 further includes a page generation module and a threshold acquisition module.

[0100] Among them, the page generation module is configured to generate a parameter acquisition page and display the parameter acquisition page.

[0101] The threshold acquisition module is configured to obtain the first threshold and the second threshold through the parameter acquisition page.

[0102] In an exemplary embodiment of the present disclosure, the data acquisition module 71 may be configured to: acquire the identification information, random number, and salt value corresponding to the data to be processed corresponding to the data to be processed as the key generation factor.

[0103] In an exemplary embodiment of the present disclosure, the device 70 further includes a network request module and a salt value acquisition module.

[0104] Among them, the network request module is used to send a network request to the server, where the network request includes the identification information corresponding to the data to be processed.

[0105] The salt value acquisition module is used to receive the salt value corresponding to the identification information sent by the server.

[0106] In an exemplary embodiment of the present disclosure, the device 70 further includes a key storage module, which is used to store the target hash value as a key, so as to decrypt the data to be processed by using the stored key and the salt value.

[0107] Since each functional module of the data processing device in the exemplary embodiments of the present disclosure corresponds to the steps in the exemplary embodiments of the above data processing method, for the details not disclosed in the device embodiments of the present disclosure, please refer to the embodiments of the above data processing method of the present disclosure.

[0108] Next, refer to Figure 8 , which shows a schematic structural diagram of a computer system 800 of an electronic device suitable for implementing the embodiments of the present disclosure. Figure 8 The shown computer system 800 of the electronic device is only an example, and should not bring any limitation to the functions and usage scope of the embodiments of the present disclosure.

[0109] As Figure 8 shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 into the random access memory (RAM) 803. In the RAM 803, various programs and data required for system operation are also stored. The CPU 1201, ROM 802, and RAM 803 are connected to each other through a bus 804. The input / output (I / O) interface 805 is also connected to the bus 804.

[0110] The following components are connected to the I / O interface 805: an input part 806 including a keyboard, a mouse, etc.; an output part 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part 808 including a hard disk, etc.; and a communication part 809 including a network interface card such as a LAN card, a modem, etc. The communication part 809 performs communication processing via a network such as the Internet. The drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that the computer program read from it can be installed into the storage part 808 as needed.

[0111] Specifically, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above functions defined in the system of the present application are performed.

[0112] It should be noted that the computer-readable medium shown in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0113] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as combinations of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0114] The units described in the embodiments of the present disclosure can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not constitute a limitation on the unit itself in some cases.

[0115] On the other hand, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist separately and not be assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device is caused to implement the method for determining the effectiveness of epidemic prevention and control as described in the above embodiments.

[0116] For example, the electronic device may implement as Figure 2 shown: Step S21, obtaining a key generation factor corresponding to the data to be processed; Step S22, calculating a hash value of the key generation factor, and when the hash value is less than a preset value, updating the hash value to the key generation factor, and returning to calculate the hash value of the key generation factor, and when the hash value is less than the preset value, continuing to execute the step of updating the hash value to the key generation factor until the current hash value is not less than the preset value, and taking the current hash value as the target hash value; Step S23, using the target hash value as a key to encrypt or decrypt the data to be processed.

[0117] Again, for example, the electronic device may implement each step as Figures 3 - 6 shown.

[0118] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more of the above-described modules or units can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0119] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0120] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present disclosure. This application aims to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include well-known knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0121] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A data processing method, characterized in that: include: Obtain the key generation factor corresponding to the data to be processed; Obtaining a number of cycles, where the initial value of the number of cycles is zero; Calculating a hash value of the key generation factor; When the hash value is less than a preset value and the number of cycles is less than a first threshold, updating the hash value into the key generation factor and adding 1 to the number of cycles; Going to the step of calculating a hash value of the key generation factor; When the hash value is not less than the preset value or the number of cycles is not less than the first threshold, taking the hash value as the target hash value; The target hash value is used as a key to encrypt or decrypt the data to be processed.

2. The method according to claim 1, characterized in that The method further comprises: Generate a parameter acquisition page and display the parameter acquisition page; The first threshold is obtained through the parameter acquisition page.

3. The method according to claim 1, characterized in that Obtaining the key generation factor corresponding to the data to be processed includes: Obtain identification information corresponding to the data to be processed, a random number, and a salt value corresponding to the data to be processed as the key generation factor.

4. The method according to claim 3, characterized in that The method further comprises: Sending a network request to a server, wherein the network request includes identification information corresponding to the data to be processed; Receive the salt value corresponding to the identification information sent by the server.

5. The method according to claim 3, characterized in that After calculating a hash value that is not less than the preset value as the target hash value, the method further includes: The target hash value is stored as a key, so as to decrypt the data to be processed by using the stored key and the salt value.

6. A data processing device, characterized in that: include: A data acquisition module is used to obtain a key generation factor corresponding to the data to be processed; A key determination module is configured to obtain a number of cycles, where the initial value of the number of cycles is zero; and calculate a hash value of the key generation factor; When the hash value is less than a preset value and the number of cycles is less than a first threshold, updating the hash value into the key generation factor and adding 1 to the number of cycles; and proceeding to the step of calculating the hash value of the key generation factor; When the hash value is not less than the preset value or the number of cycles is not less than the first threshold, taking the hash value as the target hash value; The data encryption processing module is used to use the target hash value as a key to encrypt or decrypt the data to be processed.

7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the data processing method according to any one of claims 1 to 5.

8. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data processing method according to any one of claims 1 to 5 is implemented.

9. A computer program product, characterized in that The invention comprises a computer program carried on a computer-readable medium, wherein the computer program contains program codes for executing the data processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • New password authentication method and device

    CN102045169A

  • Password authentication method and device

    CN107733656A