1. Field of the Invention
The present invention relates to a hash value generation technique.
2. Description of the Related Art
To verify whether data has been falsified, a hash value calculated using a cryptographic hash algorithm is used. It has been already proved that SHA-1 as a cryptographic hash algorithm cannot ensure security, and it has been pointed out that security of the SHA-2 family (SHA-224, SHA-256, SHA-384, and SHA-512) may collapse. To solve this problem, the National Institute of Standards and Technology (NIST) sought submissions of new algorithms from the public to stipulate a next generation cryptographic hash algorithm (called SHA-3). The KECCAK algorithm (“The KECCAK reference”, Version 3.0, Jan. 14, 2011, (http://keccak.noekeon.org/Keccak-reference-3.0.pdf) (non-patent literature 1)) was chosen as the SHA-3 algorithm in October 2012.
In SHA-3, four lengths (224 bits, 256 bits, 384 bits, and 512 bits) are defined as the length (size) of a cryptographic hash value to be output. A cryptographic hash value having a fixed length is output for an input message (data) having an arbitrary length. In the KECCAK algorithm, a permutation function of repeating, 24 times, a round process which sequentially applies five steps (θ, ρ, π, χ, and τ) is used. The round process is executed for 1600-bit data called “state”.
In step π included in the round process of the above-described KECCAK algorithm, a parallel process using a data structure called “sheet” or “plane” as a unit is impossible. To increase the speed at which a hash value is generated, a pipeline process may be executed using a data structure called “lane” as a unit. More specifically, except for step π, a two-pipeline structure including steps θ and ρ (to be referred to as θ & ρ hereinafter) and steps χ and τ (to be referred to as χ & τ hereinafter) is plausible.
If, however, a hash value is generated using a lane structure as a unit, it is impossible to perform the parallel operation of the two pipelines of θ & ρ and χ & τ, thereby making it difficult to increase the speed. Furthermore, if a hash value is generated using a lane structure as a unit, it is impossible to start a subsequent round process until all the results of a preceding round process (the entire “state”) are temporarily written in a memory. It is, therefore, impossible to perform the parallel operation of the two pipelines between two continuous round processes, thereby making it difficult to increase the speed.
According to an aspect of the present invention, a hash value generation apparatus comprises: a θ operation unit configured to execute a θ operation included in a round process of a SHA-3 algorithm; a ρ operation unit configured to execute a ρ operation included in the round process; a π operation unit configured to execute a π operation included in the round process; a χ operation unit configured to execute a χ operation included in the round process; and an τ operation unit configured to execute an τ operation included in the round process, wherein the θ operation unit receives data for each sheet structure, and starts to execute the θ operation upon receiving data of three sheet structures.
According to another aspect of the present invention, a hash value generation apparatus comprises: a round process unit configured to perform a round process of a hash algorithm for data with a structure having m bits in an x-axis direction, n bits in a y-axis direction, and s bits in a z-axis direction, the round process unit comprising a first operation unit configured to calculate a sum of bits in the y-axis direction, and add the calculated sum to a bit at a predetermined position, a second operation unit configured to permute values of respective bits within an x-y plane, a third operation unit configured to rotate a value of each bit in the z-axis direction, a fourth operation unit configured to perform bitwise combination within a bit string in the x-axis direction, and a fifth operation unit configured to add a predetermined value to each bit, wherein the first operation unit receives data for a predetermined unit defined as a structure having 1 bit in the x-axis direction, n bits in the y-axis direction, and s bits in the z-axis direction, and starts an operation upon receiving data of three predetermined units.
According to still another aspect of the present invention, a hash value generation apparatus for generating a hash value based on a SHA-3 algorithm, comprises: a θ operation unit, a ρ operation unit, a π operation unit, a χ operation unit, and an τ operation unit for executing five operations including a θ operation, ρ operation, π operation, χ operation, and τ operation included in a round process of the SHA-3 algorithm, respectively, wherein the θ operation unit and the τ operation unit are configured to process data for each sheet structure, and the θ operation unit is configured to start the θ operation before all sheet structures forming one state structure are input from the τ operation unit.
The present invention enables improvement in throughput for generating a hash value.
Further features of the present invention will become apparent from the following description of exemplary embodiments (with reference to the attached drawings).
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Note that the following embodiments are merely examples, and do not intend to limit the scope of the present invention.
As the first embodiment of a hash value generation apparatus according to the present invention, an apparatus for generating a hash value of SHA-3 (KECCAK algorithm) will be exemplified. Note that in the following explanation, a specific data length and bit value may be indicated but the present invention is not limited to them.
The KECCAK algorithm as a prior technique will be explained first. Note that more detailed specifications are given in non-patent literature 1 described in “BACKGROUND OF THE INVENTION”
Reference numerals 102 and 103 denote initial values, respectively. All bits of each initial value are 0. Although a case in which all bits of the initial value are 0 will be described, the present invention is not limited to this. Furthermore, the initial value 102 has a length of 1024 bits which is equal to that of the above-described message block, and the total length of the initial values 102 and 103 is 1600 bits. Reference numeral 104 denotes a bitwise exclusive OR (XOR) operation unit. That is, the XOR operation unit 104 outputs, as 1024-bit data, a result of exclusive-ORing two 1024-bit input data for each bit.
Reference numeral 105 denotes a permutation function KECCAK-f, which receives two input data and outputs two data. The permutation function KECCAK-f 105 will be described in detail later with reference to
Data structures used in the round process of the KECCAK algorithm and five steps described above will be explained in detail below.
Note that although a case in which the input data has a length of 1600 bits will be described in the first embodiment, the present invention is not limited to this. Furthermore, although data with the state structure is processed as a rectangular parallelepiped data structure having a width (x-axis direction) of 5 bits, a height (y-axis direction) of 5 bits, and a depth (z-axis direction) of 64 bits will be explained, the present invention is not limited to this. For example, the input data may have a length of 800 bits, and data with the state structure may be processed as a rectangular parallelepiped data structure having a width of 5 bits, a height of 5 bits, and a depth of 32 bits.
Moreover, the plane structure, sheet structure, lane structure, and column structure are changed according to the number of bits of each of the width (x-axis direction), height (y-axis direction), and depth (z-axis direction) of the state structure. That is, assume that data with the state structure have m bits in the x-axis direction, n bits in the y-axis direction, and s bits in the z-axis direction. In this case, the plane structure is a planar structure having m bits in the x-axis direction, 1 bit in the y-axis direction, and s bits in the z-axis direction. The sheet structure is a planar structure having 1 bit in the x-axis direction, n bits in the y-axis direction, and s bits in the z-axis direction. The lane structure is a linear structure having 1 bit in the x-axis direction, 1 bit in the y-axis direction, and s bits in the z-axis direction. The column structure is a linear structure having 1 bit in the x-axis direction, n bits in the y-axis direction, and 1 bit in the z-axis direction.
A method of generating input data to the first round process R 201 based on the input data 202 and 203 input to the KECCAK-f 105 will be described. The input data 202 and 203 are sequentially concatenated to generate a 1600-bit data block. The 1600-bit data is divided by 64 bits to generate 25 lane structures. Finally, the 25 lane structures are arranged along the x-y plane in the numerical order shown in
Five steps (steps θ, ρ, π, χ, and τ) constituting the round process R 201 will be explained. Note that in each step, each of input data and output data has a state structure.
where x falls within the range from 0 to 4, y falls within the range from 0 to 4, and z falls within the range from 0 to 63.
It is apparent from the above-described operation contents in each step (step θ, ρ, π, χ, or τ) that the following constraint is imposed on the start of the operation in each step.
Therefore, when the calculation result of the preceding stage (step θ) is output for one lane structure, the operation in step ρ can be started.
That is, in step θ or χ, when data for at least three sheet structures are output and received from the step of the preceding stage, the operation can be started.
In other words, it is seen that performing an operation for each sheet structure makes it possible to start to execute the first stage (step θ) of the succeeding round when data of three sheet structures are output from the last stage (step τ) of the preceding round. An arrangement for performing a round process for each sheet structure will be described below.
Reference numeral 1902 denotes an exclusive OR (XOR) operation unit which exclusive-ORs a message block and internal data every time the round process is performed 24 times; 1903, a processing block for simultaneously performing steps θ and ρ; 1904, a processing block including a register for holding the entire internal data and an operation unit for performing step π; and 1905, a processing block for simultaneously performing steps χ and τ.
Reference numeral 2004 denotes a circuit (to be referred to as a θ & ρ circuit hereinafter) for calculating steps θ and ρ. As described above, the circuit 2004 receives data of sheet structures in ascending order of x coordinates (the order of x=0, 1, 2, 3, and 4). Note that sheet structures are output in the order of x=1, 2, 3, 4, and 0. Reference numeral 2005 denotes a five-stage register, each stage of which stores information of one sheet structure. The five-stage register 2005 transfers stored data to the succeeding stage for one clock.
Reference numeral 2006 denotes a circuit for processing step π. The register 2005 generally holds data input from upstream of it but is configured to hold, when executing step π, output data from the circuit 2006.
Reference numeral 2007 denotes a circuit (to be referred to as a χ & τ circuit hereinafter) for processing steps χ and τ, which outputs each sheet structure as a result; and 2008, a multiplexer. When calculation of a hash value starts, the multiplexer 2008 outputs 0 for initialization; otherwise, it outputs data in the middle of calculation intact.
Reference numeral 2101 denotes input data. As described above, one sheet structure is input as input data for one clock. Reference numeral 2102 denotes a combinational circuit which serves as a logical circuit for actually performing the operations in steps θ and ρ described above.
Reference numeral 2103 denotes a two-stage register, each stage of which stores information of one sheet structure; and 2104, a two-stage register, each stage of which stores information of one sheet structure. In this example, the two-stage register 2104 stores information of sheet structures at x=0 and x=1.
Reference numeral 2105 denotes a multiplexer which outputs the input data 2101 intact for the first five clocks after the start of the operation, and outputs data from the two-stage register 2104 for two succeeding clocks. Reference numeral 2106 denotes output data which is output for each sheet structure. Note that in the arrangement shown in
Reference numeral 2201 denotes input data. As described above, data for three sheet structures are input, as input data, from the register of the preceding stage for one clock. Reference numeral 2202 denotes a combinational circuit which serves as a logical circuit for actually performing the operations in steps χ and τ described above; 2203, a two-stage register, each stage of which stores information of one sheet structure, and which stores sheet structures at x=0 and x=1; 2204, a multiplexer which outputs the input data 2201 intact for the first four clocks after the start of the operation, and outputs a value from the register 2203 for one succeeding clock; 2205, a multiplexer which outputs the input data 2201 intact for the first three clocks after the start of the operation, and outputs a value from the register 2203 for two succeeding clocks; and 2206, output data which is output for each sheet structure.
As described above, the implementation example according to the first embodiment is characterized in that a path from the output of the χ & τ circuit 2007 to the input of the θ & ρ circuit 2004 is connected to only the combinational circuit. That is, the arrangement includes no latch circuit, and thus can pass data within one clock.
<Case in which Processing is Performed Using Lane Structure as Unit>
An implementation example, in which processing is performed using a lane structure as a unit, to be compared with the above-described implementation example according to the first embodiment will be explained below.
Reference numeral 1801 denotes input data. One lane structure (64-bit data) is received from the input data 1801 for one clock. Note that lane structures are received from one state structure in the order shown in
Reference numeral 1802 denotes an operation unit for exclusive-ORing a message block and internal data every time the round process is executed 24 times.
Reference numeral 1803 denotes a register for holding the entire internal data and a processing block for executing step π. Note that as described above, the operation in step π becomes executable only after the operation in step ρ is completed. Reference numeral 1804 denotes a processing block for executing steps θ and ρ.
Reference numeral 1805 denotes a processing block for executing steps χ and τ; 1806, a multiplexer which outputs data from the processing block 1804 for the first half of the round process, and outputs data from the processing block 1805 for the second half of the round process; and 1807, output data which is output for each lane structure upon completion of calculation.
<Comparison>
As will be apparent by comparing
As a result, the processing throughput improves.
Aspects of the present invention can also be realized by a computer of a system or apparatus (or devices such as a CPU or MPU) that reads out and executes a program recorded on a memory device to perform the functions of the above-described embodiment(s), and by a method, the steps of which are performed by a computer of a system or apparatus by, for example, reading out and executing a program recorded on a memory device to perform the functions of the above-described embodiment(s). For this purpose, the program is provided to the computer for example via a network or from a recording medium of various types serving as the memory device (e.g., computer-readable medium).
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2012-241106, filed Oct. 31, 2012, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2012-241106 | Oct 2012 | JP | national |