CN112202555A - Information processing method, device and equipment for generating random number based on attribute of information - Google Patents
Information processing method, device and equipment for generating random number based on attribute of information Download PDFInfo
- Publication number
- CN112202555A CN112202555A CN202011056601.6A CN202011056601A CN112202555A CN 112202555 A CN112202555 A CN 112202555A CN 202011056601 A CN202011056601 A CN 202011056601A CN 112202555 A CN112202555 A CN 112202555A
- Authority
- CN
- China
- Prior art keywords
- information
- piece
- sub
- random number
- sub information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the application discloses an information processing method, device and equipment for generating random numbers based on attributes of information, and mainly relates to a block chain technology and a medical platform technology, wherein the method comprises the following steps: acquiring a target function for describing information and attribute information of each piece of sub information in target information; generating a root key according to user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key; generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information; acquiring coordinate information of each piece of sub-information according to the target function and each piece of adjusted sub-information; and encrypting the coordinate information of each piece of sub-information by adopting a key corresponding to each piece of sub-information to obtain a ciphertext of the target information, and storing the ciphertext of the target information into the block chain network. By adopting the embodiment of the application, the safety of the information can be improved.
Description
Technical Field
The present application relates to the field of block chain technologies, and in particular, to an information processing method, apparatus, and device for generating a random number based on an attribute of information.
Background
In the age of rapid development of the network, more and more information is interacted and stored through the network. The traditional information storage mode is generally terminal local storage, for example, a terminal can be used in a medical platform to store information such as medical record information and patient information of each patient in the terminal local, the information storage mode has a high risk, an illegal terminal can easily acquire the locally stored information to cause information leakage, and an illegal user can tamper the locally stored information to cause low information security, and when the local storage fails, the information cannot be found back, thereby causing loss. Therefore, how to ensure the security of information in the information storage process and prevent information leakage is an urgent problem to be solved.
Disclosure of Invention
The embodiment of the application provides an information processing method, an information processing device and information processing equipment for generating random numbers based on attributes of information, which can be used for encrypting the information, improving the safety of the information and preventing the information from being leaked.
An embodiment of the present application provides an information processing method for generating a random number based on an attribute of information, including:
acquiring an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, wherein the target information comprises at least two pieces of sub information, and the attribute information of each piece of sub information comprises at least one of generation time of each piece of sub information and length of each piece of sub information;
generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key;
generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
acquiring coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the target function and each piece of adjusted sub information;
encrypting the coordinate information of the corresponding sub-information in the at least two pieces of sub-information by adopting the key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information;
and determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information, and storing the ciphertext of the target information into the block chain network.
Optionally, the attribute information of each piece of sub information includes a length of each piece of sub information, and the generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information includes: determining the privacy level corresponding to each piece of sub information according to the length of each piece of sub information; generating a second random number according to the privacy level corresponding to each piece of sub information; acquiring the byte length of the second random number, and intercepting the second random number according to the byte length to obtain an intercepted second random number; the intercepted second random number is smaller than a random number threshold value, and the byte length in the intercepted second random number is smaller than the byte length in the second random number; and determining the intercepted second random number as a first random number corresponding to each piece of sub information.
Optionally, the attribute information of each piece of sub information includes generation time of each piece of sub information, and the generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information includes: coding the generation time of each piece of sub information to obtain coded time data; generating a third random number according to the encoded time data; filling the bytes in the third random number to obtain a filled third random number, wherein the filled third random number is smaller than a random number threshold; and determining the third random number after the filling processing as the first random number corresponding to each piece of sub information.
Optionally, the adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information includes: performing remainder operation on each piece of sub information and the first random number to obtain each piece of remainder sub information; and if the each piece of the redundant sub information is smaller than the information threshold, determining the each piece of the redundant sub information as each piece of the adjusted sub information.
Optionally, the target information includes first sub information and second sub information, and the generation time of the second sub information is later than the generation time of the first sub information; the generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key includes: coding the user information to obtain coded user data; generating a fourth random number according to the encoded user data; performing hash operation on the fourth random number to obtain the root key; performing hash operation on the root key to obtain a key of the first sub-information; and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
Optionally, the encrypting, by using the key corresponding to each piece of sub information, the coordinate information of the corresponding piece of sub information in the at least two pieces of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information includes: acquiring a private key of a terminal to which the target information belongs and a secret key corresponding to each piece of sub information, wherein the terminal to which the target information belongs is a terminal corresponding to an organization to which each piece of sub information belongs; and encrypting the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the private key and the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information.
Optionally, the encrypting the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the private key and the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information includes: obtaining the coordinates of a base point of the curve of the objective function; obtaining the product of the base point coordinate and the private key to obtain a candidate coordinate; encrypting the candidate coordinate according to the key corresponding to each piece of sub information to obtain a ciphertext of the candidate coordinate; and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
An embodiment of the present application provides an information processing apparatus that generates a random number based on an attribute of information, including:
the information acquisition module is used for acquiring an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, wherein the target information comprises at least two pieces of sub information, and the attribute information of each piece of sub information comprises at least one of generation time of each piece of sub information and length of each piece of sub information;
the key generation module is used for generating a root key corresponding to the target information according to the user information contained in the target information and generating a key corresponding to each piece of sub information according to the root key;
the information adjusting module is used for generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
a coordinate obtaining module, configured to obtain, according to the target function and each piece of adjusted sub information, coordinate information corresponding to each piece of sub information in the at least two pieces of sub information;
the information encryption module is used for encrypting the coordinate information of the corresponding sub-information in the at least two pieces of sub-information by adopting the key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information;
and the information storage module is used for determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information and storing the ciphertext of the target information into the block chain network.
Optionally, the attribute information of each piece of sub information includes a length of each piece of sub information, and the information adjusting module is specifically configured to: determining the privacy level corresponding to each piece of sub information according to the length of each piece of sub information; generating a second random number according to the privacy level corresponding to each piece of sub information; acquiring the byte length of the second random number, and intercepting the second random number according to the byte length to obtain an intercepted second random number; the intercepted second random number is smaller than a random number threshold value, and the byte length in the intercepted second random number is smaller than the byte length in the second random number; and determining the intercepted second random number as a first random number corresponding to each piece of sub information.
Optionally, the attribute information of each piece of sub information includes a generation time of each piece of sub information, and the information adjusting module is specifically configured to: coding the generation time of each piece of sub information to obtain coded time data; generating a third random number according to the encoded time data; filling the bytes in the third random number to obtain a filled third random number, wherein the filled third random number is smaller than a random number threshold; and determining the third random number after the filling processing as the first random number corresponding to each piece of sub information.
Optionally, the information adjusting module is specifically configured to: performing remainder operation on each piece of sub information and the first random number to obtain each piece of remainder sub information; and if the each piece of the redundant sub information is smaller than the information threshold, determining the each piece of the redundant sub information as each piece of the adjusted sub information.
Optionally, the target information includes first sub information and second sub information, and the generation time of the second sub information is later than the generation time of the first sub information; the key generation module is specifically configured to: coding the user information to obtain coded user data; generating a fourth random number according to the encoded user data; performing hash operation on the fourth random number to obtain the root key; performing hash operation on the root key to obtain a key of the first sub-information; and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
Optionally, the information encryption module is specifically configured to: acquiring a private key of a terminal to which the target information belongs and a secret key corresponding to each piece of sub information, wherein the terminal to which the target information belongs is a terminal corresponding to an organization to which each piece of sub information belongs; and encrypting the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the private key and the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information.
Optionally, the information encryption module is specifically configured to: obtaining the coordinates of a base point of the curve of the objective function; obtaining the product of the base point coordinate and the private key to obtain a candidate coordinate; encrypting the candidate coordinate according to the key corresponding to each piece of sub information to obtain a ciphertext of the candidate coordinate; and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
One aspect of the present application provides a computer device, comprising: a processor, a memory, a network interface;
the processor is connected to a memory and a network interface, wherein the network interface is used for providing a data communication function, the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the method in the aspect in the embodiment of the present application.
An aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to execute an information processing method of the first aspect described above for generating a random number based on an attribute of information.
In the embodiment of the application, because the first random number corresponding to each piece of sub information is generated according to the attribute information of each piece of sub information, and the attribute information of each piece of sub information includes the generation time of each piece of sub information or the length of each piece of sub information, it is difficult for an illegal terminal to acquire the generation time of each piece of sub information and the length of each piece of sub information, that is, the first random number corresponding to each piece of sub information cannot be generated, therefore, by adjusting each piece of sub information by using the first random number and subsequently encrypting the adjusted sub information, the security of information can be improved. By adjusting each piece of sub information in at least two pieces of sub information, the coordinate information corresponding to each piece of adjusted sub information can be generated according to each piece of adjusted sub information, and the success rate of obtaining the coordinate information corresponding to each piece of adjusted sub information is improved. By encrypting each piece of sub information in the target information, the illegal terminal is prevented from cracking the ciphertext, so that the safety of each piece of sub information is improved, and the safety of the target information is improved. The ciphertext information of the target information is stored in the block chain network, and the safety of the information can be improved based on the characteristic that the block chain cannot be tampered and is not easy to lose; in addition, the ciphertext of the target information is stored in the block chain network, so that the resource occupation of the local storage space of the terminal can be reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of an information processing method for generating a random number based on an attribute of information according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for adjusting each piece of sub information according to an embodiment of the present application;
fig. 3 is a schematic flowchart of an information processing method for generating a random number based on an attribute of information according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a configuration of an information processing apparatus that generates a random number based on an attribute of information according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The block chain related to the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission (P2P transmission), consensus mechanism, encryption algorithm and the like, is essentially a decentralized database, and is a series of data blocks which are generated in a correlation mode by using a cryptography method, wherein each data block contains information of a batch of network transactions and is used for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain can comprise a blockchain bottom platform, a platform product service layer and an application service layer; the blockchain can be composed of a plurality of serial transaction records (also called blocks) which are connected in series by cryptography and protect the contents, and the distributed accounts connected in series by the blockchain can effectively record the transactions by multiple parties and can permanently check the transactions (can not be tampered). The consensus mechanism is a mathematical algorithm for establishing trust and obtaining rights and interests among different nodes in the block chain network; that is, the consensus mechanism is a mathematical algorithm commonly recognized by network nodes in the blockchain.
The method and the system are suitable for the medical platform, the target information can be medical record information, patient information and the like of the patient, the medical record information, the patient information and other information of the medical platform of the patient are encrypted, the encrypted information is stored in the block chain network, management of the medical record information, the patient information and the like of the patient is facilitated, and safety of the information of the patient is improved.
Referring to fig. 1, fig. 1 is a schematic flow chart of an information processing method for generating a random number based on an attribute of information, which is applied to a node in a block chain Network, where the node may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Distribution Network (CDN), and a big data and artificial intelligence platform. Alternatively, the node may refer to a computer device, including a mobile phone, a tablet computer, a notebook computer, a palm computer, a smart audio, a Mobile Internet Device (MID), a Point Of Sale (POS) machine, a wearable device (e.g., a smart watch, a smart bracelet, etc.), and the like. As shown in fig. 1, the method includes:
s101, acquiring an objective function for describing information and attribute information of each piece of sub information in target information to be processed.
Here, the objective function may be a function corresponding to an elliptic curve, or may be a function corresponding to another curve. The target information includes at least two pieces of sub information, and the target information may refer to transaction data, business data, internal data of a certain organization, and the like. The attribute information of each piece of sub information in the target information includes at least one of a generation time of each piece of sub information and a length of each piece of sub information. The target function is used for describing target information, namely converting the target information into coordinate information corresponding to the target function, so that the safety of the target information is improved.
And S102, generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key.
The target information comprises first sub information and second sub information, and the generation time of the second sub information is later than that of the first sub information. The user information may include, for example, a user name, a user number, an organization code of an organization to which the user belongs, and the like. If the target information only contains one piece of user information, generating a root key corresponding to the target information according to the one piece of user information; and if the target information only contains a plurality of pieces of user information, generating a root key corresponding to the target information according to the plurality of pieces of user information, namely generating the root key corresponding to the target information according to any one or more pieces of user information in the plurality of pieces of user information.
In the embodiment of the present application, a method for generating a root key corresponding to target information according to user information included in the target information includes: coding the user information to obtain coded user data; generating a fourth random number according to the encoded user data; and carrying out Hash operation on the fourth random number to obtain a root key corresponding to the target information.
Specifically, the computer device obtains user information included in the target information, encodes the user information to obtain encoded user data, then calls a rand function in the C language, returns a random number, i.e., a fourth random number, according to the encoded user data, and performs hash operation on the fourth random number to obtain a root key corresponding to the target information. For example, a fourth random number k is generated from the encoded data; the fourth random number k is subjected to hash operation, i.e., hash (k) ═ k1, and k1 is used as the root key corresponding to the target information. Optionally, other random number generation algorithms may be used to generate the fourth random number, such as the central limit theorem and Box Muller (coordinate transformation), the monte carlo algorithm, the numerical probability algorithm, the las vegas algorithm, or other random number generation algorithms. The user information is encoded to obtain encoded user data, and a fourth random number is generated according to the encoded user data, and the fourth random number is subjected to hash operation to obtain a root key corresponding to the target information, namely the random number is encrypted by adopting a hash operation method, so that the security of the root key corresponding to the target information can be improved.
In this embodiment of the present application, the method for generating the key corresponding to each piece of sub information according to the root key may be: performing hash operation on a root key corresponding to the target information to obtain a key of the first sub information; and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
For example, the root key corresponding to the target information is n, the target information includes 2 pieces of sub information, namely sub information a1 and sub information a2, and the generation time corresponding to the 2 pieces of sub information is t1 and t2, and t1> t2, so that the first sub information is sub information a1, the second sub information is sub information a2, the root key corresponding to the target information is hashed to obtain the key of the first sub information, namely hash (n) ═ n1, and then n1 is the key of the first sub information; if the key of the first sub information is hashed to obtain the key of the second sub information, that is, if hash (n1) is n2, n2 is the key of the second sub information.
If the number of the second sub information is greater than 1, if the number of the second sub information is 3, the second sub information is sub information a2, sub information a3 and sub information a4, the generation time of the 3 pieces of second sub information is t2, t3 and t4, respectively, t2> t3> t4, and the key of the first sub information is n1, performing hash operation on the key of the first sub information to obtain the key of the second sub information a2, that is, hash (n1) ═ n2, and then n2 is the key of the sub information a 2; performing hash operation on the key of the second sub-information a2 to obtain the key of the second sub-information a3, that is, if the hash (n2) is n3, then n3 is the key of the sub-information a 3; if the key of the second sub information a3 is hashed to obtain the key of the second sub information a4, i.e., if the hash (n3) is n4, n4 is the key of the sub information a 4. Therefore, the key corresponding to each piece of sub information can be calculated. Because each piece of sub information is determined according to the generation time of each piece of sub information, the first sub information and the second sub information are different due to different generation times of different pieces of sub information, and the obtained key corresponding to each piece of sub information is also different; the key corresponding to the sub-information is obtained by performing the hash operation on the root key, so that the difficulty of the key corresponding to the sub-information can be improved, the encryption difficulty can be improved when each piece of sub-information is encrypted by using the key corresponding to the sub-information subsequently, the probability that a ciphertext is cracked by an illegal terminal is reduced, and the information safety is improved.
Optionally, the target information includes first sub information and second sub information, and an information occupied space of the second sub information is smaller than an information occupied space of the first sub information. The method for generating the root key corresponding to the target information according to the user information contained in the target information, and generating the key corresponding to each piece of sub information according to the root key may be: coding the user information to obtain coded user data; generating a fourth random number according to the encoded user data; performing hash operation on the fourth random number to obtain a root key corresponding to the target information; performing hash operation on a root key corresponding to the target information to obtain a key of the first sub information; and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
The information occupying space of the information is a size of a resource space occupied when the information is stored, and may be represented by a byte (B), a Kilobyte (KB), a Megabyte (MB), a Gigabyte (GB), or the like, for example, and B < KB < MB < GB. For example, if the information occupying space of the sub information 1 is 3KB and the information occupying space of the sub information 2 is 1KB, the sub information 1 is the first sub information and the sub information 2 is the second sub information. If the root key corresponding to the target information is m, performing hash operation on the root key corresponding to the target information to obtain a key of the first sub-information, namely hash (m) is m1, and if m1 is the key of the first sub-information; when the key of the first sub information is hashed to obtain the key of the second sub information, that is, when hash (m1) is m2, m2 is the key of the second sub information. Therefore, the key corresponding to each piece of sub information can be calculated. Each piece of sub information is determined according to the information occupation space of each piece of sub information, so that the first sub information and the second sub information are different due to different information occupation spaces of different pieces of sub information, and the obtained key corresponding to each piece of sub information is also different; the key corresponding to the sub-information is obtained by performing the hash operation on the root key, so that the difficulty of the key corresponding to the sub-information can be improved, the encryption difficulty can be improved when each piece of sub-information is encrypted by using the key corresponding to the sub-information subsequently, the probability that a ciphertext is cracked by an illegal terminal is reduced, and the information safety is improved.
S103, generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information.
Here, when the value corresponding to each piece of sub information is greater than the first threshold, it is not possible to map each piece of sub information onto the curve of the objective function, and the coordinate point corresponding to each piece of sub information cannot be calculated from the curve of the objective function. Therefore, each piece of sub information can be adjusted by using the first random number, so that the value corresponding to each piece of adjusted sub information is smaller than or equal to the first threshold value, thereby mapping each piece of sub information onto the curve of the objective function, and calculating the coordinate point corresponding to each piece of sub information according to the curve of the objective function. By adjusting each piece of sub information using the first random number, it is possible to provideThe probability of obtaining the coordinate point corresponding to each piece of sub information is high, and therefore the probability of successful encryption is improved. The first threshold may be determined according to a curve parameter corresponding to the objective function, and if the curve parameter is a curve length c, the first threshold is 2256-w, wherein w is a minimum value. The random numbers may be generated using the random number generation algorithm mentioned above.
Here, if each piece of sub information is not data of a numerical type, each piece of sub information may be encoded to obtain encoded data of the numerical type, and the encoded data corresponding to each piece of sub information is adjusted according to the first random number corresponding to each piece of sub information to obtain each piece of adjusted sub information. And if each piece of sub information is data of a numerical value type, adjusting each piece of sub information according to the first random number corresponding to each piece of sub information to obtain each piece of adjusted sub information. It can be known that each piece of sub information after adjustment includes the piece of sub information and the first random number corresponding to the piece of sub information.
Optionally, if the attribute information of each piece of sub information includes the length of each piece of sub information, the method for generating the first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information may be: determining the privacy level corresponding to each piece of sub-information according to the length of each piece of sub-information; generating a second random number according to the privacy level corresponding to each piece of sub information; acquiring the byte length of the second random number, and intercepting the second random number according to the byte length to obtain an intercepted second random number; and determining the intercepted second random number as a first random number corresponding to each piece of sub information.
And the intercepted second random number is smaller than the random number threshold, and the byte length in the intercepted second random number is smaller than the byte length in the second random number. The random number threshold may be, for example, in the range of (0,128). The byte length in the second random number refers to the number of bytes corresponding to the second random number, for example, if the second random number is a number between 0 and 255, the corresponding byte length is 1, or if the second random number is a number greater than 255, the byte length is greater than 1, and so on. 1 byte corresponds to 8 bits (i.e. bits), that is, for example, the length of the byte in the second random number is 1, and corresponds to 8 bits, the length of the byte in the intercepted second random number is smaller than 8 bits, and may be 7 bits, 6 bits, 5 bits, and so on.
Specifically, the computer device may obtain the length of each piece of sub information, and determine the privacy level corresponding to each piece of sub information. If the length of the sub information is longer, the higher the privacy level of the sub information is; the shorter the length of the sub information is, the lower the privacy level of the sub information is. For example, when the length of the sub information is greater than a first length threshold, the privacy level of the sub information is set to a first privacy level; and when the length of the sub information is larger than the second length threshold value, setting the privacy level of the sub information as a second privacy level. If the privacy level corresponding to a certain sub-information is the second privacy level, a second random number is generated according to the privacy level corresponding to the sub-information, then the byte length of the second random number is obtained, the second random number is intercepted according to the byte length, and the intercepted second random number is obtained, for example, 8 bits corresponding to 1 byte are intercepted, for example, any 1bit of the 8 bits can be intercepted, or 2 bits, 3 bits, 5 bits and the like can be intercepted. That is, the numerical value corresponding to the second random number after the truncation is different from the numerical value corresponding to the second random number before the truncation.
Because the second random number is intercepted, the intercepted second random number can be obtained, and a plurality of interception modes are available for one second random number, including intercepting one or more bits of 8 bits, so that the intercepted second random number is not equal to the second random number before interception, even if an illegal terminal obtains the length of each piece of sub information and obtains the second random number, due to the plurality of interception modes of the second random number, the correct intercepted second random number is difficult to obtain, so that the first random number corresponding to each piece of sub information cannot be obtained, and the safety of information can be improved.
Optionally, if the attribute information of each piece of sub information includes the generation time of each piece of sub information, the method for generating the first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information may be: coding the generation time of each piece of sub information to obtain coded time data; generating a third random number according to the encoded time data; filling the bytes in the third random number to obtain a filled third random number; and determining the third random number after the filling processing as the first random number corresponding to each piece of sub information.
The third random number after the padding process is smaller than the random number threshold, which may be, for example, (0,128). Specifically, the computer device may obtain the generation time of each piece of sub information, encode the generation time of each piece of sub information to obtain encoded time data, and process the encoded time data according to a random number generation algorithm to obtain a third random number; and padding the bytes in the third random number to obtain a padded third random number, and padding 8 bits corresponding to 1 byte, for example, binary padding to 0 or 1. That is, the numerical value corresponding to the third random number after the padding processing is different from the numerical value corresponding to the third random number before the padding processing, and the third random number after the padding processing is smaller than the random number threshold.
The third random number is filled, so that the filled third random number can be obtained, and one third random number has multiple filling modes, including filling one or more bits of 8 bits, so that the filled third random number is not equal to the third random number before filling, and even if an illegal terminal acquires the generation time of each piece of sub information and obtains the third random number, due to the multiple filling modes of the third random number, the correct filled third random number is difficult to obtain, so that the first random number corresponding to each piece of sub information cannot be obtained, and the safety of information can be improved.
Optionally, if the attribute information of each piece of sub information includes the limited time limit of each piece of sub information, the method for generating the first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information may be: determining the importance level of each piece of sub information according to the limited time limit of each piece of sub information, generating a fifth random number according to the importance level of each piece of sub information, and intercepting or filling bytes in the fifth random number to obtain the intercepted or filled fifth random number; and determining the fifth random number after the interception processing or the filling processing as the first random number corresponding to each piece of sub information.
And the fifth random number after the interception processing or the filling processing is smaller than the random number threshold, and the byte length of the fifth random number after the interception processing or the filling processing is smaller than the byte length of the fifth random number, that is, the fifth random number after the interception processing or the filling processing is different from the value corresponding to the fifth random number before the interception processing or the filling processing. The longer the limited duration of each piece of sub information is, the higher the importance level of each piece of sub information is represented; the shorter the finite term of each piece of sub information is, the lower the importance level of each piece of sub information is represented. The computer equipment determines the importance level of each piece of sub information corresponding to the validity period by acquiring the validity period of each piece of sub information, generates a fifth random number according to the importance level of the piece of sub information by using a random number generation algorithm, and obtains the fifth random number after interception processing or filling processing by intercepting or filling processing of bytes in the fifth random number; and determining the fifth random number after the interception processing or the filling processing as the first random number corresponding to each piece of sub information. Since the fifth random number can be subjected to various intercepting processing and filling processing modes, and the intercepted or filled fifth random number can be obtained, an illegal terminal is difficult to obtain the correct intercepted or filled fifth random number, so that the first random number corresponding to each piece of sub information cannot be obtained, and the safety of the information can be improved.
And S104, acquiring coordinate information corresponding to each piece of sub information in at least two pieces of sub information according to the target function and each piece of adjusted sub information.
Here, for example, each piece of sub information of the adjusted non-numerical type may be encoded to obtain encoded data corresponding to each piece of sub information of the adjusted numerical type, and the encoded data corresponding to each piece of sub information of the adjusted numerical type may be mapped onto a curve corresponding to the objective function to obtain a corresponding coordinate point, so as to obtain coordinate information corresponding to each piece of sub information according to the coordinate point.
In a possible implementation manner, a curve corresponding to a target function may be obtained, and each piece of adjusted sub information is mapped to a first coordinate of a target point on the curve corresponding to the target function; determining a second coordinate of a target point on a curve corresponding to the target function according to the first coordinate and the target function; and determining the first coordinate and the second coordinate as coordinate information corresponding to each piece of sub information, so as to obtain the coordinate information corresponding to each piece of sub information in at least two pieces of sub information.
For example, to describe obtaining coordinate information corresponding to any piece of sub information c in at least two pieces of sub information, a second coordinate of a target point on a curve corresponding to an objective function may be determined according to a first coordinate and the objective function, and the first coordinate and the second coordinate are determined as coordinate information corresponding to the sub information c. For example, the curve corresponding to the objective function can be shown in equation (1-1):
y2=x3+ax+b(1-1)
wherein a and b are both known real numbers, x and y are both parameters, and by determining the value of any one of x or y, the value of the other parameter can be calculated by formula (1-1), for example, by determining the value of x and calculating the value of y by formula (1-1).
For example, a is 1, b is-1, a first coordinate (for example, the abscissa of the target point) of the target point mapped on the curve corresponding to the target function by the sub information c is 1, and a, b and the first coordinate are substituted into the formula (1-1) as x to obtain y as 1, that is, the second coordinate of the target point on the curve corresponding to the target function is 1, and the coordinate information corresponding to the sub information c is (1, 1).
And S105, encrypting the coordinate information corresponding to each piece of sub information in at least two pieces of sub information by using the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information.
Here, the computer device may encrypt the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information by using the key corresponding to each piece of sub information, to obtain a ciphertext of the coordinate information corresponding to each piece of sub information. In specific implementation, the computer device may obtain a private key of a terminal to which the target information belongs, and encrypt coordinate information corresponding to each piece of sub information in at least two pieces of sub information according to the private key of the terminal and a key corresponding to each piece of sub information to obtain a ciphertext of the coordinate information corresponding to each piece of sub information. It is understood that the ciphertext of the coordinate information corresponding to the sub information is the ciphertext obtained by encrypting the sub information, and when the ciphertext is not decrypted, the content of the sub information corresponding to the ciphertext cannot be known even if the ciphertext is obtained. The security of the target information can be improved by encrypting each piece of sub information corresponding to the target information by using a private key of a terminal to which the target information belongs and a key corresponding to each piece of sub information.
And S106, determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information, and storing the ciphertext of the target information into the block chain network.
Here, in the above step, for each piece of sub information in the at least two pieces of sub information, a ciphertext of the coordinate information corresponding to each piece of sub information is obtained, so that the ciphertext of the coordinate information corresponding to each piece of sub information is determined as the ciphertext of the target information, that is, the ciphertext of the target information includes the ciphertext of the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information, so that the target information can be encrypted to obtain the ciphertext of the target information, and the ciphertext of the target information can be stored in the block chain network. By sending the target information to the block chain network for encryption and storage, the resource occupation of the local storage space of the terminal can be reduced, the target information can be prevented from being stored locally in the terminal and being tampered by illegal users, and the safety of the target information is improved.
In the embodiment of the application, because the first random number corresponding to each piece of sub information is generated according to the attribute information of each piece of sub information, and the attribute information of each piece of sub information includes the generation time of each piece of sub information or the length of each piece of sub information, it is difficult for an illegal terminal to acquire the generation time of each piece of sub information and the length of each piece of sub information, that is, the first random number corresponding to each piece of sub information cannot be generated, therefore, by adjusting each piece of sub information by using the first random number and subsequently encrypting the adjusted sub information, the security of information can be improved. By adjusting each piece of sub information in at least two pieces of sub information, the coordinate information corresponding to each piece of adjusted sub information can be generated according to each piece of adjusted sub information, and the success rate of obtaining the coordinate information corresponding to each piece of adjusted sub information is improved. By encrypting each piece of sub information in the target information, the illegal terminal is prevented from cracking the ciphertext, so that the safety of each piece of sub information is improved, and the safety of the target information is improved. The ciphertext information of the target information is stored in the block chain network, and the safety of the information can be improved based on the characteristic that the block chain cannot be tampered and is not easy to lose; in addition, the ciphertext of the target information is stored in the block chain network, so that the resource occupation of the local storage space of the terminal can be reduced.
Optionally, in the step S103, the method for adjusting each piece of sub information according to the first random number may be as shown in fig. 2, where fig. 2 is a schematic flow chart of the method for adjusting each piece of sub information according to the embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
s201, performing remainder operation on each piece of sub information and the first random number to obtain each piece of remainder sub information.
And S202, if each piece of the remaining sub information is smaller than the information threshold, determining each piece of the remaining sub information as each piece of the adjusted sub information.
In steps S201 to S202, the remainder operation refers to dividing two numbers, performing a remainder operation on each piece of sub information and the first random number, that is, dividing each piece of sub information by the first random number, and taking a result obtained by the calculation as each piece of sub information after the remainder operation. Here, if each piece of the remaining sub information is smaller than the information threshold, it is considered that the piece of sub information is mapped to the first coordinate of the target point on the curve corresponding to the objective function, and the first coordinate and the objective function may be calculated to obtain the piece of sub informationAnd obtaining the coordinate information corresponding to each piece of sub information by using the second coordinate of the target point on the curve corresponding to the target function. If each piece of the remaining sub information is greater than or equal to the information threshold, it is considered that the piece of sub information is mapped to a first coordinate of a target point on a curve corresponding to the target function, and a second coordinate of the target point on the curve corresponding to the target function cannot be obtained through calculation according to the first coordinate and the target function, that is, coordinate information corresponding to each piece of sub information cannot be obtained. The information threshold may be, for example, 2256And may be less than 2256。
And performing remainder operation on each piece of sub information and the first random number to obtain each piece of remainder sub information, and determining each piece of remainder sub information as each piece of adjusted sub information according to the size relation between each piece of remainder sub information and the information threshold. The remainder of each piece of sub information and the first random number may be obtained by dividing a numerical value corresponding to each piece of sub information by the first random number, and it is known that the numerical value corresponding to each piece of sub information obtained after the remainder is smaller than the numerical value corresponding to the sub information before the remainder.
S203, if each piece of the remaining sub information is greater than or equal to the information threshold, adjusting the first random number.
S204, performing remainder operation on each piece of sub information and the adjusted first random number to obtain each piece of candidate sub information.
Here, when each piece of the remaining sub information is greater than or equal to the information threshold, the piece of sub information is mapped to a first coordinate of a target point on a curve corresponding to the target function, and a second coordinate of the target point on the curve corresponding to the target function cannot be calculated according to the first coordinate and the target function, that is, coordinate information corresponding to each piece of sub information cannot be obtained. Therefore, it is necessary to adjust the first random number corresponding to each piece of sub information, and perform a remainder operation on each piece of adjusted sub information and the first random number to obtain each piece of candidate sub information.
And S205, if each piece of candidate sub information is smaller than the information threshold, determining each piece of candidate sub information as each piece of adjusted sub information.
It can be known that, if each piece of candidate sub information is smaller than the information threshold, the piece of candidate sub information is mapped to a first coordinate of a target point on a curve corresponding to the target function, and a second coordinate of the target point on the curve corresponding to the target function can be obtained through calculation according to the first coordinate and the target function, that is, coordinate information corresponding to each piece of candidate sub information can be obtained. If each piece of candidate sub information is greater than or equal to the information threshold, it is considered that the piece of sub information is mapped to a first coordinate of a target point on a curve corresponding to the target function, and a second coordinate of the target point on the curve corresponding to the target function cannot be obtained through calculation according to the first coordinate and the target function, that is, coordinate information corresponding to each piece of sub information cannot be obtained. That is, if each piece of candidate sub information is greater than or equal to the information threshold, the first random number is continuously adjusted until each piece of candidate sub information and the adjusted first random number are subjected to remainder operation, and each piece of remaining candidate sub information is smaller than the information threshold, and each piece of remaining candidate sub information is determined as each piece of adjusted sub information.
In the embodiment of the application, each piece of sub information after adjustment can be obtained by taking the remainder of each piece of sub information and the first random number corresponding to each piece of sub information and continuously adjusting the first random number corresponding to each piece of sub information, and the success rate of subsequently encrypting each piece of sub information is improved.
Referring to fig. 3, fig. 3 is a schematic flowchart of an information processing method for generating a random number based on an attribute of information according to an embodiment of the present application, where the method is applied to a node in a block chain network. As shown in fig. 3, the method includes:
s301, an objective function for describing information and attribute information of each piece of sub information in target information to be processed are obtained.
S302, generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key.
S303, generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information.
S304, obtaining coordinate information corresponding to each piece of sub information in at least two pieces of sub information according to the target function and each piece of sub information after adjustment.
Here, the specific contents of steps S301 to S304 may refer to the contents of steps S101 to S104 in the embodiment corresponding to fig. 1, and are not described herein again.
S305, obtaining a private key of the terminal to which the target information belongs and a secret key corresponding to each piece of sub information.
Here, the terminal to which the target information belongs is a terminal that uploads the target information to the blockchain network for encryption, storage, and other processing, and the private key of the terminal to which the target information belongs is a private key generated by the terminal.
In a specific implementation, for example, the identifier of the terminal to which the target information belongs may be obtained, a sixth random number is generated by using an SECP256K1 algorithm, and the sixth random number is filled to obtain a private key of the terminal, where the private key of the terminal may refer to a number including 256 bits. Here, the identifier of the terminal may refer to a factory number of the terminal, or other identifiers for uniquely indicating the terminal.
S306, according to the private key of the terminal and the key corresponding to each piece of sub information, the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information is encrypted, and a ciphertext of the coordinate information corresponding to each piece of sub information is obtained.
In the embodiment of the application, the coordinates of the base point of the curve of the objective function can be obtained; obtaining a product of the base point coordinate and the private key to obtain a candidate coordinate; encrypting the candidate coordinates according to the key corresponding to each piece of sub information to obtain a ciphertext of the candidate coordinates; and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
Here, by acquiring the curve of the objective function, and the curve parameters of the objective function, the base point coordinates of the curve of the objective function can be acquired. For example, if the base point is G, the corresponding base point coordinate is (x1, y1), and the private key of the terminal is h, the candidate coordinate can be calculated according to the formula (1-2):
H=h*G (1-2)
the candidate coordinate is H, the base point is G, and the private key of the terminal is H.
Specifically, the candidate coordinates can be encrypted according to the key corresponding to each piece of sub information to obtain the ciphertext of the candidate coordinates; and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
For example, the number of pieces of sub information corresponding to the target information is n, the piece of sub information i is any piece of sub information in the n pieces of sub information, the candidate coordinates can be encrypted in a formula (1-3) manner to obtain a ciphertext of the candidate coordinates, and the coordinate information corresponding to the piece of sub information i and the ciphertext of the candidate coordinates are subjected to sum fusion to obtain the ciphertext of the coordinate information corresponding to the piece of sub information i.
Ci=Mi+ki*H (1-3)
The candidate coordinates are H, Ci is a ciphertext of the coordinate information corresponding to the sub-information i, Mi is the coordinate information corresponding to the sub-information i, and ki is a key corresponding to the sub-information i. And ki x H represents that the candidate coordinates are encrypted according to the key corresponding to the sub information i to obtain the ciphertext of the candidate coordinates. It can be known that, for other pieces of sub information in the n pieces of sub information, the coordinate information ciphertext corresponding to the other pieces of sub information can be obtained by encrypting and fusing the other pieces of sub information according to the formula (1-3). For each piece of sub information, the ciphertext of the coordinate information corresponding to the piece of sub information can be obtained by encrypting and fusing the pieces of sub information according to the formula (1-3), that is, the number of the ciphertext of the coordinate information corresponding to one piece of sub information is n, that is, for n pieces of sub information, the number of the ciphertext of the coordinate information corresponding to the piece of sub information finally obtained is n.
In a specific implementation, the coordinate information corresponding to each piece of sub information may be encrypted by using an encryption algorithm to obtain a ciphertext of the coordinate information corresponding to each piece of sub information, where the encryption algorithm may include, for example, an Elgamal algorithm (an asymmetric encryption algorithm), a Rabin algorithm (an asymmetric encryption algorithm), a Diffie-Hellman algorithm (an asymmetric encryption algorithm), and an ECC algorithm (an elliptic curve encryption algorithm). The computer equipment encrypts the coordinate information corresponding to each piece of sub-information in at least two pieces of sub-information according to a private key of the terminal and a secret key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information, so that each piece of sub-information can be encrypted to obtain a corresponding ciphertext, and after the terminal obtains the ciphertext corresponding to each piece of sub-information, the terminal needs to decrypt to obtain the sub-information corresponding to each ciphertext.
S307, determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information, and storing the ciphertext of the target information into the block chain network.
Here, the specific content of step S307 may refer to the content of step S106 in the embodiment corresponding to fig. 1, and is not described herein again.
In the embodiment of the application, according to a private key of the terminal and a key corresponding to each piece of sub information, the coordinate information corresponding to each piece of sub information in at least two pieces of sub information is encrypted to obtain a ciphertext of the coordinate information corresponding to each piece of sub information, so that each piece of sub information can be encrypted to obtain a corresponding ciphertext, and after the terminal obtains the ciphertext corresponding to each piece of sub information, the terminal needs to decrypt to obtain the sub information corresponding to each ciphertext. By encrypting each piece of sub information, even if an illegal terminal acquires a ciphertext corresponding to the sub information, the content of the sub information cannot be acquired because decryption cannot be realized, so that the safety of each piece of sub information can be ensured, and the safety of target information is ensured.
The method of the embodiments of the present application is described above, and the apparatus of the embodiments of the present application is described below.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating a structure of an information processing apparatus for generating a random number based on an attribute of information according to an embodiment of the present application, where the information processing apparatus for generating a random number based on an attribute of information may be a computer program (including program code) running in a computer device, and the information processing apparatus for generating a random number based on an attribute of information is an application software, for example; the apparatus may be used to perform the corresponding steps in the methods provided by the embodiments of the present application. The apparatus 40 comprises:
an information obtaining module 401, configured to obtain an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, where the target information includes at least two pieces of sub information, and the attribute information of each piece of sub information includes at least one of a generation time of each piece of sub information and a length of each piece of sub information;
a key generation module 402, configured to generate a root key corresponding to the target information according to the user information included in the target information, and generate a key corresponding to each piece of sub information according to the root key;
an information adjusting module 403, configured to generate a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjust each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
a coordinate obtaining module 404, configured to obtain, according to the objective function and each piece of adjusted sub information, coordinate information corresponding to each piece of sub information in the at least two pieces of sub information;
an information encryption module 405, configured to encrypt, by using a key corresponding to each piece of sub information, coordinate information of the corresponding piece of sub information in the at least two pieces of sub information, to obtain a ciphertext of the coordinate information corresponding to each piece of sub information;
the information storage module 406 is configured to determine a ciphertext of the coordinate information corresponding to each piece of sub information as a ciphertext of the target information, and store the ciphertext of the target information in the block chain network.
Optionally, the attribute information of each piece of sub information includes a length of each piece of sub information, and the information adjusting module 403 is specifically configured to:
determining the privacy level corresponding to each piece of sub information according to the length of each piece of sub information;
generating a second random number according to the privacy level corresponding to each piece of sub information;
acquiring the byte length of the second random number, and intercepting the second random number according to the byte length to obtain an intercepted second random number; the intercepted second random number is smaller than a random number threshold value, and the byte length in the intercepted second random number is smaller than the byte length in the second random number;
and determining the intercepted second random number as a first random number corresponding to each piece of sub information.
Optionally, the attribute information of each piece of sub information includes a generation time of each piece of sub information, and the information adjusting module 403 is specifically configured to:
coding the generation time of each piece of sub information to obtain coded time data;
generating a third random number according to the encoded time data;
filling the bytes in the third random number to obtain a filled third random number, wherein the filled third random number is smaller than a random number threshold;
and determining the third random number after the filling processing as the first random number corresponding to each piece of sub information.
Optionally, the information adjusting module 403 is specifically configured to:
performing remainder operation on each piece of sub information and the first random number to obtain each piece of remainder sub information;
and if the each piece of the redundant sub information is smaller than the information threshold, determining the each piece of the redundant sub information as each piece of the adjusted sub information.
Optionally, the target information includes first sub information and second sub information, and the generation time of the second sub information is later than the generation time of the first sub information; the key generation module 402 is specifically configured to:
coding the user information to obtain coded user data;
generating a fourth random number according to the encoded user data;
performing hash operation on the fourth random number to obtain the root key;
performing hash operation on the root key to obtain a key of the first sub-information;
and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
Optionally, the information encrypting module 405 is specifically configured to:
acquiring a private key of a terminal to which the target information belongs and a secret key corresponding to each piece of sub information, wherein the terminal to which the target information belongs is a terminal corresponding to an organization to which each piece of sub information belongs;
and encrypting the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the private key and the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information.
Optionally, the information encrypting module 405 is specifically configured to:
obtaining the coordinates of a base point of the curve of the objective function;
obtaining the product of the base point coordinate and the private key to obtain a candidate coordinate;
encrypting the candidate coordinate according to the key corresponding to each piece of sub information to obtain a ciphertext of the candidate coordinate;
and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
It should be noted that, for the content that is not mentioned in the embodiment corresponding to fig. 4, reference may be made to the description of the method embodiment, and details are not described here again.
According to an embodiment of the present application, the steps involved in an information processing method for generating a random number based on an attribute of information shown in fig. 1 may be performed by respective modules in an information processing apparatus for generating a random number based on an attribute of information shown in fig. 4. For example, step S101 shown in fig. 1 may be performed by the information acquisition module 401 in fig. 4, and step S102 shown in fig. 1 may be performed by the key generation module 402 in fig. 4; step S103 shown in fig. 1 may be performed by the information adjusting module 403 in fig. 4; step S104 shown in fig. 1 may be performed by the coordinate acquisition module 404 in fig. 4; step S105 shown in fig. 1 may be performed by the information encryption module 405 in fig. 4; step S106 shown in fig. 1 may be performed by the information storage module 406 in fig. 4. According to an embodiment of the present application, each module in the information processing for generating a random number based on the attribute of the information shown in fig. 4 may be respectively or completely combined into one or several units to form the unit, or some unit(s) may be further split into multiple sub-units with smaller functions, which may implement the same operation without affecting implementation of technical effects of the embodiment of the present application. The modules are divided based on logic functions, and in practical application, the functions of one module can be realized by a plurality of units, or the functions of a plurality of modules can be realized by one unit. In other embodiments of the present application, the information processing apparatus that generates the random number based on the attribute of the information may also include other units, and in practical applications, these functions may also be implemented with the assistance of other units, and may be implemented by cooperation of a plurality of units.
According to another embodiment of the present application, an information processing apparatus that generates a random number based on an attribute of information as shown in fig. 4 may be configured by running a computer program (including program code) capable of executing steps involved in the respective methods as shown in fig. 1, fig. 2, and fig. 3 on a general-purpose computer device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM), and a storage element, and an information processing method that generates a random number based on an attribute of information of an embodiment of the present application may be implemented. The computer program may be recorded on a computer-readable recording medium, for example, and loaded into and executed by the computing apparatus via the computer-readable recording medium.
In the embodiment of the application, because the first random number corresponding to each piece of sub information is generated according to the attribute information of each piece of sub information, and the attribute information of each piece of sub information includes the generation time of each piece of sub information or the length of each piece of sub information, it is difficult for an illegal terminal to acquire the generation time of each piece of sub information and the length of each piece of sub information, that is, the first random number corresponding to each piece of sub information cannot be generated, therefore, by adjusting each piece of sub information by using the first random number and subsequently encrypting the adjusted sub information, the security of information can be improved. By adjusting each piece of sub information in at least two pieces of sub information, the coordinate information corresponding to each piece of adjusted sub information can be generated according to each piece of adjusted sub information, and the success rate of obtaining the coordinate information corresponding to each piece of adjusted sub information is improved. By encrypting each piece of sub information in the target information, the illegal terminal is prevented from cracking the ciphertext, so that the safety of each piece of sub information is improved, and the safety of the target information is improved. The ciphertext information of the target information is stored in the block chain network, and the safety of the information can be improved based on the characteristic that the block chain cannot be tampered and is not easy to lose; in addition, the ciphertext of the target information is stored in the block chain network, so that the resource occupation of the local storage space of the terminal can be reduced.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure. As shown in fig. 5, the computer device 50 may include: the processor 501, the network interface 504 and the memory 505, and the computer device 50 may further include: a user interface 503, and at least one communication bus 502. Wherein a communication bus 502 is used to enable connective communication between these components. The user interface 503 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 503 may also include a standard wired interface and a standard wireless interface. The network interface 504 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 505 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The memory 505 may alternatively be at least one memory device located remotely from the processor 501. As shown in fig. 5, the memory 505, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 50 shown in fig. 5, the network interface 504 may provide network communication functions; while the user interface 503 is primarily an interface for providing input to a user; and processor 501 may be used to invoke a device control application stored in memory 505 to implement:
acquiring an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, wherein the target information comprises at least two pieces of sub information, and the attribute information of each piece of sub information comprises at least one of generation time of each piece of sub information and length of each piece of sub information;
generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key;
generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
acquiring coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the target function and each piece of adjusted sub information;
encrypting the coordinate information of the corresponding sub-information in the at least two pieces of sub-information by adopting the key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information;
and determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information, and storing the ciphertext of the target information into the block chain network.
It should be understood that the computer device 50 described in this embodiment may perform the description of the information processing method for generating the random number based on the information attribute in the embodiment corresponding to fig. 1 and fig. 2 and fig. 3, and may also perform the description of the information processing apparatus for generating the random number based on the information attribute in the embodiment corresponding to fig. 4, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.
In the embodiment of the application, because the first random number corresponding to each piece of sub information is generated according to the attribute information of each piece of sub information, and the attribute information of each piece of sub information includes the generation time of each piece of sub information or the length of each piece of sub information, it is difficult for an illegal terminal to acquire the generation time of each piece of sub information and the length of each piece of sub information, that is, the first random number corresponding to each piece of sub information cannot be generated, therefore, by adjusting each piece of sub information by using the first random number and subsequently encrypting the adjusted sub information, the security of information can be improved. By adjusting each piece of sub information in at least two pieces of sub information, the coordinate information corresponding to each piece of adjusted sub information can be generated according to each piece of adjusted sub information, and the success rate of obtaining the coordinate information corresponding to each piece of adjusted sub information is improved. By encrypting each piece of sub information in the target information, the illegal terminal is prevented from cracking the ciphertext, so that the safety of each piece of sub information is improved, and the safety of the target information is improved. The ciphertext information of the target information is stored in the block chain network, and the safety of the information can be improved based on the characteristic that the block chain cannot be tampered and is not easy to lose; in addition, the ciphertext of the target information is stored in the block chain network, so that the resource occupation of the local storage space of the terminal can be reduced.
Embodiments of the present application also provide a computer-readable storage medium storing a computer program, the computer program comprising program instructions, which, when executed by a computer, cause the computer to perform the method according to the foregoing embodiments, and the computer may be a part of the above-mentioned computer device. Such as processor 501 described above. By way of example, the program instructions may be executed on one computer device, or on multiple computer devices located at one site, or distributed across multiple sites and interconnected by a communication network, which may comprise a blockchain network.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.
Claims (10)
1. An information processing method for generating a random number based on an attribute of information, comprising:
acquiring an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, wherein the target information comprises at least two pieces of sub information, and the attribute information of each piece of sub information comprises at least one of generation time of each piece of sub information and length of each piece of sub information;
generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key;
generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
acquiring coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the target function and each piece of adjusted sub information;
encrypting the coordinate information of the corresponding sub-information in the at least two pieces of sub-information by adopting the key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information;
and determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information, and storing the ciphertext of the target information into a block chain network.
2. The method according to claim 1, wherein the attribute information of each piece of sub information includes a length of each piece of sub information, and the generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information includes:
determining the privacy level corresponding to each piece of sub-information according to the length of each piece of sub-information;
generating a second random number according to the privacy level corresponding to each piece of sub information;
acquiring the byte length of the second random number, and intercepting the second random number according to the byte length to obtain an intercepted second random number; the intercepted second random number is smaller than a random number threshold, and the byte length of the intercepted second random number is smaller than the byte length of the second random number;
and determining the intercepted second random number as a first random number corresponding to each piece of sub information.
3. The method according to claim 1, wherein the attribute information of each piece of sub information includes a generation time of each piece of sub information, and the generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information includes:
encoding the generation time of each piece of sub information to obtain encoded time data;
generating a third random number according to the encoded time data;
filling bytes in the third random number to obtain a filled third random number, wherein the filled third random number is smaller than a random number threshold;
and determining the filled third random number as the first random number corresponding to each piece of sub information.
4. The method of claim 1, wherein the adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information comprises:
performing a remainder operation on each piece of sub information and the first random number to obtain each piece of sub information after the remainder operation;
and if the each piece of the redundant sub information is smaller than the information threshold, determining the each piece of the redundant sub information as each piece of the adjusted sub information.
5. The method of claim 1, wherein the target information comprises a first sub-information and a second sub-information, and a generation time of the second sub-information is later than a generation time of the first sub-information;
the generating a root key corresponding to the target information according to the user information contained in the target information, and generating a key corresponding to each piece of sub information according to the root key includes:
coding the user information to obtain coded user data;
generating a fourth random number according to the coded user data;
performing hash operation on the fourth random number to obtain the root key;
performing hash operation on the root key to obtain a key of the first sub information;
and carrying out Hash operation on the key of the first sub-information to obtain the key of the second sub-information.
6. The method according to claim 1, wherein the encrypting the coordinate information of the corresponding sub information in the at least two pieces of sub information by using the key corresponding to each piece of sub information to obtain the ciphertext of the coordinate information corresponding to each piece of sub information comprises:
acquiring a private key of a terminal to which the target information belongs and a secret key corresponding to each piece of sub information;
and encrypting the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information according to the private key and the key corresponding to each piece of sub information to obtain a ciphertext of the coordinate information corresponding to each piece of sub information.
7. The method according to claim 6, wherein the encrypting, according to the private key and the key corresponding to each piece of sub information, the coordinate information corresponding to each piece of sub information in the at least two pieces of sub information to obtain a ciphertext of the coordinate information corresponding to each piece of sub information comprises:
obtaining the coordinates of a base point of a curve of the objective function;
obtaining a product of the base point coordinate and the private key to obtain a candidate coordinate;
encrypting the candidate coordinates according to the key corresponding to each piece of sub information to obtain a ciphertext of the candidate coordinates;
and fusing the coordinate information corresponding to each piece of sub information with the corresponding candidate coordinate ciphertext to obtain the coordinate information ciphertext corresponding to each piece of sub information.
8. An information processing apparatus that generates a random number based on an attribute of information, comprising:
the information acquisition module is used for acquiring an objective function used for describing information and attribute information of each piece of sub information in target information to be processed, wherein the target information comprises at least two pieces of sub information, and the attribute information of each piece of sub information comprises at least one of generation time of each piece of sub information and length of each piece of sub information;
the key generation module is used for generating a root key corresponding to the target information according to the user information contained in the target information and generating a key corresponding to each piece of sub information according to the root key;
the information adjusting module is used for generating a first random number corresponding to each piece of sub information according to the attribute information of each piece of sub information, and adjusting each piece of sub information according to the first random number to obtain each piece of adjusted sub information;
a coordinate obtaining module, configured to obtain, according to the target function and each piece of adjusted sub information, coordinate information corresponding to each piece of sub information in the at least two pieces of sub information;
the information encryption module is used for encrypting the coordinate information of the corresponding sub-information in the at least two pieces of sub-information by adopting the key corresponding to each piece of sub-information to obtain a ciphertext of the coordinate information corresponding to each piece of sub-information;
and the information storage module is used for determining the ciphertext of the coordinate information corresponding to each piece of sub information as the ciphertext of the target information and storing the ciphertext of the target information into the block chain network.
9. A computer device, comprising: a processor, a memory, and a network interface;
the processor is connected to the memory and the network interface, wherein the network interface is configured to provide data communication functions, the memory is configured to store program code, and the processor is configured to call the program code to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011056601.6A CN112202555B (en) | 2020-09-29 | 2020-09-29 | Information processing method, device and equipment for generating random number based on information attribute |
PCT/CN2021/097118 WO2022068235A1 (en) | 2020-09-29 | 2021-05-31 | Information processing method and apparatus for generating random number on the basis of attribute of information, and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011056601.6A CN112202555B (en) | 2020-09-29 | 2020-09-29 | Information processing method, device and equipment for generating random number based on information attribute |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112202555A true CN112202555A (en) | 2021-01-08 |
CN112202555B CN112202555B (en) | 2023-07-18 |
Family
ID=74007110
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011056601.6A Active CN112202555B (en) | 2020-09-29 | 2020-09-29 | Information processing method, device and equipment for generating random number based on information attribute |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112202555B (en) |
WO (1) | WO2022068235A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022068358A1 (en) * | 2020-09-29 | 2022-04-07 | 深圳壹账通智能科技有限公司 | Encryption method and apparatus for generating keys on basis of attributes of information, and device |
WO2022068235A1 (en) * | 2020-09-29 | 2022-04-07 | 平安科技(深圳)有限公司 | Information processing method and apparatus for generating random number on the basis of attribute of information, and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110570197A (en) * | 2019-09-17 | 2019-12-13 | 腾讯科技(深圳)有限公司 | Data processing method and device based on block chain |
CN110601815A (en) * | 2019-09-17 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Block chain data processing method and equipment |
CN110839026A (en) * | 2019-11-12 | 2020-02-25 | 深圳市网心科技有限公司 | Data processing method based on block chain and related equipment |
CN110881063A (en) * | 2019-11-20 | 2020-03-13 | 腾讯科技(深圳)有限公司 | Storage method, device, equipment and medium of private data |
CN110958317A (en) * | 2019-11-29 | 2020-04-03 | 腾讯科技(深圳)有限公司 | Data processing method and equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11206133B2 (en) * | 2017-12-08 | 2021-12-21 | Ping Identity Corporation | Methods and systems for recovering data using dynamic passwords |
CN111553686A (en) * | 2020-04-27 | 2020-08-18 | 腾讯科技(深圳)有限公司 | Data processing method and device, computer equipment and storage medium |
CN112202554B (en) * | 2020-09-29 | 2022-03-08 | 平安科技(深圳)有限公司 | Information processing method, device and equipment for generating key based on attribute of information |
CN112199697A (en) * | 2020-09-29 | 2021-01-08 | 深圳壹账通智能科技有限公司 | Information processing method, device, equipment and medium based on shared root key |
CN112202555B (en) * | 2020-09-29 | 2023-07-18 | 平安科技(深圳)有限公司 | Information processing method, device and equipment for generating random number based on information attribute |
-
2020
- 2020-09-29 CN CN202011056601.6A patent/CN112202555B/en active Active
-
2021
- 2021-05-31 WO PCT/CN2021/097118 patent/WO2022068235A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110570197A (en) * | 2019-09-17 | 2019-12-13 | 腾讯科技(深圳)有限公司 | Data processing method and device based on block chain |
CN110601815A (en) * | 2019-09-17 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Block chain data processing method and equipment |
CN110839026A (en) * | 2019-11-12 | 2020-02-25 | 深圳市网心科技有限公司 | Data processing method based on block chain and related equipment |
CN110881063A (en) * | 2019-11-20 | 2020-03-13 | 腾讯科技(深圳)有限公司 | Storage method, device, equipment and medium of private data |
CN110958317A (en) * | 2019-11-29 | 2020-04-03 | 腾讯科技(深圳)有限公司 | Data processing method and equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022068358A1 (en) * | 2020-09-29 | 2022-04-07 | 深圳壹账通智能科技有限公司 | Encryption method and apparatus for generating keys on basis of attributes of information, and device |
WO2022068235A1 (en) * | 2020-09-29 | 2022-04-07 | 平安科技(深圳)有限公司 | Information processing method and apparatus for generating random number on the basis of attribute of information, and device |
Also Published As
Publication number | Publication date |
---|---|
CN112202555B (en) | 2023-07-18 |
WO2022068235A1 (en) | 2022-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102151907B1 (en) | Blockchain data processing and storage in a trusted execution environment | |
CN112202554B (en) | Information processing method, device and equipment for generating key based on attribute of information | |
CN110915164A (en) | Intelligent contract operation processing blockchain data based on execution in trusted execution environment | |
CN112988764B (en) | Data storage method, device, equipment and storage medium | |
CN112910840A (en) | Medical data storage and sharing method and system based on alliance blockchain | |
WO2022068360A1 (en) | Shared root key-based information processing method and apparatus, and device and medium | |
CN112184444B (en) | Method, device, equipment and medium for processing information based on characteristics of information | |
CN112131227A (en) | Data query method and device based on alliance chain | |
WO2022068362A1 (en) | Block chain-based information processing method and apparatus, device, and medium | |
CN110661748A (en) | Log encryption method, log decryption method and log encryption device | |
CN112202779B (en) | Block chain based information encryption method, device, equipment and medium | |
CN111611621A (en) | Block chain based distributed data encryption storage method and electronic equipment | |
WO2022068358A1 (en) | Encryption method and apparatus for generating keys on basis of attributes of information, and device | |
CN112202555B (en) | Information processing method, device and equipment for generating random number based on information attribute | |
CN111404892B (en) | Data supervision method and device and server | |
US20150023498A1 (en) | Byzantine fault tolerance and threshold coin tossing | |
CN106888213B (en) | Cloud ciphertext access control method and system | |
CN112182109A (en) | Distributed data coding storage method based on block chain and electronic equipment | |
Yoosuf | Lightweight fog‐centric auditing scheme to verify integrity of IoT healthcare data in the cloud environment | |
WO2022068359A1 (en) | Encryption method and apparatus for compressing ciphertext of information, and device and medium | |
WO2022068234A1 (en) | Encryption method and apparatus based on shared root key, device and medium | |
CN111798236A (en) | Transaction data encryption and decryption method, device and equipment | |
CN112202453A (en) | Information processing method, device, equipment and medium for compressing ciphertext | |
WO2022068361A1 (en) | Encryption method and apparatus based on amendment amount, and device, and medium | |
CN114995949A (en) | Container mirror image construction method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |