CN110489370B - Hardware filling method for preprocessing SHA256 message of hash algorithm - Google Patents

Hardware filling method for preprocessing SHA256 message of hash algorithm Download PDF

Info

Publication number
CN110489370B
CN110489370B CN201910635665.2A CN201910635665A CN110489370B CN 110489370 B CN110489370 B CN 110489370B CN 201910635665 A CN201910635665 A CN 201910635665A CN 110489370 B CN110489370 B CN 110489370B
Authority
CN
China
Prior art keywords
data
message
state machine
message block
filling
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
CN201910635665.2A
Other languages
Chinese (zh)
Other versions
CN110489370A (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.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
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 Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201910635665.2A priority Critical patent/CN110489370B/en
Publication of CN110489370A publication Critical patent/CN110489370A/en
Application granted granted Critical
Publication of CN110489370B publication Critical patent/CN110489370B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4204Bus transfer protocol, e.g. handshake; Synchronisation on a parallel bus
    • G06F13/4221Bus transfer protocol, e.g. handshake; Synchronisation on a parallel bus being an input/output bus, e.g. ISA bus, EISA bus, PCI bus, SCSI bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a hardware filling method for preprocessing hash algorithm SHA256 messages, which utilizes two state machines to respectively calculate message length and filling messages, and can be divided into different states according to different outputs, at the moment, filled data can be transferred by only one 32-bit register, and the area of a chip is reduced. Meanwhile, on the framework, the processing of the filling module is easy, and the period required for inputting a message block is equal to the period for processing a message block, so that the processing speed of a chip is synchronous with an interface, a signal for handshaking with a filling part is reduced, and a gating clock unit is added in front of filling. The operation clock is turned off at the time of data stuffing according to the running state, and the stuffed clock is turned off at the time of processing operation. The design of low power consumption can greatly reduce the power consumption of the processing algorithm during hardware operation.

Description

Hardware filling method for preprocessing SHA256 message of hash algorithm
Technical Field
The invention relates to the field of hardware filling, in particular to a hardware filling method for preprocessing a hash algorithm SHA256 message.
Background
In the big data age, the development of social informatization and networking has led to explosive growth of data, and the global data volume is doubled about every two years, which means that the volume of data generated in the last two years by human beings is equivalent to the total volume of data generated before. Big data technology, which is silently permeated into various industry fields, gradually becomes a production element to play an important role. However, while big data technology has resulted in increased productivity and lifestyle changes, the attendant security challenges have not been ignored. At present, most of information security solutions are focused on a software level, and information security solutions based on a hardware level are also proposed, but means and methods for solving the problems are relatively single. With the continuous breakthrough of quantum computation, the existing information security identity authentication algorithm for information encryption and decryption is severely challenged.
The application of the Hash algorithm in the aspect of information security mainly comprises the following points:
(1) File verification
The more familiar check algorithms include parity check and CRC check, which do not have the ability to resist data tampering, and which detect and correct channel errors in data transmission to some extent, but do not prevent malicious corruption of the data.
(2) Digital signature
The Hash algorithm is also an important component in modern cryptography. Since the operation speed of the asymmetric algorithm is slow, the one-way hash function plays an important role in the digital signature protocol. Digitally signing the Hash value, also known as "digital digest", may be considered statistically equivalent to digitally signing the file itself.
(3) Authentication protocol
The following authentication protocol is also called challenge-authentication mode: in case the transmission channel is interception but not tampered with, this is a simple and secure way.
In order to solve the social problem caused by information security, in the design of integrated circuits such as embedded and analog front-end and back-end circuits, power consumption is increasingly in an important position, and often the power consumption of equipment can determine the service life of a product and the trend of the market.
Disclosure of Invention
The invention provides a hardware filling method for preprocessing hash algorithm SHA256 messages, which greatly improves the data processing speed.
In order to solve the technical problems, the technical scheme of the invention is as follows:
a hardware filling method for preprocessing a hash algorithm SHA256 message comprises the following steps:
s1: the message block is input into a computing state machine, the data length of the computing state machine is 32 bits each time the message block is input, and the computing state machine outputs the data length of the message block according to the input data times and the valid bytes of the data;
s2: inputting the output of the computing state machine and the message block into a filling state machine, wherein the filling state machine adds the output of the computing state machine to the tail of the message block to obtain a filled message block and outputs the filled message block;
s3: and transmitting the output of the filling state machine to an operation module, wherein the operation module outputs 32-bit data of the filled message block each time as the input of a data path.
Preferably, the output of the counting state machine is 64 bits, divided into four parts:
a 0 of 3 bits represents the smallest unit of measure of the message;
2 bits represent a valid byte of data;
4 bits represent the number of times of data input;
and a 55-bit counter, wherein after the number of times of input data is 16, the 55-bit counter is added with 1, and the 4 bits representing the number of times of input data are simultaneously cleared.
Preferably, the smallest unit of measure of the message is a byte.
Preferably, the operation module outputs 32-bit data of the padded message block in the next cycle every time data is input by stream processing.
Preferably, a 32-bit register is used to transfer the filled data.
Preferably, the method further comprises the step of controlling a gating clock unit, wherein the gating clock unit is added before filling, and the gating clock unit turns off an operation clock when data is filled according to the running state and turns off the filled clock when operation is processed.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the preprocessing in SHA256 algorithm is to supplement the required information after the message that wants to Hash, so that the whole message meets the specified structure. The preprocessing of the information is divided into two steps: additional padding bits and additional length. The two state machines are used for respectively calculating the message length and the filling message, and the two state machines can be divided into different states according to different outputs, at this time, the filled data can be transferred by only one 32-bit register, and the area of a chip is reduced. Meanwhile, on the framework, the processing of the filling module is easy, and the period required for inputting a message block is equal to the period for processing a message block, so that the processing speed of a chip is synchronous with an interface, a signal for handshaking with a filling part is reduced, and a gating clock unit is added in front of filling. The operation clock is turned off at the time of data stuffing according to the running state, and the stuffed clock is turned off at the time of processing operation. The design of low power consumption can greatly reduce the power consumption of the processing algorithm during hardware operation.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
Fig. 2 is a clock control unit in the present invention.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the present patent;
for the purpose of better illustrating the embodiments, certain elements of the drawings may be omitted, enlarged or reduced and do not represent the actual product dimensions;
it will be appreciated by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The technical scheme of the invention is further described below with reference to the accompanying drawings and examples.
Example 1
The embodiment provides a hardware filling method for preprocessing a hash algorithm SHA256 message, as shown in fig. 1, comprising the following steps:
s1: the message block is input into a computing state machine, the data length of the computing state machine is 32 bits each time the message block is input, and the computing state machine outputs the data length of the message block according to the input data times and the valid bytes of the data;
s2: inputting the output of the computing state machine and the message block into a filling state machine, wherein the filling state machine adds the output of the computing state machine to the tail of the message block to obtain a filled message block and outputs the filled message block;
s3: and transmitting the output of the filling state machine to an operation module, wherein the operation module outputs 32-bit data of the filled message block each time as the input of a data path.
The output of the counting state machine is 64 bits and is divided into four parts:
a 0 of 3 bits represents the smallest unit of measure of the message;
2 bits represent a valid byte of data;
4 bits represent the number of times of data input;
and a 55-bit counter, wherein after the number of times of input data is 16, the 55-bit counter is added with 1, and the 4 bits representing the number of times of input data are simultaneously cleared.
The smallest unit of measure of the message is a byte.
The operation module outputs 32-bit data of the filled message block in the next period every time data is input by stream processing. Since 16 cycles are required to input a message block (512 bits), and 16 cycles are also required to process a message block, the processing speed of the chip is synchronized with the interface, reducing a signal to handshake with the stuffing portion.
The 32-bit register is used to transfer the filled data.
The system also comprises a gating clock unit control, as shown in fig. 2, wherein a gating clock unit is added in front of the filling, and the gating clock unit turns off an operation clock when data is filled according to the running state and turns off the filled clock when the operation is processed.
The same or similar reference numerals correspond to the same or similar components;
the terms describing the positional relationship in the drawings are merely illustrative, and are not to be construed as limiting the present patent;
it is to be understood that the above examples of the present invention are provided by way of illustration only and not by way of limitation of the embodiments of the present invention. Other variations or modifications of the above teachings will be apparent to those of ordinary skill in the art. It is not necessary here nor is it exhaustive of all embodiments. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the invention are desired to be protected by the following claims.

Claims (5)

1. A hardware population method for preprocessing a hash algorithm SHA256 message, comprising the steps of:
s1: the message block is input into a computing state machine, the data length of the computing state machine is 32 bits each time the message block is input, and the computing state machine outputs the data length of the message block according to the input data times and the valid bytes of the data;
s2: inputting the output of the computing state machine and the message block into a filling state machine, wherein the filling state machine adds the output of the computing state machine to the tail of the message block to obtain a filled message block and outputs the filled message block;
s3: transmitting the output of the filling state machine to an operation module, wherein the operation module outputs 32-bit data of the filled message block each time as the input of a data path;
the system also comprises a gating clock unit control, wherein a gating clock unit is added in front of the filling, the gating clock unit turns off an operation clock when data is filled according to the running state, and turns off the filled clock when the operation is processed.
2. The hardware population method of hash algorithm SHA256 message preprocessing according to claim 1, wherein the output of the computing state machine is 64 bits, divided into four parts: a 0 of 3 bits represents the smallest unit of measure of the message;
2 bits represent a valid byte of data;
4 bits represent the number of times of data input;
and a 55-bit counter, wherein after the number of times of input data is 16, the 55-bit counter is added with 1, and the 4 bits representing the number of times of input data are simultaneously cleared.
3. The hardware population method of hash algorithm SHA256 message preprocessing of claim 2, wherein the smallest unit of measure of the message is a byte.
4. A hardware padding method for hash algorithm SHA256 message preprocessing according to claim 3, wherein the operation module outputs 32-bit data of the padded message block in the next cycle with stream processing every time data is input.
5. The hardware population method for hash algorithm SHA256 message preprocessing of claim 4, wherein the packed data is transferred using a 32-bit register.
CN201910635665.2A 2019-07-15 2019-07-15 Hardware filling method for preprocessing SHA256 message of hash algorithm Active CN110489370B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910635665.2A CN110489370B (en) 2019-07-15 2019-07-15 Hardware filling method for preprocessing SHA256 message of hash algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910635665.2A CN110489370B (en) 2019-07-15 2019-07-15 Hardware filling method for preprocessing SHA256 message of hash algorithm

Publications (2)

Publication Number Publication Date
CN110489370A CN110489370A (en) 2019-11-22
CN110489370B true CN110489370B (en) 2023-05-23

Family

ID=68547278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910635665.2A Active CN110489370B (en) 2019-07-15 2019-07-15 Hardware filling method for preprocessing SHA256 message of hash algorithm

Country Status (1)

Country Link
CN (1) CN110489370B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111612622B (en) * 2020-05-20 2021-03-23 深圳比特微电子科技有限公司 Circuit and method for performing a hashing algorithm
CN112104449B (en) * 2020-08-20 2022-02-11 郑州信大捷安信息技术股份有限公司 SDK for Hash algorithm
CN113794567B (en) * 2021-09-13 2024-04-05 上海致居信息科技有限公司 Synthetic acceleration method and device for SHA256 hash algorithm zero knowledge proof circuit
CN115834027B (en) * 2023-01-06 2023-05-19 浪潮电子信息产业股份有限公司 Message filling method, device, equipment and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107147488A (en) * 2017-03-24 2017-09-08 广东工业大学 A kind of signature sign test system and method based on SM2 enciphering and deciphering algorithms
CN107579811A (en) * 2017-07-28 2018-01-12 广州星海集成电路基地有限公司 A kind of hardware optimization method based on SM3 cryptographic Hash algorithms

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1716848A (en) * 2004-06-14 2006-01-04 上海安创信息科技有限公司 Method for quick realizing odds and ends algorithm for hardware
US9141831B2 (en) * 2010-07-08 2015-09-22 Texas Instruments Incorporated Scheduler, security context cache, packet processor, and authentication, encryption modules
CN105678170B (en) * 2016-01-05 2018-05-29 广东工业大学 A kind of method of dynamic detection XSS loopholes
CN107666387A (en) * 2016-07-27 2018-02-06 北京计算机技术及应用研究所 Low power consumption parallel Hash calculation circuit

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107147488A (en) * 2017-03-24 2017-09-08 广东工业大学 A kind of signature sign test system and method based on SM2 enciphering and deciphering algorithms
CN107579811A (en) * 2017-07-28 2018-01-12 广州星海集成电路基地有限公司 A kind of hardware optimization method based on SM3 cryptographic Hash algorithms

Also Published As

Publication number Publication date
CN110489370A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
CN110489370B (en) Hardware filling method for preprocessing SHA256 message of hash algorithm
US20220138349A1 (en) Cryptographic architecture for cryptographic permutation
US20080240423A1 (en) Speeding up galois counter mode (gcm) computations
US20120076298A1 (en) Unified architecture for crypto functional units
JP2001051596A (en) Device and method for generating/verifying data
WO2007058949A3 (en) Method and apparatus for hardware xml acceleration
CN107113180B (en) Packet transmission device, packet reception device, and storage medium
WO2017045484A1 (en) Xts-sm4-based storage encryption and decryption method and apparatus
US11750402B2 (en) Message index aware multi-hash accelerator for post quantum cryptography secure hash-based signing and verification
US20210089388A1 (en) System, Apparatus And Method For Providing Protection Against Silent Data Corruption In A Link
CN113573304A (en) Signature realization method, signature verification method, signature terminal, signature verification terminal and storage medium
CN101916344B (en) Method and system for verifying legality of software protection device
US20220131708A1 (en) Efficient hybridization of classical and post-quantum signatures
CN113688399A (en) Firmware digital signature protection method and device, computer equipment and storage medium
JP2011250183A (en) Serial receiving apparatus and control method and program for the same
US20190319787A1 (en) Hardware acceleration of bike for post-quantum public key cryptography
CN106533653A (en) Encrypted chip, encryption method and encryption system
CN107404380B (en) RSA algorithm based on asynchronous data path
Smyth et al. WLAN security processor
US20220345292A1 (en) Method and device for encryption of video stream, communication equipment, and storage medium
CN101819519A (en) Multifunctional digital signing circuit
CN110585727B (en) Resource acquisition method and device
CN106156655A (en) The compressing file of a kind of facing cloud storage and authentication method
CN109981291A (en) A kind of mixing packet signature method
CN117560226B (en) Method and device for data transmission through VPN

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