[go: up one dir, main page]

CN113468585B - Encryption method, device and storage medium based on energy key table - Google Patents

Encryption method, device and storage medium based on energy key table Download PDF

Info

Publication number
CN113468585B
CN113468585B CN202111025654.6A CN202111025654A CN113468585B CN 113468585 B CN113468585 B CN 113468585B CN 202111025654 A CN202111025654 A CN 202111025654A CN 113468585 B CN113468585 B CN 113468585B
Authority
CN
China
Prior art keywords
energy
encrypted
value
information
data
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.)
Active
Application number
CN202111025654.6A
Other languages
Chinese (zh)
Other versions
CN113468585A (en
Inventor
郑斌
胡若云
裘炜浩
严华江
张旭
方舟
谷泓杰
汪一帆
唐迪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Zhejiang Electric Power Co Ltd
Marketing Service Center of State Grid Zhejiang Electric Power Co Ltd
Original Assignee
State Grid Zhejiang Electric Power Co Ltd
Marketing Service Center of State Grid Zhejiang Electric Power Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by State Grid Zhejiang Electric Power Co Ltd, Marketing Service Center of State Grid Zhejiang Electric Power Co Ltd filed Critical State Grid Zhejiang Electric Power Co Ltd
Priority to CN202111025654.6A priority Critical patent/CN113468585B/en
Publication of CN113468585A publication Critical patent/CN113468585A/en
Application granted granted Critical
Publication of CN113468585B publication Critical patent/CN113468585B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention provides an encryption method, an encryption device and a storage medium based on an energy key table, wherein the encryption method comprises the following steps: acquiring a plurality of to-be-encrypted energy data with a time sequence, wherein the to-be-encrypted energy data at least comprises to-be-encrypted energy information and to-be-encrypted energy marks; generating a time sequence table based on the time sequence and the energy mark to be encrypted, extracting a binary code of the time sequence table, and calculating a first hash value of the binary code of the time sequence table based on a hash algorithm; calculating according to the data quantity value of the energy information to be encrypted to obtain a multi-dimensional key; the method comprises the steps of encrypting corresponding energy information to be encrypted based on a multi-dimensional key to obtain encrypted energy information, generating an energy key table according to a plurality of multi-dimensional keys, generating energy data to be transmitted according to a plurality of encrypted energy information, and sending the energy key table and the energy data to be transmitted. The technical scheme provided by the invention has higher safety guarantee while sensitive electric power and energy data can be efficiently transmitted on line.

Description

基于能源密匙表的加密方法、装置及存储介质Encryption method, device and storage medium based on energy key table

技术领域technical field

本发明涉及数据传输技术领域,尤其涉及一种基于能源密匙表的加密方法、装置及存储介质。The present invention relates to the technical field of data transmission, and in particular, to an encryption method, device and storage medium based on an energy key table.

背景技术Background technique

随着电力系统的不断发展,电力系统在构建、日常运行和管理过程中会产生大量的电力数据。由于这些电力数据中包含有大量的保密信息,当其它终端需要电力数据时,管理人员采用大容量的存储介质(例如硬盘等)对产生的电力数据进行存储后,然后将存储介质中的电力数据拷贝到该终端,以避免其他人对电力数据的非法访问和盗取。With the continuous development of the power system, a large amount of power data will be generated during the construction, daily operation and management of the power system. Since these power data contain a large amount of confidential information, when other terminals need power data, managers use a large-capacity storage medium (such as a hard disk, etc.) to store the generated power data, and then store the power data in the storage medium. Copy to this terminal to avoid illegal access and theft of power data by others.

但是随着电力数据数量的日益庞大,管理人员需要先将数量较大的电力数据拷贝到存储介质,然后需要再将存储介质中的电力数据拷贝到其它终端,大大增加了终端获取到电力数据的时间,传输效率低。因此,现有技术中通过人工利用存储介质传输电力数据的方式存在传输效率低的问题。However, with the increasing amount of power data, managers need to copy a large amount of power data to the storage medium first, and then need to copy the power data in the storage medium to other terminals, which greatly increases the amount of power data obtained by the terminal. time, the transmission efficiency is low. Therefore, in the prior art, there is a problem of low transmission efficiency in the way of manually using a storage medium to transmit power data.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种基于能源密匙表的加密方法、装置及存储介质,能够对敏感的电力、能源数据进行有效加密,使得敏感的电力、能源数据能够在线上高效传输的同时,具有较高安全保障。Embodiments of the present invention provide an encryption method, device, and storage medium based on an energy key table, which can effectively encrypt sensitive power and energy data, so that sensitive power and energy data can be efficiently transmitted online, and at the same time, it has a relatively high efficiency. High security.

本发明实施例的第一方面,提供一种基于能源密匙表的加密方法,包括:A first aspect of the embodiments of the present invention provides an encryption method based on an energy key table, including:

获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记;Acquiring a plurality of energy data to be encrypted with time series, the energy data to be encrypted at least includes energy information to be encrypted and energy label to be encrypted;

基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值;Generate a time series table based on the time series and the energy label to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm;

根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,Calculate the multidimensional key according to the data volume value of the energy information to be encrypted, and calculate the multidimensional key of each energy data to be encrypted with time series by the following formula:

Figure 870770DEST_PATH_IMAGE001
Figure 870770DEST_PATH_IMAGE001

其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 为先前时刻计算的第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值;Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value, and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted calculated at the previous moment, S is the data volume value, and L is the normalized value;

基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。Encrypting the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generating an energy key table according to a plurality of multi-dimensional keys, generating energy data to be transmitted according to a plurality of encrypted energy information, and converting the energy key Table and energy data to be transmitted are sent.

可选地,在第一方面的一种可能实现方式中,通过以下公式计算先前时刻第d个待加密能源数据的多维密匙的权重,包括:Optionally, in a possible implementation manner of the first aspect, the weight of the multi-dimensional key of the d -th energy data to be encrypted at the previous moment is calculated by the following formula, including:

Figure 584648DEST_PATH_IMAGE002
Figure 584648DEST_PATH_IMAGE002

其中,

Figure 397008DEST_PATH_IMAGE003
是以计算K d 的时刻为基准,先前第一个时刻的待加密能源信息的数据量 值;
Figure 526638DEST_PATH_IMAGE004
是以计算K d 的时刻为基准,先前第二个时刻的待加密能源信息的数据量值;
Figure 872169DEST_PATH_IMAGE005
是以 计算K d 的时刻为基准,先前第三个时刻的待加密能源信息的数据量值,A为先前第一个时刻 的待加密能源信息的数据量值的权重值,B为先前第二个时刻的待加密能源信息的数据量 值的权重值,C为先前第二个时刻的待加密能源信息的数据量值的权重值。 in,
Figure 397008DEST_PATH_IMAGE003
is the data volume value of the energy information to be encrypted at the first previous moment based on the moment when K d is calculated;
Figure 526638DEST_PATH_IMAGE004
is the data volume value of the energy information to be encrypted at the second previous moment based on the moment when K d is calculated;
Figure 872169DEST_PATH_IMAGE005
Based on the moment of calculating K d , the data volume value of the energy information to be encrypted at the third previous moment, A is the weight value of the data volume value of the energy information to be encrypted at the previous first moment, B is the previous second The weight value of the data amount value of the energy information to be encrypted at one time, C is the weight value of the data amount value of the energy information to be encrypted at the second previous time.

可选地,在第一方面的一种可能实现方式中,获取多个具有时间序列的待加密能源数据包括:Optionally, in a possible implementation manner of the first aspect, acquiring a plurality of time series energy data to be encrypted includes:

接收选定信息,所述选定信息至少包括目标时间段信息和目标能源信息;receiving selected information, the selected information including at least target time period information and target energy information;

基于所述目标能源信息在多个类别的待加密能源数据选定相应的持续时间序列的待加密能源数据;Based on the target energy information, the energy data to be encrypted corresponding to the time series to be encrypted is selected in the plurality of categories of energy data to be encrypted;

基于所述目标时间段信息在所述待加密能源数据选定一段的时间序列的待加密能源数据。Based on the target time period information, a period of time series energy data to be encrypted is selected in the energy data to be encrypted.

可选地,在第一方面的一种可能实现方式中,基于所述时间序列和待加密能源标记生成时间序列表包括:Optionally, in a possible implementation manner of the first aspect, generating a time series table based on the time series and the energy label to be encrypted includes:

获取时间序列中的每个时刻值;Get each moment value in the time series;

提取时刻值中的年、月及日信息按照第一预设方式转换,使其成为第一数量信息;The year, month and day information in the extracted time value is converted according to the first preset method, so that it becomes the first quantity information;

提取时刻值中的时、分及秒信息按照第二预设方式转换,使其成为第二数量信息;Converting the hour, minute and second information in the extracted time value according to the second preset method to make it become the second quantity information;

基于所述第一数量信息和第二数量信息生成量化后的时刻值;generating a quantized time value based on the first quantity information and the second quantity information;

将量化后的时刻值与对应的待加密能源标记生成时间序列表。A time series table is generated by combining the quantized time value and the corresponding energy mark to be encrypted.

可选地,在第一方面的一种可能实现方式中,将量化后的时刻值与对应的待加密能源标记生成时间序列表包括:Optionally, in a possible implementation manner of the first aspect, generating a time series table from the quantized time value and the corresponding energy mark to be encrypted includes:

对所述待加密能源标记基于预设对应关系量化处理,得到量化后的待加密能源标记,其中所述预设对应关系为待加密能源标记与待加密能源标记的量化值之间的对应关系;quantifying the energy label to be encrypted based on a preset correspondence relationship to obtain a quantized energy label to be encrypted, wherein the preset correspondence relationship is the correspondence between the energy label to be encrypted and the quantized value of the energy label to be encrypted;

将量化后的时刻值与量化后的能源标记组合成为数量值后生成时间序列表。A time series table is generated by combining the quantized time value and the quantized energy label into a quantity value.

可选地,在第一方面的一种可能实现方式中,基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息包括:Optionally, in a possible implementation manner of the first aspect, encrypting the corresponding energy information to be encrypted to obtain encrypted energy information based on the multi-dimensional key includes:

将多维密匙添加至预先设置的通用压缩路径中生成加密压缩路径;Add the multi-dimensional key to the preset general compression path to generate an encrypted compression path;

根据所述加密压缩路径生成反向的解密解压路径,所述解密解压路径响应于所述多维密匙进行解压缩处理;A reverse decryption and decompression path is generated according to the encryption and compression path, and the decryption and decompression path performs decompression processing in response to the multi-dimensional key;

基于所述加密压缩路径对所述待加密能源信息加密处理得到加密能源信息。The encrypted energy information is obtained by encrypting the energy information to be encrypted based on the encryption compression path.

可选地,在第一方面的一种可能实现方式中,还包括:Optionally, in a possible implementation manner of the first aspect, it further includes:

在所述解密解压路径中设置损毁逻辑;setting damage logic in the decryption and decompression path;

当解密解压路径接收到的多维密匙错误次数超过预设值时,基于所述损毁逻辑将加密能源信息按照预设损毁逻辑损毁。When the number of multi-dimensional key errors received by the decryption and decompression path exceeds a preset value, the encrypted energy information is destroyed according to the preset destruction logic based on the destruction logic.

可选地,在第一方面的一种可能实现方式中,其中,错误次数的预设值为3。Optionally, in a possible implementation manner of the first aspect, the preset value of the number of errors is 3.

本发明实施例的第二方面,提供一种基于能源密匙表的加密装置,包括:A second aspect of the embodiments of the present invention provides an encryption device based on an energy key table, including:

获取模块,用于获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记;an acquisition module, configured to acquire a plurality of energy data to be encrypted with time series, the energy data to be encrypted at least include energy information to be encrypted and energy labels to be encrypted;

生成模块,用于基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值;a generating module, configured to generate a time series table based on the time series and the energy label to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm;

计算模块,用于根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,The calculation module is used to calculate the multi-dimensional key according to the data volume value of the energy information to be encrypted, and calculate the multi-dimensional key of each energy data to be encrypted with time series by the following formula,

Figure 491369DEST_PATH_IMAGE001
Figure 491369DEST_PATH_IMAGE001

其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 为先前时刻计算的第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值;Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value, and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted calculated at the previous moment, S is the data volume value, and L is the normalized value;

加密模块,用于基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。The encryption module is used to encrypt and process the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generate an energy key table according to a plurality of multi-dimensional keys, generate energy data to be transmitted according to a plurality of encrypted energy information, and The energy key table and the energy data to be transmitted are sent.

本发明实施例的第三方面,提供一种存储介质,所述存储介质中存储有计算机程序,所述计算机程序被处理器执行时用于实现本发明第一方面及第一方面各种可能设计的所述方法。A third aspect of the embodiments of the present invention provides a storage medium, where a computer program is stored in the storage medium, and the computer program is used to implement the first aspect of the present invention and various possible designs of the first aspect when the computer program is executed by a processor. of the method.

本发明提供的一种基于能源密匙表的加密方法、装置及存储介质,能够根据时间序列中能源的采集时间、能源信息的数据量值等多个维度得到相应的多维密匙,该种多维密匙的生成方式使得每个能源数据在加密、解密过程中都只具有唯一的多维密匙,保障了待传输能源数据在传输过程中的秘密性。解决了敏感的电力数据、能源数据传输过程中不安全的问题。The present invention provides an encryption method, device and storage medium based on an energy key table, which can obtain a corresponding multi-dimensional key according to multiple dimensions such as the collection time of energy in the time series, the data amount of energy information, and the like. The key is generated so that each energy data has only a unique multi-dimensional key in the process of encryption and decryption, which ensures the confidentiality of the energy data to be transmitted during the transmission process. It solves the problem of insecurity in the transmission of sensitive power data and energy data.

本发明的技术方案,在计算多维密匙时,会通过哈希算法对时间序列表进行处理,使得本发明得到的多维密匙的长度具有相似,不会因为每次传输的数据量的变化较多而使得多维密匙的长度变化幅度较高,使得多维密匙在长度上具有一定的一致性。In the technical scheme of the present invention, when calculating the multi-dimensional key, the time series table will be processed by the hash algorithm, so that the length of the multi-dimensional key obtained by the present invention is similar, and the length of the multi-dimensional key obtained by the present invention will not be relatively large due to the change of the amount of data transmitted each time. The length of the multi-dimensional key has a high variation range, so that the multi-dimensional key has a certain consistency in length.

本发明会对时间序列表中的数据进行量化处理,使得时间序列表中的数据能够快速转换为二进制代码,提高了本发明的数据处理效率。并且,量化后的数据也是具有唯一性的,使得本发明中每次电力数据、能源数据、能源信息的传输过程中都不会是同一个多维密匙,安全性较高,不易破解。The present invention quantifies the data in the time series table, so that the data in the time series table can be quickly converted into binary codes, thereby improving the data processing efficiency of the present invention. In addition, the quantized data is also unique, so that each transmission process of power data, energy data, and energy information in the present invention will not be the same multi-dimensional key, which has high security and is not easy to crack.

附图说明Description of drawings

图1为基于能源密匙表的加密方法的流程图;Fig. 1 is the flow chart of the encryption method based on energy key table;

图2为基于能源密匙表的加密装置的结构图。FIG. 2 is a structural diagram of an encryption device based on an energy key table.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments It is only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to Describe a particular order or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein.

应当理解,在本发明的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present invention, the size of the sequence numbers of each process does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be used in the embodiments of the present invention. Implementation constitutes any limitation.

应当理解,在本发明中,“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be understood that in the present invention, "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to Those steps or elements that are expressly listed may instead include other steps or elements that are not expressly listed or are inherent to the process, method, product or apparatus.

应当理解,在本发明中,“多个”是指两个或两个以上。“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。“包含A、B和C”、“包含A、B、C”是指A、B、C三者都包含,“包含A、B或C”是指包含A、B、C三者之一,“包含A、B和/或C”是指包含A、B、C三者中任1个或任2个或3个。It should be understood that, in the present invention, "plurality" refers to two or more. "And/or" is just an association relationship that describes an associated object, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. Happening. The character "/" generally indicates that the associated objects are an "or" relationship. "Contains A, B and C", "contains A, B, C" means that A, B, and C are all contained, "contains A, B or C" means that one of A, B, and C is contained, "Comprising A, B and/or C" means including any one or any two or three of A, B, and C.

应当理解,在本发明中,“与A对应的B”、“与A相对应的B”、“A与B相对应”或者“B与A相对应”,表示B与A相关联,根据A可以确定B。根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其他信息确定B。A与B的匹配,是A与B的相似度大于或等于预设的阈值。It should be understood that in the present invention, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A, according to A B can be determined. Determining B based on A does not mean determining B based only on A, but also determining B based on A and/or other information. The matching between A and B means that the similarity between A and B is greater than or equal to a preset threshold.

取决于语境,如在此所使用的“若”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。"If" as used herein may be interpreted as "at" or "when" or "in response to determining" or "in response to detecting," depending on the context.

下面以具体地实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solutions of the present invention will be described in detail below with specific examples. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

本发明提供一种基于能源密匙表的加密方法,如图1所示,包括:The present invention provides an encryption method based on an energy key table, as shown in Figure 1, comprising:

步骤S110、获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记。本发明中的待加密能源数据可以是市电能、太阳能、风能、核能、水能、热能等等,也可以是市电能、太阳能、风能、核能、水能、热能分别包括的电压、电流以及电功率等等,对于待加密能源数据的形式本发明不做任何限定。待加密能源信息可以是数量值,例如说市电能的数量值、电压值、电流值等等。待加密能源标记可以相对应能源类型的名称,例如所加密能源信息为核能,则加密能源标记则对应核能的名称,以此类推。Step S110: Acquire a plurality of energy data to be encrypted in time series, the energy data to be encrypted at least include energy information to be encrypted and energy labels to be encrypted. The energy data to be encrypted in the present invention can be municipal electric energy, solar energy, wind energy, nuclear energy, water energy, thermal energy, etc., or can be the voltage, current, and electric power respectively included in municipal electric energy, solar energy, wind energy, nuclear energy, water energy, and thermal energy. etc., the present invention does not make any limitation on the form of the energy data to be encrypted. The energy information to be encrypted may be a quantitative value, for example, the quantitative value, voltage value, current value, etc. of the utility power. The energy label to be encrypted may correspond to the name of the energy type. For example, the encrypted energy information is nuclear energy, and the encrypted energy label corresponds to the name of nuclear energy, and so on.

本发明中的时间序列可以看做是一个时间轴,该时间轴可以是与自然时间同步,在时间序列中会包括多个时刻,每个时刻可能会具有不同的加密能源信息,该加密能源信息可以是该时刻前的相应能源使用量的和。The time series in the present invention can be regarded as a time axis, and the time axis can be synchronized with the natural time. The time series may include multiple moments, and each moment may have different encrypted energy information. The encrypted energy information Can be the sum of the corresponding energy usage up to that moment.

步骤S120、基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值。其中,本发明中的哈希算法能够将任意长度的二进制值映射为较短的固定长度的二进制值,这个小的二进制值称为本申请中的第一哈希值。第一哈希值是一段数据唯一且极其紧凑的数值表示形式。通过以上方式可以对时间序列表的数据量进行压缩处理,使得后续生成的多维密匙数据量较少。Step S120: Generate a time series table based on the time series and the energy mark to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm. Wherein, the hash algorithm in the present invention can map a binary value of any length into a shorter binary value of fixed length, and this small binary value is called the first hash value in this application. The first hash value is a unique and extremely compact numerical representation of a piece of data. In the above manner, the data volume of the time series table can be compressed, so that the subsequent generated multi-dimensional key data volume is small.

步骤S130、根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,Step S130: Calculate according to the data volume value of the energy information to be encrypted to obtain a multi-dimensional key, and calculate the multi-dimensional key of each energy data to be encrypted with a time series by the following formula,

Figure 289561DEST_PATH_IMAGE001
Figure 289561DEST_PATH_IMAGE001

其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 为先前时刻计算的第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值。Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value, and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted calculated at the previous moment, S is the data volume value, and L is the normalized value.

本发明在计算多维密匙时,会充分考虑时间序列的时刻、第一哈希值以及先前每 个待加密能源数据的多维密匙。以上方案,使得即使两个时刻所获取的待加密能源数据相 同,也会因为时间维度的改变而造成多维密匙不同。即每个时刻的

Figure 222882DEST_PATH_IMAGE006
值都是 不同的。数据量值即为数据量,单位可以是字节、千字节、兆字节等等。归一化值可以是预先 设置的,例如说100、1000等等,用于将多维密匙的数字值降低,方便后续的计算。 When calculating the multi-dimensional key, the present invention will fully consider the moment of the time series, the first hash value and the multi-dimensional key of each previous energy data to be encrypted. The above scheme makes the multi-dimensional keys different due to the change of the time dimension even if the energy data to be encrypted obtained at two times are the same. that every moment
Figure 222882DEST_PATH_IMAGE006
The values are all different. The data volume value is the data volume, and the unit can be bytes, kilobytes, megabytes, and so on. The normalized value may be preset, such as 100, 1000, etc., for reducing the digital value of the multi-dimensional key to facilitate subsequent calculations.

步骤S140、基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。由于管理员以此可能需要多个维度的能源数据、加密能源信息,所以会对应多个多维密匙,本发明会对多个多维密匙进行统计得到能源密匙表,方便对多维密匙的保存。Step S140, encrypting the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generating an energy key table according to a plurality of multi-dimensional keys, generating energy data to be transmitted according to a plurality of encrypted energy information, The energy key table and the energy data to be transmitted are sent. Because the administrator may need energy data and encrypted energy information in multiple dimensions, it will correspond to multiple multi-dimensional keys. save.

本发明在得到多维密匙后会根据多维密匙对相应的待加密能源信息进行加密处理,每个待加密能源信息与相应的多维密匙一一对应设置。根据多维密匙对待加密能源信息加密处理后得到相应的加密能源信息,此时的加密能源信息已经被加密处理。由于多维密匙可能具有多个,所以本发明会根据多个多维密匙得到能源密匙表,通过能源密匙表实现对多个迷失的存储,方便管理员管理。本发明在得到能源密匙表和待传输能源数据后,可以对能源密匙表和待传输能源数据进行异步发送,防止能源密匙表和待传输能源数据同时被他人窃取而造成秘密泄露的情况。After obtaining the multi-dimensional key, the present invention performs encryption processing on the corresponding energy information to be encrypted according to the multi-dimensional key, and each energy information to be encrypted is set in a one-to-one correspondence with the corresponding multi-dimensional key. Corresponding encrypted energy information is obtained after the encrypted energy information is encrypted according to the multi-dimensional key, and the encrypted energy information at this time has been encrypted. Since there may be multiple multi-dimensional keys, the present invention obtains the energy key table according to the plurality of multi-dimensional keys, and realizes the storage of multiple lost keys through the energy key table, which is convenient for administrators to manage. After obtaining the energy key table and the energy data to be transmitted, the invention can asynchronously send the energy key table and the energy data to be transmitted, so as to prevent the situation that the energy key table and the energy data to be transmitted are stolen by others at the same time and cause secret leakage .

在一个可能的实施方式中,本发明可以通过以下公式计算先前时刻第d个待加密能源数据的多维密匙的权重,包括:In a possible embodiment, the present invention can calculate the weight of the multi-dimensional key of the d -th energy data to be encrypted at the previous moment by the following formula, including:

Figure 422919DEST_PATH_IMAGE002
Figure 422919DEST_PATH_IMAGE002

其中,

Figure 947441DEST_PATH_IMAGE003
是以计算K d 的时刻为基准,先前第一个时刻的待加密能源信息的数据量 值;
Figure 498508DEST_PATH_IMAGE004
是以计算K d 的时刻为基准,先前第二个时刻的待加密能源信息的数据量值;
Figure 766679DEST_PATH_IMAGE005
是以 计算K d 的时刻为基准,先前第三个时刻的待加密能源信息的数据量值,A为先前第一个时刻 的待加密能源信息的数据量值的权重值,B为先前第二个时刻的待加密能源信息的数据量 值的权重值,C为先前第二个时刻的待加密能源信息的数据量值的权重值。 in,
Figure 947441DEST_PATH_IMAGE003
is the data volume value of the energy information to be encrypted at the first previous moment based on the moment when K d is calculated;
Figure 498508DEST_PATH_IMAGE004
is the data volume value of the energy information to be encrypted at the second previous moment based on the moment when K d is calculated;
Figure 766679DEST_PATH_IMAGE005
Based on the moment of calculating K d , the data volume value of the energy information to be encrypted at the third previous moment, A is the weight value of the data volume value of the energy information to be encrypted at the previous first moment, B is the previous second The weight value of the data amount value of the energy information to be encrypted at one time, C is the weight value of the data amount value of the energy information to be encrypted at the second previous time.

例如说,计算K d 的时刻为2020年9月10日11时00分00秒,则基准为2020年9月10日11时00分00秒。此时或获取先前的第一时刻(2020年8月10日12时00分20秒)、第二时刻(2020年7月23日8时10分00秒)以及第三时刻(2020年6月17日15时40分30秒),第一时刻、第二时刻以及第三时刻分别具为在得到待加密能源数据后,生成能源加密信息的时刻。第一时刻可以是先前最靠近基准的时刻,此时的第一时刻可以看做是,在本次生成能源加密信息之前最近的一次能源加密信息的生成时刻;第二时刻可以是第一时刻先前最近的时刻,此时的第二时刻可以看做是,在第一时刻生成能源加密信息之前最近的一次能源加密信息的生成时刻,以此类推,得到相应的第三时刻以及第三时刻对应的待加密能源信息的数据量值。For example, if the time for calculating K d is 11:00:00 on September 10, 2020, the benchmark is 11:00:00 on September 10, 2020. At this time or get the previous first moment (12:00:20 on August 10, 2020), the second moment (8:10:00 on July 23, 2020) and the third moment (June 2020) 15:40:30 on the 17th), the first time, the second time and the third time are respectively the time when energy encryption information is generated after obtaining the energy data to be encrypted. The first moment can be the previous moment closest to the benchmark, and the first moment at this time can be regarded as the latest generation moment of energy encryption information before the current generation of energy encryption information; the second moment can be the previous generation moment of the first moment. The most recent moment, the second moment at this time can be regarded as the generation moment of the most recent energy encryption information before the energy encryption information is generated at the first moment, and so on, the corresponding third moment and the corresponding third moment are obtained. The data volume value of the energy information to be encrypted.

本发明在计算第d个待加密能源数据的多维密匙的权重时,会获取在第d个待加密能源数据的先前三个时刻的待加密能源信息的数据量值,根据先前三个时刻的待加密能源信息的数据量值来得到每个待加密能源数据的多维密匙的权重。通过以上方式的计算,使得每个待加密能源数据的多维密匙的权重都是不同的,使得本发明所生成的多维密匙在各个维度上都具有唯一性。When calculating the weight of the multi-dimensional key of the d -th energy data to be encrypted, the present invention obtains the data volume value of the energy information to be encrypted at the previous three times of the d -th energy data to be encrypted. The data volume value of the energy information to be encrypted is used to obtain the weight of the multi-dimensional key of each energy data to be encrypted. Through the calculation in the above manner, the weights of the multi-dimensional keys of each energy data to be encrypted are different, so that the multi-dimensional keys generated by the present invention are unique in each dimension.

并且,先前三个时刻的待加密能源信息的数据量值的权重可以预先配置,例如说A 为1.1、B为1、C为0.9,具体数值本发明不做限定,但是需要保障ABC,使得

Figure 24485DEST_PATH_IMAGE003
K d 的影响 会大于
Figure 743742DEST_PATH_IMAGE005
K d 的影响,使得K d 能够根据以往的待加密能源信息的数据量值进行改变。 In addition, the weights of the data values of the energy information to be encrypted in the previous three moments can be pre-configured, for example, A is 1.1, B is 1, and C is 0.9. The specific values are not limited in the present invention, but it is necessary to ensure that A > B > C so that
Figure 24485DEST_PATH_IMAGE003
The effect on K d will be greater than
Figure 743742DEST_PATH_IMAGE005
The influence on K d enables K d to be changed according to the previous data amount of energy information to be encrypted.

在一个可能的实施方式中,步骤S110包括:In a possible implementation, step S110 includes:

步骤S1101、接收选定信息,所述选定信息至少包括目标时间段信息和目标能源信息。本发明在传输能源数据会先进行选定,即管理员在存储能源数据的数据端处进行数据的选定。目标时间段信息可以是2020年12月1日00时00分00秒至2020年12月31日23时59分59秒。目标能源信息可以是电压信息、电流信息、核能信息等等。Step S1101: Receive selected information, where the selected information at least includes target time period information and target energy information. In the present invention, the energy data will be selected first, that is, the administrator will select the data at the data terminal where the energy data is stored. The target time period information may be from 00:00:00 on December 1, 2020 to 23:59:59 on December 31, 2020. The target energy information may be voltage information, current information, nuclear energy information, and the like.

步骤S1102、基于所述目标能源信息在多个类别的待加密能源数据选定相应的持续时间序列的待加密能源数据。例如说目标能源信息为核能,则,则会选定应的持续时间序列的待加密能源数据,持续时间序列可以是从初始的采集时间开始的,例如说初始的采集时间可以是2015年1月1日00时00分00秒,则此时的采集时间的时间轴则为2015年1月1日00时00分00秒至当前。此时会获取核能所对应的时间序列、时间轴。Step S1102 , selecting the energy data to be encrypted corresponding to the duration series in the energy data to be encrypted in multiple categories based on the target energy information. For example, if the target energy information is nuclear energy, then the corresponding duration time series of energy data to be encrypted will be selected. The duration time series may start from the initial collection time, for example, the initial collection time may be January 2015. At 00:00:00 on the 1st, the time axis of the collection time at this time is from 00:00:00 on January 1, 2015 to the present. At this time, the time series and time axis corresponding to nuclear energy will be obtained.

步骤S1103、基于所述目标时间段信息在所述待加密能源数据选定一段的时间序列的待加密能源数据。本发明会在2015年1月1日00时00分00秒至当前的时间序列、时间轴上选取2020年12月1日00时00分00秒至2020年12月31日23时59分59秒的时间段所对应的待加密能源数据,此时的待加密能源数据是管理人员需要的数据。Step S1103: Select a time series of energy data to be encrypted in a time series of the energy data to be encrypted based on the target time period information. The present invention will select from 00:00:00 on January 1, 2015 to the current time series and time axis, from 00:00:00 on December 1, 2020 to 23:59:59 on December 31, 2020 The energy data to be encrypted corresponding to the time period of seconds, the energy data to be encrypted at this time is the data required by the management personnel.

通过步骤S1101至步骤S1103,本发明可以快速的提取待加密能源数据。Through steps S1101 to S1103, the present invention can quickly extract the energy data to be encrypted.

在一个可能的实施方式中,步骤S120包括:In a possible implementation, step S120 includes:

获取时间序列中的每个时刻值。本发明中的时间序列中会具有多个时刻值。Get each moment value in the time series. The time series in the present invention may have multiple time values.

提取时刻值中的年、月及日信息按照第一预设方式转换,使其成为第一数量信息。第一预设方式可以是如下,例如说2020年12月31日,可以转化为6365,其中6对应2020年,因为时间轴是从2015开始,所以认为2015年为1,则此时2020年则为6。其中,一年有365天,则12月31是一年中的最后一日,则认为其是365。通过以上方式,可以将年、月及日进行量化,使得其可以进行数量的比较。The year, month, and day information in the extracted time value is converted according to the first preset method, so that it becomes the first quantity information. The first preset method can be as follows. For example, on December 31, 2020, it can be converted into 6365, of which 6 corresponds to 2020. Because the time axis starts from 2015, it is considered that 2015 is 1, and then the year 2020 is 1. is 6. Among them, there are 365 days in a year, and if December 31 is the last day of the year, it is considered to be 365. In the above manner, the year, month and day can be quantified so that they can be compared quantitatively.

提取时刻值中的时、分及秒信息按照第二预设方式转换,使其成为第二数量信息。第二预设方式可以是如下,例如说23时59分59秒可以量化为86400,一天中有24小时,每个小时具有60分钟,每分钟具有60秒,则一天具有86400秒,所以本发明会将时、分及秒信息量化为一个数值。The hour, minute and second information in the extracted time value is converted according to the second preset method, so that it becomes the second quantity information. The second preset mode can be as follows, for example, 23:59:59 can be quantified as 86400, there are 24 hours in a day, each hour has 60 minutes, and each minute has 60 seconds, then a day has 86400 seconds, so the present invention Hours, minutes, and seconds are quantified into a single value.

基于所述第一数量信息和第二数量信息生成量化后的时刻值。例如说2020年12月31日23时59分59秒,则其量化后的数值为636586400。A quantized time value is generated based on the first quantity information and the second quantity information. For example, at 23:59:59 on December 31, 2020, the quantized value is 636586400.

其中,时间序列的起始时间点的量化值T 1、时间序列的终止时间点的量化值T 2分别可以按照步骤S120的方式进行量化。Wherein, the quantized value T 1 at the start time point of the time series and the quantized value T 2 at the end time point of the time series can be respectively quantized according to the method of step S120 .

将量化后的时刻值与对应的待加密能源标记生成时间序列表。A time series table is generated by combining the quantized time value and the corresponding energy mark to be encrypted.

通过以上的技术方案,可以将时间序列表中的所有时刻值进行量化,使得时间序列表在被处理时都是数值,方便计算、统计。Through the above technical solution, all the time values in the time series table can be quantified, so that the time series table is a numerical value when being processed, which is convenient for calculation and statistics.

在一个可能的实施方式中,将量化后的时刻值与对应的待加密能源标记生成时间序列表包括:In a possible implementation manner, generating a time series table from the quantized time value and the corresponding energy label to be encrypted includes:

对所述待加密能源标记基于预设对应关系量化处理,得到量化后的待加密能源标记,其中所述预设对应关系为待加密能源标记与待加密能源标记的量化值之间的对应关系。待加密能源标记可以是能源的名称。在该步骤中,预设的对应关系可以是提前设置的,包括多个待加密能源标与其对应的量化值的对应关系,按照预设的预设对应关系对待加密能源标记进行量化处理,例如说,核能(待加密能源标记)预先对应的量化值是100(待加密能源标记的量化值)、风能预先对应的量化值是200、电压预先对应的量化值是300、电流预先对应的量化值是400,通过以上方式对待加密能源标记进行量化处理。通过以上方式,实现对待加密能源标的量化处理。The energy label to be encrypted is quantized based on a preset correspondence relationship to obtain a quantized energy label to be encrypted, wherein the preset correspondence relationship is a correspondence between the energy label to be encrypted and the quantized value of the energy label to be encrypted. The energy token to be encrypted can be the name of the energy. In this step, the preset corresponding relationship may be set in advance, including the corresponding relationship between a plurality of energy markers to be encrypted and their corresponding quantized values, and quantization processing is performed on the energy markers to be encrypted according to the preset preset corresponding relationship, for example, , the pre-corresponding quantized value of nuclear energy (energy tag to be encrypted) is 100 (the quantized value of the energy tag to be encrypted), the pre-corresponding quantized value of wind energy is 200, the pre-corresponding quantized value of voltage is 300, and the pre-corresponding quantized value of current is 400, quantify the energy token to be encrypted in the above manner. Through the above methods, the quantitative processing of the encrypted energy target is realized.

将量化后的时刻值与量化后的能源标记组合成为数量值后生成时间序列表。本发明在对时刻值和能源标记分别量化后,时间序列表中的所有信息、数据都是量化后的值,方便后续的存储以及基于哈希算法进行处理,使得本发明的技术方案处理速度较快。A time series table is generated by combining the quantized time value and the quantized energy label into a quantity value. After the present invention quantifies the time value and the energy mark respectively, all the information and data in the time series table are quantized values, which is convenient for subsequent storage and processing based on the hash algorithm, so that the processing speed of the technical solution of the present invention is faster. quick.

在一个可能的实施方式中,基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息包括:In a possible implementation manner, the encrypted energy information obtained by encrypting the corresponding energy information to be encrypted based on the multi-dimensional key includes:

将多维密匙添加至预先设置的通用压缩路径中生成加密压缩路径。本发明可以在得到多维密匙后,根据预设的压缩路径得到加密压缩路径,根据加密压缩路径对能源数据、待加密能源信息进行加密压缩处理。Add the multi-dimensional key to the preset general compression path to generate an encrypted compression path. The present invention can obtain the encrypted compression path according to the preset compression path after obtaining the multi-dimensional key, and perform encryption and compression processing on the energy data and the energy information to be encrypted according to the encrypted compression path.

根据所述加密压缩路径生成反向的解密解压路径,所述解密解压路径响应于所述多维密匙进行解压缩处理。本发明在得到加密压缩路径的同时,会生成相应的解密解压路径,使用端可以根据解密解压路径对加密能源信息、能源数据进行解密、加压处理。A reverse decryption and decompression path is generated according to the encrypted compression path, and the decryption and decompression path performs a decompression process in response to the multi-dimensional key. The invention generates a corresponding decryption and decompression path while obtaining the encryption and compression path, and the user can decrypt and pressurize the encrypted energy information and energy data according to the decryption and decompression path.

基于所述加密压缩路径对所述待加密能源信息加密处理得到加密能源信息。The encrypted energy information is obtained by encrypting the energy information to be encrypted based on the encryption compression path.

通过以上的技术方案,本发明将通用压缩路径与多维密匙结合得到加密路径,实现对待加密能源信息加密处理。方便快捷的同时,保障每个加密能源信息都具有不同的多维密匙。Through the above technical solutions, the present invention combines the general compression path and the multi-dimensional key to obtain the encryption path, and realizes the encryption processing of the energy information to be encrypted. While convenient and fast, it ensures that each encrypted energy information has a different multi-dimensional key.

在一个可能的实施方式中,还包括:In a possible implementation, it also includes:

在所述解密解压路径中设置损毁逻辑。在实际的使用、操作过程中,加密后的加密能源信息可能会通过多种途径流转至其他人处,所以本发明需要设置一个损毁逻辑,使其他没有掌握多维密匙的人员无法打开加密能源信息,并且可以进行数据的损毁。例如说,损毁逻辑为将加密能源信息内所对应的源代码打乱,使得其无法被恢复、还原,对于损毁逻辑的具体实施方式可以是现有技术,本发明不做过多阐述。Destruction logic is provided in the decryption and decompression path. In the actual use and operation process, the encrypted encrypted energy information may be transferred to other people through various channels, so the present invention needs to set a destruction logic, so that other people who do not have the multi-dimensional key cannot open the encrypted energy information. , and data corruption can be performed. For example, the destruction logic is to scramble the corresponding source code in the encrypted energy information, so that it cannot be recovered or restored. The specific implementation of the destruction logic can be the prior art, and the present invention will not elaborate.

当解密解压路径接收到的多维密匙错误次数超过预设值时,基于所述损毁逻辑将加密能源信息按照预设损毁逻辑损毁。其中,错误次数的预设值为3。当多维密匙错误次数超过3次时,则判断想要打开加密能源信息的人并不具有相应的权限,所以此时按照预设损毁逻辑损毁。When the number of multi-dimensional key errors received by the decryption and decompression path exceeds a preset value, the encrypted energy information is destroyed according to the preset destruction logic based on the destruction logic. The default value of the number of errors is 3. When the number of errors in the multi-dimensional key exceeds 3 times, it is determined that the person who wants to open the encrypted energy information does not have the corresponding authority, so it is destroyed according to the preset destruction logic at this time.

通过以上方式,保障了能源数据的安全性,即使加密能源信息被他人获取,也无法通过多次尝试的手段打开。Through the above methods, the security of energy data is guaranteed. Even if the encrypted energy information is obtained by others, it cannot be opened by means of multiple attempts.

本发明的技术方案还提供一种基于能源密匙表的加密装置,如图2所示,包括:The technical solution of the present invention also provides an encryption device based on an energy key table, as shown in FIG. 2 , including:

获取模块,用于获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记;an acquisition module, configured to acquire a plurality of energy data to be encrypted with time series, the energy data to be encrypted at least include energy information to be encrypted and energy labels to be encrypted;

生成模块,用于基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值;a generating module, configured to generate a time series table based on the time series and the energy label to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm;

计算模块,用于根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,The calculation module is used to calculate the multi-dimensional key according to the data volume value of the energy information to be encrypted, and calculate the multi-dimensional key of each energy data to be encrypted with time series by the following formula,

Figure 719789DEST_PATH_IMAGE001
Figure 719789DEST_PATH_IMAGE001

其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 为先前时刻计算的第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值;Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value, and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted calculated at the previous moment, S is the data volume value, and L is the normalized value;

加密模块,用于基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。The encryption module is used to encrypt and process the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generate an energy key table according to a plurality of multi-dimensional keys, generate energy data to be transmitted according to a plurality of encrypted energy information, and The energy key table and the energy data to be transmitted are sent.

其中,存储介质可以是计算机存储介质,也可以是通信介质。通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。计算机存储介质可以是通用或专用计算机能够存取的任何可用介质。例如,存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于专用集成电路(Application Specific IntegratedCircuits,简称:ASIC)中。另外,该ASIC可以位于用户设备中。当然,处理器和存储介质也可以作为分立组件存在于通信设备中。存储介质可以是只读存储器(ROM)、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。 The storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media can be any available media that can be accessed by a general purpose or special purpose computer. For example, a storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium may be located in application specific integrated circuits (Application Specific Integrated Circuits, ASIC for short). Alternatively, the ASIC may be located in the user equipment. Of course, the processor and storage medium may also exist in the communication device as discrete components. The storage medium may be read only memory (ROM), random access memory (RAM), CD-ROMs, magnetic tapes, floppy disks, optical data storage devices, and the like.

本发明还提供一种程序产品,该程序产品包括执行指令,该执行指令存储在存储介质中。设备的至少一个处理器可以从存储介质读取该执行指令,至少一个处理器执行该执行指令使得设备实施上述的各种实施方式提供的方法。The present invention also provides a program product, the program product includes execution instructions, and the execution instructions are stored in a storage medium. At least one processor of the device may read the execution instruction from the storage medium, and the execution of the execution instruction by the at least one processor causes the device to implement the methods provided by the various embodiments described above.

在上述终端或者服务器的实施例中,应理解,处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application SpecificIntegrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。In the above embodiments of the terminal or server, it should be understood that the processor may be a central processing unit (English: Central Processing Unit, CPU for short), or other general-purpose processors, digital signal processors (English: Digital Signal Processor) , referred to as: DSP), application specific integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) and so on. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the present invention can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. scope.

Claims (10)

1.基于能源密匙表的加密方法,其特征在于,包括:1. the encryption method based on energy key table, is characterized in that, comprises: 获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记;Acquiring a plurality of energy data to be encrypted with time series, the energy data to be encrypted at least includes energy information to be encrypted and energy label to be encrypted; 基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值;Generate a time series table based on the time series and the energy label to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm; 根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,Calculate the multidimensional key according to the data volume value of the energy information to be encrypted, and calculate the multidimensional key of each energy data to be encrypted with time series by the following formula:
Figure 6041DEST_PATH_IMAGE001
Figure 6041DEST_PATH_IMAGE001
其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 为先前时刻计算的第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值,归一化值是预先设置的,用于将多维密匙的数字值降低;Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value, and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted calculated at the previous moment, S is the data volume value, L is the normalized value, the normalized value is preset and used to reduce the digital value of the multi-dimensional key; 基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。Encrypting the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generating an energy key table according to a plurality of multi-dimensional keys, generating energy data to be transmitted according to a plurality of encrypted energy information, and converting the energy key Table and energy data to be transmitted are sent.
2.根据权利要求1所述的基于能源密匙表的加密方法,其特征在于,2. the encryption method based on energy key table according to claim 1, is characterized in that, 通过以下公式计算先前时刻第d个待加密能源数据的多维密匙的权重,包括:Calculate the weight of the multi-dimensional key of the d-th energy data to be encrypted at the previous moment by the following formula, including:
Figure 919770DEST_PATH_IMAGE002
Figure 919770DEST_PATH_IMAGE002
其中,
Figure 886239DEST_PATH_IMAGE003
是以计算K d 的时刻为基准,先前第一个时刻的待加密能源信息的数据量值;
Figure 467393DEST_PATH_IMAGE004
是以计算K d 的时刻为基准,先前第二个时刻的待加密能源信息的数据量值;
Figure 458352DEST_PATH_IMAGE005
是以计算K d 的时刻为基准,先前第三个时刻的待加密能源信息的数据量值,A为先前第一个时刻的待加 密能源信息的数据量值的权重值,B为先前第二个时刻的待加密能源信息的数据量值的权 重值,C为先前第二个时刻的待加密能源信息的数据量值的权重值,保障A>B>C。
in,
Figure 886239DEST_PATH_IMAGE003
is the data volume value of the energy information to be encrypted at the first previous moment based on the moment when K d is calculated;
Figure 467393DEST_PATH_IMAGE004
is the data volume value of the energy information to be encrypted at the second previous moment based on the moment when K d is calculated;
Figure 458352DEST_PATH_IMAGE005
Based on the moment of calculating K d , the data volume value of the energy information to be encrypted at the third previous moment, A is the weight value of the data volume value of the energy information to be encrypted at the previous first moment, B is the previous second The weight value of the data volume value of the energy information to be encrypted at one time, C is the weight value of the data volume value of the energy information to be encrypted at the second previous time, and A>B>C is guaranteed.
3.根据权利要求1所述的基于能源密匙表的加密方法,其特征在于,3. the encryption method based on energy key table according to claim 1, is characterized in that, 获取多个具有时间序列的待加密能源数据包括:Obtaining multiple energy data to be encrypted with time series includes: 接收选定信息,所述选定信息至少包括目标时间段信息和目标能源信息;receiving selected information, the selected information including at least target time period information and target energy information; 基于所述目标能源信息在多个类别的待加密能源数据选定相应的持续时间序列的待加密能源数据;Based on the target energy information, the energy data to be encrypted corresponding to the time series to be encrypted is selected in the plurality of categories of energy data to be encrypted; 基于所述目标时间段信息在所述待加密能源数据选定一段的时间序列的待加密能源数据。Based on the target time period information, a period of time series energy data to be encrypted is selected in the energy data to be encrypted. 4.根据权利要求1所述的基于能源密匙表的加密方法,其特征在于,4. the encryption method based on energy key table according to claim 1, is characterized in that, 基于所述时间序列和待加密能源标记生成时间序列表包括:Generating a time series table based on the time series and the energy token to be encrypted includes: 获取时间序列中的每个时刻值;Get each moment value in the time series; 提取时刻值中的年、月及日信息按照第一预设方式转换,使其成为第一数量信息;The year, month and day information in the extracted time value is converted according to the first preset method, so that it becomes the first quantity information; 提取时刻值中的时、分及秒信息按照第二预设方式转换,使其成为第二数量信息;Converting the hour, minute and second information in the extracted time value according to the second preset method to make it become the second quantity information; 基于所述第一数量信息和第二数量信息生成量化后的时刻值;generating a quantized time value based on the first quantity information and the second quantity information; 将量化后的时刻值与对应的待加密能源标记生成时间序列表。A time series table is generated by combining the quantized time value and the corresponding energy mark to be encrypted. 5.根据权利要求4所述的基于能源密匙表的加密方法,其特征在于,5. the encryption method based on energy key table according to claim 4, is characterized in that, 将量化后的时刻值与对应的待加密能源标记生成时间序列表包括:The time series table generated from the quantized moment value and the corresponding energy token to be encrypted includes: 对所述待加密能源标记基于预设对应关系量化处理,得到量化后的待加密能源标记,其中所述预设对应关系为待加密能源标记与待加密能源标记的量化值之间的对应关系;quantifying the energy label to be encrypted based on a preset correspondence relationship to obtain a quantized energy label to be encrypted, wherein the preset correspondence relationship is the correspondence between the energy label to be encrypted and the quantized value of the energy label to be encrypted; 将量化后的时刻值与量化后的能源标记组合成为数量值后生成时间序列表。A time series table is generated by combining the quantized time value and the quantized energy label into a quantity value. 6.根据权利要求1所述的基于能源密匙表的加密方法,其特征在于,6. The encryption method based on energy key table according to claim 1, is characterized in that, 基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息包括:Encrypting the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information includes: 将多维密匙添加至预先设置的通用压缩路径中生成加密压缩路径;Add the multi-dimensional key to the preset general compression path to generate an encrypted compression path; 根据所述加密压缩路径生成反向的解密解压路径,所述解密解压路径响应于所述多维密匙进行解压缩处理;A reverse decryption and decompression path is generated according to the encryption and compression path, and the decryption and decompression path performs decompression processing in response to the multi-dimensional key; 基于所述加密压缩路径对所述待加密能源信息加密处理得到加密能源信息。The encrypted energy information is obtained by encrypting the energy information to be encrypted based on the encryption compression path. 7.根据权利要求6所述的基于能源密匙表的加密方法,其特征在于,还包括:7. The encryption method based on energy key table according to claim 6, is characterized in that, also comprises: 在所述解密解压路径中设置损毁逻辑;setting damage logic in the decryption and decompression path; 当解密解压路径接收到的多维密匙错误次数超过预设值时,基于所述损毁逻辑将加密能源信息按照预设损毁逻辑损毁。When the number of multi-dimensional key errors received by the decryption and decompression path exceeds a preset value, the encrypted energy information is destroyed according to the preset destruction logic based on the destruction logic. 8.根据权利要求7所述的基于能源密匙表的加密方法,其特征在于,8. The encryption method based on energy key table according to claim 7, is characterized in that, 其中,错误次数的预设值为3。The default value of the number of errors is 3. 9.基于能源密匙表的加密装置,其特征在于,包括:9. The encryption device based on the energy key table, is characterized in that, comprises: 获取模块,用于获取多个具有时间序列的待加密能源数据,所述待加密能源数据至少包括待加密能源信息和待加密能源标记;an acquisition module, configured to acquire a plurality of energy data to be encrypted with time series, the energy data to be encrypted at least include energy information to be encrypted and energy labels to be encrypted; 生成模块,用于基于所述时间序列和待加密能源标记生成时间序列表,提取所述时间序列表的二进制代码,基于哈希算法计算时间序列表的二进制代码的第一哈希值;a generating module, configured to generate a time series table based on the time series and the energy label to be encrypted, extract the binary code of the time series table, and calculate the first hash value of the binary code of the time series table based on a hash algorithm; 计算模块,用于根据待加密能源信息的数据量值进行计算得到多维密匙,通过以下公式计算每一个具有时间序列的待加密能源数据的多维密匙,The calculation module is used to calculate the multi-dimensional key according to the data volume value of the energy information to be encrypted, and calculate the multi-dimensional key of each energy data to be encrypted with time series by the following formula,
Figure 984011DEST_PATH_IMAGE001
Figure 984011DEST_PATH_IMAGE001
其中,D为多维密匙,T 1为时间序列的起始时间点的量化值,T 2为时间序列的终止时间点的量化值,H为第一哈希值,O d 为先前时刻计算的第d个待加密能源数据的多维密匙,K d 先为前时刻第d个待加密能源数据的多维密匙的权重,S为数据量值,L为归一化值,归一化值是预先设置的,用于将多维密匙的数字值降低;Among them, D is the multi-dimensional key, T 1 is the quantized value at the start time point of the time series, T 2 is the quantized value at the end time point of the time series, H is the first hash value , and O d is the calculated value at the previous time. The multi-dimensional key of the d -th energy data to be encrypted, K d is the weight of the multi-dimensional key of the d -th energy data to be encrypted at the previous moment, S is the data volume value, L is the normalized value, and the normalized value is Preset, used to reduce the digital value of the multi-dimensional key; 加密模块,用于基于所述多维密匙对相应的待加密能源信息加密处理得到加密能源信息,根据多个多维密匙生成能源密匙表,根据多个加密能源信息生成待传输能源数据,将所述能源密匙表和待传输能源数据发送。The encryption module is used to encrypt and process the corresponding energy information to be encrypted based on the multi-dimensional key to obtain encrypted energy information, generate an energy key table according to a plurality of multi-dimensional keys, generate energy data to be transmitted according to a plurality of encrypted energy information, and The energy key table and the energy data to be transmitted are sent.
10.存储介质,其特征在于,所述存储介质中存储有计算机程序,所述计算机程序被处理器执行时用于实现权利要求1至8任一所述的方法。10. A storage medium, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, is used to implement the method according to any one of claims 1 to 8.
CN202111025654.6A 2021-09-02 2021-09-02 Encryption method, device and storage medium based on energy key table Active CN113468585B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111025654.6A CN113468585B (en) 2021-09-02 2021-09-02 Encryption method, device and storage medium based on energy key table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111025654.6A CN113468585B (en) 2021-09-02 2021-09-02 Encryption method, device and storage medium based on energy key table

Publications (2)

Publication Number Publication Date
CN113468585A CN113468585A (en) 2021-10-01
CN113468585B true CN113468585B (en) 2021-11-19

Family

ID=77867270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111025654.6A Active CN113468585B (en) 2021-09-02 2021-09-02 Encryption method, device and storage medium based on energy key table

Country Status (1)

Country Link
CN (1) CN113468585B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115146295B (en) * 2022-06-30 2025-02-11 中国电信股份有限公司 Key pairing method, device, electronic device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019047062A1 (en) * 2017-09-06 2019-03-14 福建联迪商用设备有限公司 Anti-dpa attack encryption method and computer-readable storage medium
US10382407B1 (en) * 2017-03-31 2019-08-13 EMC IP Holding Company LLC Encryption and decryption of time series data using a digital filter array
CN110611570A (en) * 2019-09-26 2019-12-24 鹏城实验室 A method and device for encryption, key information provision and data acquisition

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7246235B2 (en) * 2001-06-28 2007-07-17 Intel Corporation Time varying presentation of items based on a key hash
EP2720403A1 (en) * 2012-10-12 2014-04-16 Thomson Licensing Aggregator-oblivious encryption of time-series data
CN110650116B (en) * 2019-07-04 2021-08-31 浙江工商大学 Multi-type multi-dimensional data aggregation method for security smart power grid
CN112636895B (en) * 2020-09-07 2024-09-06 长沙理工大学 Image encryption and decryption method and image encryption and decryption system
CN113032828A (en) * 2021-03-23 2021-06-25 广东电网有限责任公司 Improved binary system interaction information encryption method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10382407B1 (en) * 2017-03-31 2019-08-13 EMC IP Holding Company LLC Encryption and decryption of time series data using a digital filter array
WO2019047062A1 (en) * 2017-09-06 2019-03-14 福建联迪商用设备有限公司 Anti-dpa attack encryption method and computer-readable storage medium
CN110611570A (en) * 2019-09-26 2019-12-24 鹏城实验室 A method and device for encryption, key information provision and data acquisition

Also Published As

Publication number Publication date
CN113468585A (en) 2021-10-01

Similar Documents

Publication Publication Date Title
CN106776904B (en) The fuzzy query encryption method of dynamic authentication is supported in a kind of insincere cloud computing environment
US20100058476A1 (en) Electronic information retention method/system, electronic information split retention method/system, electronic information split restoration processing method/system, and programs for the same
CN109522328B (en) Data processing method and device, medium and terminal thereof
CN110413652B (en) A big data privacy retrieval method based on edge computing
WO2019205366A1 (en) Picture management method and apparatus, computer device, and storage medium
CN100508451C (en) Apparatus and method for generating data for detecting false alterations of encrypted data during processing
CN110913092A (en) A Reversible Information Hiding Method for Encrypted Image
CN113468585B (en) Encryption method, device and storage medium based on energy key table
CN118171325B (en) Method, system and equipment for protecting data privacy in large language model training
CN108632369A (en) A kind of safe display management method of ship electronic drawing
CN117111854A (en) Data storage method, device and medium based on distributed encryption storage
CN117370960A (en) Data destruction method, system and equipment
TW202411866A (en) File encrypting method and device
CN114915698A (en) A Reversible Information Hiding Method Based on Row Coding
CN118733816B (en) Remote sensing image security retrieval method and system in cloud environment
CN114553589A (en) A method for secure cloud file transmission based on multi-level encryption
Tang et al. OPPR: An outsourcing privacy-preserving JPEG image retrieval scheme with local histograms in cloud environment
US12061604B2 (en) Searchable encryption system
CN116305294B (en) Data leakage tracing method and device, electronic equipment and storage medium
CN118395474A (en) Privacy calculation enhanced blockchain solving system for safe circulation of supply chain data
CN116049792A (en) Face registration and recognition method and face data protection system
CN108595920A (en) Network video listens management support rights service subsystem
CN115146315A (en) Private data protection method, device, equipment and storage medium of low-code platform
CN114417365A (en) Implementation method of one-to-one compression encryption and decryption key document security tool
Wang et al. Internet of vehicles based on TrustZone and optimized RSA

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