Disclosure of Invention
The invention provides an ultraviolet power detection method, an ultraviolet power detection device and electronic equipment, and mainly aims to solve the problem of low safety during ultraviolet power detection due to lack of safety verification on personnel using an ultraviolet power detector.
In order to achieve the above object, the present invention provides a method for detecting ultraviolet power, comprising:
receiving an ultraviolet power detection instruction input by a user, and connecting to a block link point where the user is located according to the ultraviolet power detection instruction to obtain a user block node;
retrieving a block bound with the user block node to obtain a front block node and a rear block node, wherein a decryption private key is stored in the rear block node in advance;
respectively extracting a hash value pre-stored in the user block node and a hash value pre-stored in the front block node;
calculating to obtain a decryption public key according to the hash value of the user block node and the hash value of the front block node;
when the decryption private key is consistent with the decryption public key, extracting ultraviolet power encryption information prestored in the user block node;
and starting the ultraviolet power detector by using the ultraviolet power encryption information to realize the power detection of ultraviolet rays.
Optionally, connecting to a block where a user is located according to the ultraviolet power detection instruction to obtain a user block node, including:
analyzing the ultraviolet power detection instruction to obtain user port information and user personal information;
and searching a block chain node consistent with the user port information and the user personal information from the pre-constructed ultraviolet detection block chain, and connecting the block chain node to obtain the user block node.
Optionally, the pre-storing a decryption private key at the post-block node includes:
extracting corresponding user port information and user personal information from the user block node and the preposed block node respectively;
generating a data transmission statement corresponding to each user port information and the user personal information;
compiling the data transmission statement by using a compiler;
executing the compiled data transmission statement, and uploading each user port information and the user personal information to the post-block node;
when uploading is successful, hash operation is carried out on each user port information and the user personal information in the post-positioned block node, and a hash value corresponding to the user block node and a hash value corresponding to the pre-positioned block node are obtained respectively;
and combining the hash value of the user block node and the hash value of the front block node to obtain the decryption private key.
Optionally, the performing a hash operation on each piece of user port information and the user personal information to obtain a hash value corresponding to the user block node and a hash value corresponding to the pre-block node respectively includes:
constructing a private key empty list;
executing binary operation on each user port information and the user personal information to obtain binary user information, and storing the binary user information into the private key empty list to obtain a private key user list;
splitting the private key user list according to a preset number to obtain a plurality of groups of private key user branch lists;
respectively carrying out complementation and complementation on each group of private key user branch lists to obtain a plurality of groups of complementation user branch lists;
and adjusting each group of the surplus user branch lists to a preset length, connecting each group of the surplus user branch lists after the length is adjusted, and respectively obtaining a hash value corresponding to the user block node and a hash value corresponding to the preposed block node.
Optionally, the combining the hash value of the user block node and the hash value of the previous block node to obtain the decryption private key includes:
combining the hash value of the user block node and the hash value of the front block node according to a form of head connection to obtain a value to be encrypted;
and encrypting the value to be encrypted by using an MD5 algorithm to obtain the decryption private key.
Optionally, when the decryption private key is consistent with the decryption public key, the method further includes:
judging whether the decryption private key is consistent with the decryption public key;
and if the decryption private key is inconsistent with the decryption public key, generating a power detection failure result according to the ultraviolet power detection instruction and returning the power detection failure result to the user.
Optionally, the extracting the ultraviolet power encryption information pre-stored in the user block node includes:
the decryption private key is used as an extraction password for extracting the ultraviolet power encryption information;
accessing an encryption area of the user block node by using the extraction password;
and extracting the ultraviolet power encryption information from the encryption area.
In order to solve the above problems, the present invention also provides an ultraviolet power detecting apparatus, comprising:
the block node index module is used for receiving an ultraviolet power detection instruction input by a user, connecting to a block link point where the user is located according to the ultraviolet power detection instruction to obtain a user block node, and indexing a block bound with the user block node to obtain a front block node and a rear block node, wherein a decryption private key is stored in the rear block node in advance;
a hash value extraction module, configured to extract a hash value pre-stored in the user block node and a hash value pre-stored in the previous block node, respectively;
the decryption public key comparison module is used for calculating a decryption public key according to the hash value of the user block node and the hash value of the front block node, and extracting the ultraviolet power encryption information prestored in the user block node when the decryption private key is consistent with the decryption public key;
and the ultraviolet power detection module is used for starting the ultraviolet power detector by utilizing the ultraviolet power encrypted information to realize the power detection of ultraviolet rays.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to implement the ultraviolet power detection method described above.
Compared with the background technology, the embodiment of the invention comprises the following steps: for directly using an ultraviolet power detector to perform ultraviolet power detection, the embodiment of the present invention first receives an ultraviolet power detection instruction input by a user, connects to a block link point where the user is located according to the ultraviolet power detection instruction to obtain a user block node, and further determines whether a hash value in the user block node meets a power detection requirement, i.e., retrieves a block bound to the user block node to obtain a pre-block node and a post-block node, wherein a decryption private key is stored in the post-block node in advance, a decryption public key is obtained by extracting a hash value pre-stored in the user block node and a hash value pre-stored in the pre-block node and further combining the hash values, and whether the user is qualified to perform ultraviolet power detection is determined by determining consistency between the decryption private key and the decryption public key, therefore, the safety of ultraviolet power detection is improved, and when the decryption private key is inconsistent with the decryption public key, the risk that the user block node, the front block node or the rear block node where the user is located is tampered is shown, so that the user is not allowed to execute ultraviolet power detection. Therefore, the ultraviolet power detection method, the ultraviolet power detection device and the electronic equipment can solve the problem of low safety during ultraviolet power detection due to lack of safety verification on personnel using the ultraviolet power detector.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides an ultraviolet power detection method. The executing body of the ultraviolet power detection method includes, but is not limited to, at least one of electronic devices such as a server, a terminal and the like that can be configured to execute the method provided by the embodiments of the present application. In other words, the ultraviolet power detection method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a block chain platform. The server includes but is not limited to: the cloud server can be an independent server, or can be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Referring to fig. 1, a schematic flow chart of an ultraviolet power detection method according to an embodiment of the present invention is shown. In an embodiment of the present invention, the ultraviolet power detection method includes:
and S1, receiving an ultraviolet power detection command input by a user, and connecting to the block link point where the user is located according to the ultraviolet power detection command to obtain a user block node.
For example, zhang san is an environmental protection technician who needs to monitor the quality of local water quality by using ultraviolet rays at intervals to prevent environmental pollution caused by deterioration of water quality, and it should be explained that before monitoring the quality of local water quality by using ultraviolet rays, it needs to detect whether the power of emitted ultraviolet rays meets a preset safe power interval to prevent huge damage to residents and aquatic organisms caused by overhigh power of ultraviolet rays.
In order to improve the security in the embodiment of the present invention, when performing ultraviolet power detection, an ultraviolet power detection method is constructed based on a block chain principle, and in detail, the method connects to a block where a user is located according to the ultraviolet power detection instruction to obtain a user block node, including:
analyzing the ultraviolet power detection instruction to obtain user port information and user personal information;
and searching a block chain node consistent with the user port information and the user personal information from the pre-constructed ultraviolet detection block chain, and connecting the block chain node to obtain the user block node.
It should be noted that the user port information includes information such as a port IP address and a port number of a client where the user is located, and the user personal information includes information such as a user name, a user password, and a user secret key when the user registers.
It should be further explained that the uv detection block chain is a pre-constructed block chain system, and the main purpose is to improve the safety of using uv to prevent the abuse of uv from causing environmental pollution, social injury, etc. And the ultraviolet detection block chain comprises a plurality of block chain nodes, and each block chain node is directly or indirectly bound with each other. Each block link node may be located in different areas in reality, and the user port information and the user personal information where the block link node is located are uniquely identified, so that the corresponding block link node, that is, the user block node, can be obtained by indexing through the user port information and the user personal information.
Illustratively, port information and personal information of Zhang III are obtained through corresponding analysis of an ultraviolet power detection instruction sent by Zhang III of environmental protection personnel, and then a corresponding user block node is found according to the port information and the personal information of Zhang III.
And S2, indexing the block bound with the user block node to obtain a front block node and a rear block node, wherein the rear block node stores a decryption private key in advance.
It should be appreciated that the ultraviolet detection block chain is constructed in units of block chain nodes, and each block chain node is connected to each other in tandem, so it is conceivable that each other block chain node includes, in addition to the head and tail block chain node, a block chain link point connected in tandem therewith, so that the leading block node and the trailing block node can be directly indexed according to the tandem relationship of the user block nodes.
It should be explained that, in order to facilitate the comparison between the subsequent decryption private key and the decryption public key, the decryption private key has been stored in the post-block node in advance, and in detail, referring to fig. 2, the step of storing the decryption private key in advance in the post-block node includes:
s20, extracting corresponding user port information and user personal information from the user block node and the preposed block node respectively;
s21, generating data transmission sentences corresponding to the user port information and the user personal information;
according to one embodiment of the invention, the data transmission statement can be generated according to java grammar rules, and in the process of generating the data transmission statement, keywords in the user port information and the user personal information can be extracted and added into the data transmission statement.
S22, compiling the data transmission statement by using a compiler;
it is to be construed that the compiler includes, but is not limited to, visual c + +.
S23, executing the compiled data transmission statement, and uploading each user port information and the user personal information to the post-block node;
s24, when uploading is successful, in the post block node, performing hash operation on each user port information and the user personal information to respectively obtain a hash value corresponding to the user block node and a hash value corresponding to the pre block node;
in detail, the performing a hash operation on each of the user port information and the user personal information to obtain a hash value corresponding to the user block node and a hash value corresponding to the pre-block node respectively includes:
constructing a private key empty list;
executing binary operation on each user port information and the user personal information to obtain binary user information, and storing the binary user information into the private key empty list to obtain a private key user list;
splitting the private key user list according to a preset number to obtain a plurality of groups of private key user branch lists;
respectively carrying out complementation and complementation on each group of private key user branch lists to obtain a plurality of groups of complementation user branch lists;
and adjusting each group of the surplus user branch lists to a preset length, connecting each group of the surplus user branch lists after the length is adjusted, and respectively obtaining a hash value corresponding to the user block node and a hash value corresponding to the preposed block node.
It should be explained that the preset number can be set to 4, 6, 8, etc., the preset length can be set to 128-bits, 512-bits, etc., and then the obtained branch lists of the remaining users of each group are connected to obtain the decryption private key according to an end-to-end form.
And S25, combining the hash value of the user block node and the hash value of the front block node to obtain the decryption private key.
In detail, the combining the hash value of the user block node and the hash value of the previous block node to obtain the decryption private key includes:
combining the hash value of the user block node and the hash value of the front block node according to a form of head connection to obtain a value to be encrypted;
and encrypting the value to be encrypted by using an MD5 algorithm to obtain the decryption private key.
In another embodiment of the present invention, the method of SHA-1 (Secure Hash Algorithm 1), double Hash, etc. may be used to directly encrypt the user port information and the user personal information, so as to obtain the decryption private key, which is not described herein again.
S3, respectively extracting a hash value pre-stored in the user block node and a hash value pre-stored in the front block node;
what is further described in connection with S2 is that each block chain node in the ultraviolet detection block chain is connected to another block chain node in a tandem manner, and each block chain node stores a hash value, where the hash value is constructed according to the user port information and the user personal information of each block chain node.
For example, the block chain node a is connected to the block link point B and the block link point C in the following order: the block chain node B, the block chain node A and the block chain link point C, further, a hash value a is stored in the block chain link point A, the hash value a is according to the user port information and the user personal information corresponding to the block chain node A, a hash value B is stored in the block chain node B, and the hash value B is according to the user port information and the user personal information corresponding to the block chain node B.
And S4, calculating to obtain a decryption public key according to the hash value of the user block node and the hash value of the front block node.
It should be emphasized that the way of calculating the decryption public key is consistent with the above S25, i.e. obtained by using a combination method, and is not described herein again.
And S5, when the decryption private key is consistent with the decryption public key, extracting the ultraviolet power encryption information pre-stored in the user block node.
It should be emphasized that, when the decryption private key is consistent with the decryption public key, the method further includes:
judging whether the decryption private key is consistent with the decryption public key;
and if the decryption private key is inconsistent with the decryption public key, generating a power detection failure result according to the ultraviolet power detection instruction and returning the power detection failure result to the user.
It should be explained that when the decryption private key is inconsistent with the decryption public key, it indicates that the hash value of one or more of the user block node, the pre-block node and the post-block node or the decryption private key is tampered with, which may cause a potential safety hazard, and therefore, the user cannot be allowed to perform the ultraviolet power detection, and a power detection failure result is generated and returned to the user.
Further, when the decryption private key is consistent with the decryption public key, extracting the ultraviolet power encryption information pre-stored in the user block node, in detail, referring to fig. 3, the extracting the ultraviolet power encryption information pre-stored in the user block node includes:
s50, taking the decryption private key as an extraction password for extracting the ultraviolet power encryption information;
s51, accessing the encryption area of the user block node by using the extraction password;
and S52, extracting the ultraviolet power encryption information from the encryption area.
It should be explained that the ultraviolet power encryption information is prestored in the user block node, where the ultraviolet power encryption information is a key for starting the ultraviolet power detector, and only when the decryption private key is consistent with the decryption public key, the user block node has the authority to extract the ultraviolet power encryption information, and the user block node starts the ultraviolet power detector by using the ultraviolet power encryption information.
And S6, starting the ultraviolet power detector by using the ultraviolet power encryption information to realize ultraviolet power detection.
It should be understood that the uv power encryption information is stored in both the user block node and the uv power detector, and only when the user obtains the uv power encryption information from the user block node and performs comparison with the uv power encryption information in the uv power detector, and the comparison is the same, the uv power detector can be started to implement the power detection of the uv.
Compared with the background technology, the embodiment of the invention comprises the following steps: for directly using an ultraviolet power detector to perform ultraviolet power detection, the embodiment of the present invention first receives an ultraviolet power detection instruction input by a user, connects to a block link point where the user is located according to the ultraviolet power detection instruction to obtain a user block node, and further determines whether a hash value in the user block node meets a power detection requirement, i.e., retrieves a block bound to the user block node to obtain a pre-block node and a post-block node, wherein a decryption private key is stored in the post-block node in advance, a decryption public key is obtained by extracting a hash value pre-stored in the user block node and a hash value pre-stored in the pre-block node and further combining the hash values, and whether the user is qualified to perform ultraviolet power detection is determined by determining consistency between the decryption private key and the decryption public key, therefore, the safety of ultraviolet power detection is improved, and when the decryption private key is inconsistent with the decryption public key, the risk that the user block node, the front block node or the rear block node where the user is located is tampered is shown, so that the user is not allowed to execute ultraviolet power detection. Therefore, the ultraviolet power detection method, the ultraviolet power detection device and the electronic equipment can solve the problem of low safety during ultraviolet power detection due to lack of safety verification on personnel using the ultraviolet power detector.
FIG. 4 is a functional block diagram of the ultraviolet power detector of the present invention.
The ultraviolet power detection device 100 of the present invention may be installed in an electronic apparatus. According to the implemented functions, the ultraviolet power detection apparatus may include a block node indexing module 101, a hash value extraction module 102, a decryption public key comparison module 103, and an ultraviolet power detection module 104. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the block node indexing module 101 is configured to receive an ultraviolet power detection instruction input by a user, connect to a block link point where the user is located according to the ultraviolet power detection instruction, obtain a user block node, retrieve a block bound to the user block node, and obtain a front block node and a rear block node, where a decryption private key is stored in the rear block node in advance;
the hash value extraction module 102 is configured to extract a hash value pre-stored in the user block node and a hash value pre-stored in the previous block node respectively;
the decryption public key comparison module 103 is configured to calculate a decryption public key according to the hash value of the user block node and the hash value of the pre-located block node, and extract the ultraviolet power encryption information pre-stored in the user block node when the decryption private key is consistent with the decryption public key;
the ultraviolet power detection module 104 is configured to start an ultraviolet power detector by using the ultraviolet power encryption information, so as to implement power detection on ultraviolet light.
In detail, when the modules in the ultraviolet power detection apparatus 100 according to the embodiment of the present invention are used, the same technical means as the ultraviolet power detection method described in fig. 1 above are adopted, and the same technical effects can be produced, and no further description is provided here.
Fig. 5 is a schematic structural diagram of an electronic device 1 for implementing the ultraviolet power detection method according to the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as an ultraviolet power detection program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device 1, connects various components of the electronic device 1 by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, executing an ultraviolet power detection program and the like) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of an ultraviolet power detection program, but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device 1 and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices 1. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
Fig. 5 shows only the electronic device 1 with components, and it will be understood by those skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The ultraviolet power detection program stored in the memory 11 of the electronic device 1 is a combination of a plurality of computer programs, which when executed in the processor 10, can implement:
receiving an ultraviolet power detection instruction input by a user, and connecting to a block link point where the user is located according to the ultraviolet power detection instruction to obtain a user block node;
retrieving a block bound with the user block node to obtain a front block node and a rear block node, wherein a decryption private key is stored in the rear block node in advance;
respectively extracting a hash value pre-stored in the user block node and a hash value pre-stored in the front block node;
calculating to obtain a decryption public key according to the hash value of the user block node and the hash value of the front block node;
when the decryption private key is consistent with the decryption public key, extracting ultraviolet power encryption information prestored in the user block node;
and starting the ultraviolet power detector by using the ultraviolet power encryption information to realize the power detection of ultraviolet rays.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.