WO2022158549A1 - Processing element, control method and control program therefor, and processing device - Google Patents

Processing element, control method and control program therefor, and processing device Download PDF

Info

Publication number
WO2022158549A1
WO2022158549A1 PCT/JP2022/002090 JP2022002090W WO2022158549A1 WO 2022158549 A1 WO2022158549 A1 WO 2022158549A1 JP 2022002090 W JP2022002090 W JP 2022002090W WO 2022158549 A1 WO2022158549 A1 WO 2022158549A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
processing
hash value
memory
compression
Prior art date
Application number
PCT/JP2022/002090
Other languages
French (fr)
Japanese (ja)
Inventor
テイ ホン トラン
康彦 中島
Original Assignee
国立大学法人 奈良先端科学技術大学院大学
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 国立大学法人 奈良先端科学技術大学院大学 filed Critical 国立大学法人 奈良先端科学技術大学院大学
Priority to JP2022576751A priority Critical patent/JPWO2022158549A1/ja
Publication of WO2022158549A1 publication Critical patent/WO2022158549A1/en

Links

Images

Classifications

    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09CCIPHERING OR DECIPHERING APPARATUS FOR CRYPTOGRAPHIC OR OTHER PURPOSES INVOLVING THE NEED FOR SECRECY
    • G09C1/00Apparatus or methods whereby a given sequence of signs, e.g. an intelligible text, is transformed into an unintelligible sequence of signs by transposing the signs or groups of signs or by replacing them by others according to a predetermined system
    • 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/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials

Definitions

  • the present invention relates to a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, its control method and control program, and a processing device.
  • Blockchain technology is used to ensure the security of decentralized cryptocurrencies such as Bitcoin, Ripple, and Ethereum. Furthermore, recently, blockchain has been extensively researched for use in various fields such as autonomous driving, smart healthcare systems, robotics, and supply chains.
  • the current problem with blockchain is its high power consumption. This is because the hash function (SHA-256, SHA-512, etc.) needs to be calculated repeatedly.
  • the Bitcoin mining accelerator described in Patent Document 1 has a hardware circuit optimized for loop processing in SHA-256 message compression (MC) processing. Also, the processing system described in Patent Document 2 uses clock gates and hardwired to optimize SHA-256 loop processing in bitcoin mining.
  • MC message compression
  • An object of one aspect of the present invention is to provide a processing element or the like in which the above processing is improved.
  • a processing element is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block. , an expansion unit that expands to a bit sequence longer than the bit length, and a compression unit that repeats loop processing on the expanded bit sequence and compresses it to the intermediate hash value, wherein the expansion unit and the compression
  • the section executes one loop processing of the decompression section and a part of the one loop processing of the compression section in parallel, and the compression section uses the word calculated by the one loop processing of the decompression section. , the rest of the one-loop processing of the compression unit, which is not executed in parallel, is executed.
  • a processing apparatus includes a plurality of processing elements configured as described above, and further includes a control section for controlling the plurality of processing elements.
  • a processing element control method is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain:
  • a control method for a processing element comprising: an expansion unit that expands a bit sequence to a longer bit sequence; and a compression unit that repeats loop processing on the expanded bit sequence and compresses the expanded bit sequence to the intermediate hash value, wherein the expansion unit and the a step of causing the compression unit to execute one loop process of the decompression unit and a part of the one loop process of the compression unit in parallel; and a step of executing the remaining processes, which are not executed in parallel, of the one loop process of the compression unit, using the words obtained.
  • processing for repeatedly calculating hash functions can be improved.
  • FIG. 3 is a block diagram showing a schematic configuration of an ALU in PE of the hash value calculation device according to one embodiment of the present invention
  • FIG. FIG. 4 is a diagram for explaining an outline of a method for calculating a value of SHA-256; It is a block diagram which shows schematic structure of the said hash value calculating apparatus. It is a block diagram which shows schematic structure of said PE. 4 is a timing chart showing an example of the flow of processing in the ME calculation section and MC calculation section of the ALU; 3 is a block diagram showing a schematic configuration of an input-side shift buffer in the PE; FIG. 4 is a timing chart showing an example of the flow of processing in the shift buffer; 3 is a block diagram showing a schematic configuration of an output-side shift buffer in the PE; FIG.
  • FIG. 4 is a timing chart showing an example of the flow of processing in the shift buffer; 1 is a block diagram showing an overview of double hashing in bitcoin mining; FIG. FIG. 4 is a block diagram showing a schematic configuration of a PE in a hash value computing device according to another embodiment of the present invention; It is a block diagram which shows the detail of the update part in said PE. FIG. 4 is a block diagram showing a schematic configuration of an embedded system according to another embodiment of the present invention; FIG.
  • the hash value calculation device of this embodiment performs calculation of SHA (Secure Hash Algorithm)-256, which is a cryptographic hash function, on input data.
  • SHA Secure Hash Algorithm
  • FIG. 2 is a diagram for explaining an outline of a method for calculating a SHA-256 value (hash value).
  • the message is padded to convert it into a bit sequence with a length that is a multiple of 512, and the bit sequence is divided into message blocks M of 512 bits.
  • the message block M is divided into 32-bit words W 0 -W 15 .
  • ME messages expansion
  • the above ME calculation is represented by the following equation (1).
  • the logic functions ⁇ 0 and ⁇ 1 are represented by the following equation (2).
  • S n (x) is a function that cyclically shifts x to the right by n bits.
  • R n (x) is a function that shifts x right by n bits.
  • MC message compression
  • the word Kj is a constant defined in the standard.
  • the logic functions ⁇ 0 , ⁇ 1 , Ch, and Maj are represented by the following equations (4).
  • FIG. 3 is a block diagram showing a schematic configuration of the hash value computing device of this embodiment.
  • the hash value calculation device 10 includes a controller 11 (control unit), a GRAM (Global Random Access Memory) 12, a bus 13, a plurality of processing elements (PE) 14, and a bus IF ( interface) 15. That is, the hash value calculation device 10 is a multi-core processor having multiple PEs 14 .
  • the controller 11 comprehensively controls the operations of various components of the hash value calculation device 10, and is composed of a computer including a CPU (Central Processing Unit) and memory, for example. Operation control of various configurations is performed by causing a computer to execute a control program.
  • a computer including a CPU (Central Processing Unit) and memory, for example. Operation control of various configurations is performed by causing a computer to execute a control program.
  • CPU Central Processing Unit
  • the GRAM 12 stores information that is widely used by the hash value calculation device 10, and is composed of a storage device such as a flash memory.
  • the bus 13 is for transferring data between the GRAM 12, a plurality of PEs 14, and the like.
  • PE 14 is the processor core. Details of the PE 14 will be described later.
  • a bus IF 15 is for transmitting and receiving data to and from an external device.
  • FIG. 4 is a block diagram showing a schematic configuration of the PE 14. As shown in FIG. As shown in FIG. 4, the PE 14 comprises an ALU (Arithmetic Logic Unit) 20, two RAMs 21 and 22, four shift buffers 23-26, and an adder 27. In this embodiment, each PE 14 has the function of calculating an intermediate hash value.
  • ALU Arimetic Logic Unit
  • the ALU 20 performs arithmetic operations and logic operations, and in this embodiment, performs the ME operation and the MC operation. Details of the ALU 20 will be described later.
  • the RAM 21 (expansion memory) stores the data (words W 0 to W 63 ) used in the ME operation, and is hereinafter referred to as "WRAM 21".
  • WRAM 21 words W 0 to W 63
  • words W 0 to W 15 are written from the GRAM 12 to the WRAM 21 via the bus 13 .
  • Words W 0 -W 63 are written from ALU 20 to WRAM 21 via shift buffer 25 .
  • the RAM 22 (compression memory) stores the initial hash values H 0 to H 7 used in the MC calculation, and updates them with the calculated intermediate hash values HO 0 to HO 7 .
  • HRAM 22 ”.
  • the initial hash values H 0 to H 7 are written from the GRAM 12 to the HRAM 22 via the bus 13 .
  • Intermediate hash values HO 0 to HO 7 are written from adder 27 .
  • the intermediate hash values HO 0 to HO 7 are the sums of the initial hash values H 0 to H 7 and the variables a to h calculated in the final loop of the MC calculation, respectively.
  • the initial values H 0 to H 7 of the hash values are constants defined by the standard for the message block M of the first stage, and for the other message blocks M, intermediate values calculated from the message block M of the previous stage.
  • Hash values HO 0 to HO 7 are constants defined by the standard for the message block M of the first stage, and for the other message blocks M, intermediate values calculated from the message block M of the previous stage.
  • the shift buffer 23 (input buffer) temporarily stores data read from the WRAM 21 .
  • the shift buffer 23 sends the temporarily stored data to the ALU 20 .
  • the shift buffer 23 is described as "SBi1".
  • the shift buffer 24 (input buffer) temporarily stores initial hash values H 0 to H 7 read from the HRAM 22 .
  • the shift buffer 24 sends the temporarily stored initial hash values H 0 to H 7 to the ALU 20 and the adder 27 .
  • the shift buffer 24 is described as "SBi2".
  • the shift buffer 25 (output buffer) temporarily stores the word calculated by the ALU 20 .
  • the shift buffer 25 writes the temporarily stored word to the WRAM 21 .
  • the shift buffer 25 is described as "SBo1".
  • the shift buffer 26 (output buffer) temporarily stores variables a to h calculated by the ALU 20 .
  • the shift buffer 26 sends the temporarily stored variables a to h to the adder 27 . Note that the shift buffer 26 is described as "SBo2" in FIG.
  • the adder 27 adds the initial hash values H 0 to H 7 from the shift buffer 24 and the variables a to h from the shift buffer 26 to calculate the intermediate hash values HO 0 to HO 7 . is.
  • the adder 27 writes the calculated intermediate hash values HO 0 to HO 7 in the HRAM 22 and transmits them to the GRAM 12 via the bus 13 .
  • the adder 27 has four adders.
  • the ALU 20 has a configuration including an ME operation section 30 (expansion section), an MC operation section 31 (compression section), a multiplexer 32 and a demultiplexer 33 .
  • the ME calculation unit 30 uses data input from the WRAM 21 via the shift buffer 23 to execute the ME calculation.
  • the ME calculation unit 30 outputs the data calculated by the ME calculation to the WRAM 21 via the shift buffer 25 and to the MC calculation unit.
  • the MC calculation unit 31 uses the data from the ME calculation unit 30 and the data from the multiplexer 32 to execute the MC calculation.
  • the MC calculation unit 31 sends the data calculated by the MC calculation to the demultiplexer 33 .
  • the multiplexer 32 acquires the variables a to h input to the MC calculation unit 31 from the HRAM 22 via the shift buffer 24 in the loop #0, and from the demultiplexer 33 in the other loops #1 to #63. It is to switch.
  • the demultiplexer 33 outputs (feeds back) the variables a to h output by the MC calculation unit 31 to the multiplexer 32 for the next loops #1 to #63 in the loops #0 to #62, and in the final loop #63 It switches to output to HRAM 22 via shift buffer 26 and adder 27 .
  • FIG. 1 is a block diagram showing a schematic configuration of the ALU 20. As shown in FIG. FIG. 1 shows the j-th loop processing in the ALU 20. FIG. Note that in FIG. 1, Wj is shown as W( j ).
  • W(j-15) is subjected to the operation of the logic function ⁇ 0 by the logic operation unit SIG0 , and is added to W(j-16) by the arithmetic operation unit Adder. be. Further, W(j-2) is subjected to the logic function .sigma.1 by the logic operation section SIG1, and is added to W(j-7) by the arithmetic operation section Adder.
  • the two words calculated in the first arithmetic processing ME-1 are added by the arithmetic operation unit Adder.
  • the calculation result is output to the WRAM 21 via the shift buffer 25 as a word W(j), and is also sent to the MC calculation unit 31 .
  • the first to fourth calculation processes MC-1 to MC-4 are performed in order.
  • the constant K(j) and the variable h are added by the arithmetic operation unit Adder.
  • the logical operation part EP1 performs the operation of the logical function ⁇ 1 on the variable e
  • the logical operation part CH performs the operation of the logical function Ch on the variables e, f, and g.
  • the two words are added in the arithmetic operation unit Adder.
  • the second arithmetic processing MC-2 the two words calculated in the first arithmetic processing MC-1 are added by the arithmetic operation unit Adder.
  • the third calculation processing MC-3 the word calculated in the second calculation processing MC-2 and the word W(j) from the ME calculation section 30 are added by the arithmetic calculation section Adder.
  • the result of this operation is word T1.
  • the logical operation unit EP0 performs the operation of the logical function ⁇ 0 on the variable a, and the logical operation unit MAJ operates on the variables a, b, and c. Maj is calculated, and the calculated two words are added in the arithmetic operation unit Adder. The result of this operation is word T2.
  • the word T1 and the variable d are added in the arithmetic operation unit Adder and then output as the loop variable e.
  • the word T1 and the word T2 are added in the arithmetic operation unit Adder and output as the variable a of the next loop.
  • variables a to c and e to g are output as variables b to d and f to h of the next loop via wire assignment unit WireAssign.
  • the first arithmetic processing ME-1 of the ME arithmetic unit 30 and the first arithmetic processing MC-1 of the MC arithmetic unit 31 are executed in parallel, and the second arithmetic processing ME-1 of the ME arithmetic unit 30 is executed in parallel.
  • the second arithmetic processing MC-2 of the MC arithmetic unit 31 are executed in parallel. Then, using the word W(j) calculated by the ME calculation unit 30, the third calculation processing MC-3 and the fourth calculation processing MC-4 of the MC calculation unit 31 are executed.
  • the number of clocks required to execute each loop process can be reduced to 4 clocks compared to the case where the ME arithmetic unit 30 and the MC arithmetic unit 31 are executed separately. Also, an intermediate hash value for message block M can be calculated with only one PE 14 . Therefore, the number of PEs 14 required to determine the final hash value from the message can be reduced.
  • WRAM 21 stores message block M (words W 0 to W 15 ) and words W 16 to W 63
  • HRAM 22 stores initial hash values. This eliminates the need to write the words W 16 to W 63 to the external memory and to read the message block M, the initial hash values, and the words W 16 to W 63 from the external memory. Therefore, the processing efficiency of the PE 14 can be improved.
  • the WRAM 21 stores the message block M (words W 0 to W 15 ), and the intermediate hash value can be calculated from the data stored in the HRAM 22 . Therefore, if the WRAM 21 stores the next message block M, the next intermediate hash value corresponding to the next message block M can be calculated using the intermediate hash value. By repeating these steps, only one PE 14 can obtain the final hash value from the message.
  • the WRAM 21 has four memory units WM1 to WM4, and data of the first to fourth message blocks M are stored in the memory units WM1 to WM4, respectively.
  • the data of the first to fourth message blocks M are different, but part or all of them may be the same.
  • Each of the memory units WM1 to WM4 should have at least a memory size (512 bits) capable of storing 16 words W j ⁇ 16 to W j ⁇ 1 , and 64 words W 0 to W 63 . may have a memory size (2048 bits) capable of storing .
  • the HRAM 22 is configured to include four memory units HM1 to HM4.
  • the memory units HM1 to HM4 store first to fourth initial values H 0 to H 7 of hash values corresponding to the first to fourth message blocks M stored in the memory units WM1 to WM4 of the WRAM 21, respectively.
  • the first through fourth initial hash values H 0 through H 7 are updated by the first through fourth intermediate hash values HO 0 through HO 7 corresponding to the first through fourth message blocks M, respectively.
  • Each of the memory units HM1 to HM4 may have at least a memory size (256 bits) capable of storing initial hash values H 0 to H 7 .
  • FIG. 5 is a timing chart showing an example of the flow of processing in the ME calculation section 30 and the MC calculation section 31.
  • F1 to F4 respectively indicate the processing for the first to fourth message blocks M stored in WM1 to WM4.
  • the process F1 for the first message block M is performed at the following timing. As shown in FIG. 5, first, at clock CK0, the 0th loop is started, data is read from the memory units WM1 and HM1, and first arithmetic processes ME-1 and MC-1 are executed.
  • second arithmetic processing ME-2 and MC-2 are executed.
  • the word W(16) calculated in the second arithmetic processing ME-2 is stored in the memory section WM1 and sent to the MC arithmetic section 31 as well.
  • the first loop is started, data is read from the memory unit WM1, and the first arithmetic processing ME-1 is executed. Further, the first arithmetic processing MC-1 is executed using the variables a to h calculated in the fourth arithmetic processing MC-4 at the previous clock CK3. Thereafter, the above operation is repeated.
  • the 0th loop is started at the clock CK1, and the same operations as the above operations are repeated.
  • the processes F3 and F4 relating to the third and fourth message blocks M start the 0th loops at the clocks CK2 and CK3, respectively, and the same operations as described above are repeated.
  • the first loop of process F1 relating to the first message block M is started.
  • the PE 14 of this embodiment can calculate four loop processes corresponding to four message blocks M in four clocks. That is, one loop process can be executed per clock. As a result, efficiency of processing in the ALU 20 can be improved.
  • each of the WRAM 21 and the HRAM 22 is four in this embodiment, it is not limited to this.
  • Each of the WRAM 21 and the HRAM 22 should be provided with a memory section for the number of clocks required for one loop.
  • FIG. 6 is a block diagram showing a schematic configuration of shift buffers 23 and 24. As shown in FIG.
  • the shift buffer 23 has a configuration including four shift registers 40 to 43 and a multiplexer 44 .
  • the shift register 40 stores four words (W(j-16), W(j-15), W(j-7) and W(j-2)) from the memory portion WM1 of the WRAM 21.
  • FIG. Similarly, the shift registers 41 to 43 store the four words from the memory sections WM2 to WM4 of the WRAM 21, respectively.
  • the multiplexer 44 selects one of the shift registers 40 to 43 and inputs the four words of the selected shift register to the ME operation section 30 of the ALU 20 .
  • the shift buffer 24 has a configuration including four shift registers 45 to 48 and a multiplexer 49 .
  • the shift registers 45 to 48 store the initial hash values H 0 to H 7 from the memory units HM1 to HM4 of the HRAM 22, respectively.
  • the multiplexer 49 selects one of the shift registers 45 to 48, and inputs the initial values H 0 to H 7 of the selected shift register to the MC calculation unit 31 of the ALU 20 via the multiplexer 32 as variables a to h. It is something to do.
  • the multiplexer 49 also sends the initial hash values H 0 to H 7 of the selected shift register to the adder 27 .
  • FIG. 7 is a timing chart showing an example of the flow of processing in the shift buffer 23.
  • FIG. 7 in the shift register 40, four words used by the MC calculation unit 31 are sequentially read out from the memory unit WM1 in a certain loop at the clocks CK10 to CK13. Then, at clock CK13, the stored four words are input to MC operation section 31 of ALU 20 via multiplexer 44.
  • FIG. This initiates a certain loop of process F1 for the first message block M as described above.
  • the four words used by the MC calculation unit 31 are sequentially read from the memory unit WM2 in a certain loop during the clocks CK11 to CK14. Then, at clock CK14, the stored four words are input to MC operation section 31 of ALU 20 via multiplexer 44.
  • FIG. This initiates a certain loop of process F2 for the second message block M as described above.
  • the shift buffer 23 of the present embodiment can sequentially read data required by the ME calculation unit 30 from the WRAM 21 and output them all at once to the ME calculation unit 30 at a predetermined timing. This eliminates the need for the ME calculation unit 30 to wait to read data from the WRAM 21 . As a result, processing efficiency in the processing elements can be further improved. Further, since the shift buffer 23 includes the shift registers 40 to 43 corresponding to the memory units WM1 to WM4 of the WRAM 21, it is possible to avoid the delay in processing speed due to the provision of only one shift register. Since the shift buffer 24 is similar to the shift buffer 23, the description thereof will be omitted.
  • FIG. 8 is a block diagram showing a schematic configuration of shift buffers 25 and 26. As shown in FIG.
  • the shift buffer 25 has a configuration including four shift registers 50 to 53 and a demultiplexer .
  • the demultiplexer 54 outputs the word W(j) calculated by the ME calculation unit 30 to any one of the shift registers 50-53.
  • the shift registers 50-53 store the words W(j) for the first to fourth message blocks M via the demultiplexer 54, respectively.
  • the shift registers 50-53 write the stored word W(j) to the memory units WM1-WM4, respectively.
  • the shift buffer 26 has a configuration including four shift registers 55 to 58 and a demultiplexer 59 .
  • the demultiplexer 59 outputs variables a to h of the final loop calculated by the MC calculation unit 31 to any one of the shift registers 55 to 58 .
  • the shift registers 55 to 58 store final loop variables a to h for the first to fourth message blocks M via the demultiplexer 54, respectively.
  • the variables a to h stored in the shift registers 55 to 58 are respectively added to the initial values H 0 to H 7 of the hash values from the shift registers 45 to 48 in the adder 27 to obtain the intermediate hash values HO 0 to HO7 is written in the memory units HM1 to HM4.
  • FIG. 9 is a timing chart showing an example of the flow of processing in the shift buffer 26.
  • variables a to h of the final loop regarding the first message block calculated by the MC calculation unit 31 of the ALU 20 are stored via the demultiplexer 33 at the clock CK20.
  • the variables a to h are sequentially sent to the first addition section of the adder 27 at the clocks CK21 to CK28.
  • the variables a to h are sequentially added to the initial hash values H 0 to H 7 of the first message block obtained from the shift register 45 to obtain an intermediate hash value HO 0 of the first message block. . . . HO7 are sequentially written in the memory portion HM1 of the HRAM 22.
  • variables a to h of the final loop regarding the second message block calculated by the MC calculation unit 31 of the ALU 20 are stored via the demultiplexer 33 at the clock CK21. Then, the variables a to h are sequentially sent to the second adder of the adder 27 at the clocks CK22 to CK29. In the second adder, the variables a to h are sequentially added to the initial hash values H 0 to H 7 of the second message block obtained from the shift register 45 to obtain an intermediate hash value HO 0 of the second message block. . . . HO7 are sequentially written in the memory portion HM2 of the HRAM22.
  • the shift registers 57 and 58 are also the same.
  • the shift buffer 25 of this embodiment can sequentially write the data output by the ME calculation unit 30 to the WRAM 21 . This eliminates the need for the ME calculation unit 30 to wait to write the data to the WRAM 21 . As a result, processing efficiency in the PE 14 can be further improved. Further, since the shift buffer 25 includes the shift registers 50 to 53 corresponding to the memory units WM1 to WM4 of the WRAM 21, it is possible to avoid the delay in processing speed due to the provision of only one shift register. Since the shift buffer 26 is similar to the shift buffer 25, the description thereof will be omitted.
  • the PE 14 calculates 4 ⁇ L intermediate hash values HO 0 to HO 7 corresponding to 4 ⁇ L (L is an integer of 2 or more) message blocks M, respectively.
  • the ALU 20 should execute as follows. That is, first, four intermediate hash values HO 0 to HO 7 corresponding to the four message blocks M of the first group are calculated. Next, four intermediate hash values HO 0 to HO 7 corresponding to the four message blocks M of the second group are calculated. Thereafter, the processing is repeatedly executed up to the L-th group.
  • a large number of intermediate hash values HO 0 to HO 7 corresponding to a large number of message blocks M can be calculated by one PE.
  • the PE 14 sets the four intermediate hash values corresponding to the four message blocks of a certain group to be the four initial hash values of the four message blocks of the next group. be done.
  • the hash value calculation device of this embodiment performs the above-described SHA-256 calculation twice on input data (double hash).
  • the hash value calculation device of this embodiment is suitable for, for example, bitcoin mining.
  • Fig. 10 is a block diagram showing an overview of double hashing in bitcoin mining.
  • the upper part of FIG. 10 shows the structure of input data for each block in the Bitcoin blockchain.
  • the lower part of FIG. 10 shows an overview of the processing for mining the above blocks.
  • the input data DAT is used in bitcoin mining processing. As shown in the upper part of FIG. 10, the input data DAT consists of a 32-bit version value, a 256-bit hash value (hash value of the previous block) when the block chain was created last time, and a 256-bit Merkle root (Hash value of the previous block). root) hash value, 32-bit timestamp, 32-bit target, 32-bit Nonce, and 384-bit padding.
  • the input data DAT is divided into two message blocks M1 and M2.
  • the hash function SHA-256(1) is calculated using the first message block M1 and the initial hash value (initial hash value) to obtain the first hash value Ha-1.
  • This process may be executed by the PE 14 of the hash value calculation device in FIGS. 1 to 9, or may be executed by another calculation device.
  • the initial hash value is a constant.
  • the hash function SHA-256(2) is calculated using the 256-bit first hash value Ha-1 and the second message block M2 to obtain the second hash value Ha-2.
  • the 256-bit second hash value Ha-2 is padded to create a 512-bit third message block M3.
  • the hash function SHA-256(3) is calculated using the third message block M3 and the initial hash value to obtain the final hash value Ha-F. In other words, double hashing is performed using the first hash value Ha-1 and the second message block M2 to obtain the final hash value Ha-F.
  • the nonce is changed (specifically, incremented by 1), and the repeat the action.
  • the nonce is determined to be correct and a new block is generated for the blockchain.
  • the hash value calculation device 10 of this embodiment differs from the hash value calculation devices shown in FIGS. 1 to 9 in the configuration of the PE, and the other configurations are the same.
  • FIG. 11 is a block diagram showing a schematic configuration of the PE 16 in the hash value calculation device 10 of this embodiment.
  • the PE 16 of this embodiment computes the hash functions SHA-256(2) and SHA-256(3) shown in FIG.
  • the first hash value Ha-1 and the second message block M2 used in the hash function SHA-256(2) are pre-stored in the GRAM 12 (see FIG. 3).
  • FIG. 11 is a block diagram showing a schematic configuration of the PE 16 in the hash value calculation device 10 of this embodiment.
  • the PE 16 of this embodiment computes the hash functions SHA-256(2) and SHA-256(3) shown in FIG.
  • the PE 16 of this embodiment schematically includes two sets of the ALU 20, WRAM 21, HRAM 22, shift buffers 23 to 26, and adder 27 in the PE 14 shown in FIG.
  • the PE 16 of this embodiment includes a first set of ALU 60, WRAM 61, HRAM 62, shift buffers 63-66, and adder 67, and a second set of ALU 70, WRAM 71, HRAM 72, shift buffers 73-76, and an adder 77 .
  • ALUs 60, 70, WRAMs 61, 71, HRAMs 62, 72, shift buffers 63-66, 73-76, and adders 67, 77 are equivalent to ALU 20, WRAM 21, HRAM 22, shift buffers 23-26, and adders shown in FIG. Since it has the same function as the device 27, its explanation is omitted.
  • the second message block M2 from GRAM12 is stored in WRAM61 and the first hash value Ha-1 from GRAM12 is stored in HRAM62. Thereby, the adder 67 calculates the second hash value Ha-2.
  • the second hash values Ha-2 from the first set are stored in WRAM 71 as words W 0 -W 7 of the third message block M3, and the padding from GRAM 12 is the word W of the third message block M3. 8 to W 15 are stored in the WRAM 71 . Also, the initial hash value from the GRAM 12 is stored in the HRAM 72 . Thereby, the adder 77 calculates the final hash value Ha-F.
  • the above double hashing can be realized by the PE 16 of this embodiment, and the PE 16 of this embodiment can be incorporated into a system that uses double hashing.
  • the PE 16 of this embodiment further comprises an updater 68 in the first set.
  • the updating unit 68 updates the nonce stored in the WRAM 61 .
  • FIG. 12 is a block diagram showing details of the updating unit 68. As shown in FIG. As shown in FIG. 12, the updating section 68 comprises an incrementer 68a and a multiplexer 68b.
  • the nonce contained in the second message block M2 is stored in WRAM 61 as word W3. Therefore, in the nineteenth loop, the incrementer 68a acquires the word W3 input from the shift buffer 63 to the ME operation unit 30 of the ALU 60 and increments it by one. Incrementer 68a sends the incremented word W3 to multiplexer 68b.
  • the 19th loop is the last time word W3 is used. That is, when the use of word W3 in the ME operation unit 30 is completed by the above input , word W3 is updated. Note that the updating unit 68 updates the word W3 at an arbitrary timing from when the use of the word W3 in the ME operation unit 30 of the ALU 60 ends to when all loop processing of the ME operation unit 30 ends. can be updated.
  • the multiplexer 68b writes the words W16 to W63 obtained from the ALU 60 through the shift buffer 65 to the WRAM 61 , and writes the word W3 incremented by the incrementer 68a to the WRAM 61 as a new word W3.
  • WRAM 61 will have a new word W3 stored.
  • the PE 16 can again loop the second message block M2 including the new nonce and calculate a new final hash value Ha-F.
  • the PE 16 can compute multiple final hash values Ha-F from multiple second message blocks M2 each containing multiple different nonces, and there is no limit to the amount of nonces that the PE 16 can utilize.
  • the PE 16 of this embodiment further includes a determination unit 78 in the second set.
  • the determination unit 78 determines whether the final hash value Ha-F obtained from the ALU 70 via the shift buffer 76 is smaller than the target value.
  • the determination unit 78 determines that the final hash value Ha-F is not a valid hash value, and determines that the final hash value Ha-F is not valid. - Discard F.
  • the determination unit 78 determines that the final hash value Ha-F is a valid hash value.
  • the determination unit 78 outputs the final hash value Ha-F and the nonce corresponding to the final hash value Ha-F to the GRAM 12 . Then, the determination unit 78 instructs all the PEs 16 to end their operations.
  • the PE 16 of this embodiment successively updates the nonce included in the second message block M2, successively calculates the second hash value Ha-2, and successively calculates the final hash value Ha-F.
  • the final hash value Ha-F is a valid hash value in turn.
  • the determination unit 78 determines that the final hash value Ha-F is a valid hash value, the determination unit 78 instructs the controller 11 to end the operation of all the PEs 16, or instructs all the PEs 16. You can As a result, the subsequent unnecessary mining process can be avoided.
  • hash value calculation device 10 of the present embodiment is applied to mining of bitcoin, it can also be applied to mining of other blockchains. Further, although the hash value calculation device 10 of the present embodiment is applied to the double hash calculation, it can also be applied to the case of executing the calculation of the hash function three times or more.
  • FIG. 13 is a block diagram showing the schematic configuration of the embedded system of this embodiment.
  • an embedded system 80 includes a processor 81, a DDR (Double Data Rate) memory 82, an AMBA (Advanced Microcontroller Bus Architecture) bus 83, and the hash value calculation device 10 shown in FIGS. , and an AXI bus 84 .
  • DDR Double Data Rate
  • AMBA Advanced Microcontroller Bus Architecture
  • the processor 81 includes a CPU, cache, and memory management unit (MMU). Processor 81 and DDR memory 82 are connected via AMBA bus 83 . The processor 81 and hash value calculation device 10 are also connected via an AXI bus 84 . As shown in FIG. 13, the hash value calculation device 10 shown in FIGS. 1 to 12 can be incorporated into an embedded system.
  • MMU memory management unit
  • control blocks (especially the ALUs 20, 60, and 70) of the hash value calculation device 10 may be realized by a logic circuit (hardware) formed in an integrated circuit (IC chip) or the like, or may be realized by software. .
  • the hash value computing device 10 is equipped with a computer that executes program instructions, which are software that implements each function.
  • This computer includes, for example, one or more processors, and a computer-readable recording medium storing the program.
  • the processor reads the program from the recording medium and executes it, thereby achieving the object of the present invention.
  • a CPU Central Processing Unit
  • the recording medium a "non-temporary tangible medium" such as a ROM (Read Only Memory), a tape, a disk, a card, a semiconductor memory, a programmable logic circuit, etc. can be used.
  • a RAM Random Access Memory
  • the program may be supplied to the computer via any transmission medium (communication network, broadcast wave, etc.) capable of transmitting the program.
  • any transmission medium communication network, broadcast wave, etc.
  • one aspect of the present invention can also be implemented in the form of a data signal embedded in a carrier wave in which the program is embodied by electronic transmission.
  • the value of SHA-256 is obtained.
  • the present invention can be applied to any hash value calculation device that compresses .
  • a processing element is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain a bit sequence longer than the bit length. and a compression unit that repeats loop processing on the expanded bit sequence and compresses it to the intermediate hash value, and the expansion unit and the compression unit are one loop of the expansion unit processing and a part of one loop processing of the compression unit are executed in parallel, and the compression unit performs one loop processing of the compression unit using the word calculated by the one loop processing of the decompression unit. Among them, the remaining processes that are not executed in parallel are executed.
  • each loop process the arithmetic processing of the decompression unit and part of the arithmetic processing of the compression unit can be executed in parallel. As a result, the number of clocks required to execute each loop process can be reduced.
  • the expansion unit uses words calculated by one loop process in another loop process, and the compression unit uses variables calculated by one loop process in the next loop process. Then, the intermediate hash value is calculated by completing all the loop processes.
  • the processing element further comprises a decompression memory that stores the message block and the word, and a compression memory that stores an initial hash value used in the first loop processing of the compression unit. good too. According to the above configuration, it is not necessary to write the word to the external memory or to read the message block, the initial value of the hash value, and the word from the external memory. Therefore, the processing efficiency of the processing element can be improved.
  • the compression unit may update the initial value of the hash value stored in the compression memory with the intermediate hash value. According to the above configuration, by updating the message block stored in the expansion memory with the next message block, the processing element can calculate the next intermediate hash value. By repeating this, only one processing element can obtain the final hash value from the message.
  • each of the decompression memory and the compression memory may include a memory section for the number of clocks required for the compression section to execute one loop process.
  • a plurality of message blocks are stored in the plurality of memory units of the decompression memory, and initial hash values corresponding to the plurality of message blocks are stored in the plurality of memory units of the compression memory. memorize
  • a plurality of loop processes for a plurality of message blocks can be executed with the above number of clocks. That is, one loop process can be executed per clock.
  • processing efficiency in the processing elements can be further improved.
  • an input buffer for temporarily storing data input from the decompression memory to the decompression unit and an input buffer for temporarily storing data input from the compression memory to the compression unit and may be further provided.
  • the input buffer can sequentially read out the data required by the expansion section from the expansion memory and simultaneously output the data to the expansion section at a predetermined timing. This eliminates the need for the expansion unit to wait for reading the data from the expansion memory. Further, the input buffer can sequentially read the data required by the compression section from the compression memory and output them all at once to the compression section at a predetermined timing. This eliminates the need for the compression unit to wait to read the data from the compression memory. As a result, processing efficiency in the processing elements can be further improved.
  • the input buffer preferably includes buffer units corresponding to the plurality of memory units.
  • the processing element includes an output buffer for temporarily storing data to be output from the decompression unit to the decompression memory, and an output buffer for temporarily storing data to be output from the compression unit to the compression memory. You may have more.
  • the output buffer can sequentially write the data output by the expansion unit to the expansion memory. This eliminates the need for the expansion unit to wait for writing the data in the expansion memory. Further, the output buffer can sequentially write the data output from the compression unit to the compression memory. This eliminates the need for the compression unit to wait for writing the data in the compression memory. As a result, processing efficiency in the processing elements can be further improved.
  • the output buffer includes buffer units corresponding to the plurality of memory units.
  • the processing element includes a plurality of sets of the expansion unit, the compression unit, the expansion memory, and the compression memory, and one set of the compression units includes the compressed intermediate hash value may be written to the other set of the expansion memory as part of the other set of the message blocks.
  • a single processing element can be used to execute a hash function on the message block multiple times, such as double hashing.
  • the processing element can be applied to systems that utilize double hashes, such as Bitcoin.
  • the number of sets is two, and words in a predetermined range in the message block stored in the expansion memory of the first set are converted to An updating unit may be further provided for updating when the use of the word is finished.
  • An updating unit may be further provided for updating when the use of the word is finished.
  • the updating unit updates the word at an arbitrary timing from the end of use of the word in the expansion unit of the first set to the end of all loop processing of the first set. can do.
  • the processing element further comprises a determination unit that determines whether the intermediate hash value compressed by the compression unit of the second set is a final hash value, and that the final hash value is a valid hash value. good too.
  • the compression units of the second set can successively calculate the final hash values using the intermediate hash values successively calculated by the compression units of the first set. Accordingly, the determination unit can determine whether the successively calculated final hash values are valid hash values. As a result, bitcoin mining can be performed more efficiently.
  • the determination unit When determining that the final hash value is a valid hash value, the determination unit notifies an external device of the final hash value and the predetermined range of words corresponding to the final hash value. may terminate the operation of the processing element. This eliminates the need to execute the subsequent unnecessary mining process.
  • the processing elements according to each aspect of the present invention may be realized by a computer.
  • the processing elements are realized by the computer by operating the computer as each part (software element) included in the processing elements.
  • a control program for a processing element and a computer-readable recording medium recording it are also included in the scope of the present invention.
  • a processing apparatus includes a plurality of processing elements configured as described above, and further includes a control section for controlling the plurality of processing elements.
  • control unit sets the word change range for each processing element, so that the mining can be executed in parallel by a plurality of the processing elements, and the mining can be further performed. can be executed efficiently.
  • control unit when a final hash value determined to be a valid hash value and a predetermined range of words corresponding to the final hash value are acquired from a certain processing element, the control unit operates on all processing elements. should be instructed to end the This eliminates the need to execute the subsequent unnecessary mining process.
  • a processing element control method is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain:
  • a control method for a processing element comprising: an expansion unit that expands a bit sequence to a longer bit sequence; and a compression unit that repeats loop processing on the expanded bit sequence and compresses the expanded bit sequence to the intermediate hash value, wherein the expansion unit and the a step of causing the compression unit to execute one loop process of the decompression unit and a part of the one loop process of the compression unit in parallel; and a step of executing the remaining processes, which are not executed in parallel, of the one loop process of the compression unit, using the words obtained.
  • Hash value calculation device processing device
  • controller control unit
  • 16 PE 15 bus interface 20, 60, 70 ALUs 21, 61, 71 WRAM (development memory) 22, 62, 72 HRAM (memory for compression) 23, 24, 63, 64, 73, 74 shift buffers (input buffers) 25, 26, 65, 66, 75, 76 shift buffers (output buffers) 27, 67, 77
  • Adder 30 ME calculation unit (development unit) 31
  • MC calculation unit compression unit
  • 32 44, 49, 68b Multiplexers 33, 54, 59
  • Demultiplexers 40-43, 45-48 Shift registers (input buffers) 50-53, 55-58 shift register (buffer for output)
  • 68 update unit 68a incrementer 78 decision unit
  • 80 system processor
  • DDR memory memory
  • AMBA bus AMBA bus 84
  • AXI bus AXI bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention improves processing for repeatedly calculating a hash function. This processing element comprises: an ME computation unit (30) that repeatedly performs loop processing on a message block to decompress the message block into a plurality of words; and an MC computation unit (31) that repeatedly performs loop processing on the decomposed plurality of words to compress the words into an intermediate hash value. The ME computation unit (30) and the MC computation unit (31) execute one loop processing of the ME computation unit (30) and a part of one loop processing of the MC computation unit (31) in parallel. The MC computation unit (31) executes the remaining processing not executed in parallel out of the one loop processing of the MC computation unit (31) using words computed by the one loop processing of the ME computation unit (30).

Description

処理要素、その制御方法および制御プログラム、並びに処理装置Processing element, its control method and control program, and processing device
 本発明は、所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素、その制御方法および制御プログラム、並びに処理装置に関する。 The present invention relates to a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, its control method and control program, and a processing device.
 ブロックチェーンの技術は、例えば、ビットコイン(ビットcoin)、リップル(Ripple)、イーサリアム(Ethereum)などの分散化された暗号通貨の安全を確保するために利用されている。さらに、最近、ブロックチェーンについて、自動運転、スマートヘルスケアシステム、ロボティクス、サプライチェーンなど、多方面における利用が幅広く研究されている。 Blockchain technology is used to ensure the security of decentralized cryptocurrencies such as Bitcoin, Ripple, and Ethereum. Furthermore, recently, blockchain has been extensively researched for use in various fields such as autonomous driving, smart healthcare systems, robotics, and supply chains.
 ブロックチェーンにおける現在の問題点は、消費電力が大きいことにある。なぜなら、ハッシュ関数(SHA-256、SHA-512など)を繰り返し計算する必要があるからである。 The current problem with blockchain is its high power consumption. This is because the hash function (SHA-256, SHA-512, etc.) needs to be calculated repeatedly.
 これに対し、特許文献1に記載のビットコインマイニング用アクセラレータは、SHA-256のメッセージ圧縮(MC)処理におけるループ処理に最適化されたハードウェア回路を有している。また、特許文献2に記載の処理システムは、クロックゲートおよびハードワイヤードを用いて、ビットコインのマイニングにおけるSHA-256のループ処理を最適化している。 On the other hand, the Bitcoin mining accelerator described in Patent Document 1 has a hardware circuit optimized for loop processing in SHA-256 message compression (MC) processing. Also, the processing system described in Patent Document 2 uses clock gates and hardwired to optimize SHA-256 loop processing in bitcoin mining.
米国特許第10755242号明細書U.S. Patent No. 10755242 米国特許第10142098号明細書U.S. Patent No. 10142098
 しかしながら、ハッシュ関数を繰り返し計算する処理には、未だ改善の余地がある。 However, there is still room for improvement in the process of repeatedly calculating hash functions.
 本発明の一態様は、上記処理が改善された処理要素などを提供することを目的とする。 An object of one aspect of the present invention is to provide a processing element or the like in which the above processing is improved.
 上記の課題を解決するために、本発明の一態様に係る処理要素は、所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備えており、前記展開部および前記圧縮部は、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行し、前記圧縮部は、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行するものである。 In order to solve the above problems, a processing element according to one aspect of the present invention is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block. , an expansion unit that expands to a bit sequence longer than the bit length, and a compression unit that repeats loop processing on the expanded bit sequence and compresses it to the intermediate hash value, wherein the expansion unit and the compression The section executes one loop processing of the decompression section and a part of the one loop processing of the compression section in parallel, and the compression section uses the word calculated by the one loop processing of the decompression section. , the rest of the one-loop processing of the compression unit, which is not executed in parallel, is executed.
 本発明の別の態様に係る処理装置は、上記構成の処理要素を複数個備え、複数の前記処理要素を制御する制御部をさらに備えるものである。 A processing apparatus according to another aspect of the present invention includes a plurality of processing elements configured as described above, and further includes a control section for controlling the plurality of processing elements.
 本発明の他の態様に係る処理要素の制御方法は、所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備える処理要素の制御方法であって、前記展開部および前記圧縮部にて、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行させるステップと、前記圧縮部にて、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行させるステップとを含んでいる。 A processing element control method according to another aspect of the present invention is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain: A control method for a processing element, comprising: an expansion unit that expands a bit sequence to a longer bit sequence; and a compression unit that repeats loop processing on the expanded bit sequence and compresses the expanded bit sequence to the intermediate hash value, wherein the expansion unit and the a step of causing the compression unit to execute one loop process of the decompression unit and a part of the one loop process of the compression unit in parallel; and a step of executing the remaining processes, which are not executed in parallel, of the one loop process of the compression unit, using the words obtained.
 本発明の一態様によれば、ハッシュ関数を繰り返し計算する処理を改善することができる。 According to one aspect of the present invention, processing for repeatedly calculating hash functions can be improved.
本発明の一実施形態に係るハッシュ値演算装置のPEにおけるALUの概略構成を示すブロック図である。3 is a block diagram showing a schematic configuration of an ALU in PE of the hash value calculation device according to one embodiment of the present invention; FIG. SHA-256の値を算出する方法の概要を説明するための図である。FIG. 4 is a diagram for explaining an outline of a method for calculating a value of SHA-256; 上記ハッシュ値演算装置の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of the said hash value calculating apparatus. 上記PEの概略構成を示すブロック図である。It is a block diagram which shows schematic structure of said PE. 上記ALUのME演算部およびMC演算部における処理の流れの一例を示すタイミングチャートである。4 is a timing chart showing an example of the flow of processing in the ME calculation section and MC calculation section of the ALU; 上記PEにおける入力側のシフトバッファの概略構成を示すブロック図である。3 is a block diagram showing a schematic configuration of an input-side shift buffer in the PE; FIG. 上記シフトバッファにおける処理の流れの一例を示すタイミングチャートである。4 is a timing chart showing an example of the flow of processing in the shift buffer; 上記PEにおける出力側のシフトバッファの概略構成を示すブロック図である。3 is a block diagram showing a schematic configuration of an output-side shift buffer in the PE; FIG. 上記シフトバッファにおける処理の流れの一例を示すタイミングチャートである。4 is a timing chart showing an example of the flow of processing in the shift buffer; ビットコインのマイニングにおけるダブルハッシュの概要を示すブロック図である。1 is a block diagram showing an overview of double hashing in bitcoin mining; FIG. 本発明の別の実施形態に係るハッシュ値演算装置におけるPEの概略構成を示すブロック図である。FIG. 4 is a block diagram showing a schematic configuration of a PE in a hash value computing device according to another embodiment of the present invention; 上記PEにおける更新部の詳細を示すブロック図である。It is a block diagram which shows the detail of the update part in said PE. 本発明の他の実施形態に係る組込みシステムの概略構成を示すブロック図である。FIG. 4 is a block diagram showing a schematic configuration of an embedded system according to another embodiment of the present invention; FIG.
 以下、本発明の実施の形態について、詳細に説明する。なお、説明の便宜上、各実施形態に示した部材と同一の機能を有する部材については、同一の符号を付記し、適宜その説明を省略する。 Hereinafter, embodiments of the present invention will be described in detail. For convenience of explanation, members having the same functions as members shown in each embodiment are denoted by the same reference numerals, and descriptions thereof are omitted as appropriate.
 〔実施形態1〕
 本発明の一実施形態について、図1~図9を参照して説明する。本実施形態のハッシュ値演算装置は、入力データに対し、暗号学的ハッシュ関数であるSHA(Secure Hash Algorithm)-256の演算を行うものである。
[Embodiment 1]
An embodiment of the present invention will be described with reference to FIGS. 1-9. The hash value calculation device of this embodiment performs calculation of SHA (Secure Hash Algorithm)-256, which is a cryptographic hash function, on input data.
 (SHA-256)
 図2は、SHA-256の値(ハッシュ値)を算出する方法の概要を説明するための図である。まず、メッセージに対しパディング(padding)を行って、512の倍数の長さのビット系列に変換し、該ビット系列を512ビットのメッセージブロックMに分割する。次に、該メッセージブロックMを32ビットのワードW~W15に分割する。次に、メッセージブロックMに対しME(メッセージ展開)演算を繰り返し実行して、W16~W63を算出する。上記ME演算は、次式(1)で表される。
Figure JPOXMLDOC01-appb-M000001
 ここで、論理関数σ0、σ1は次式(2)で表される。次式において、S(x)は、xをnビットだけ右へ巡回シフトさせる関数である。R(x)は、xをnビットだけ右へシフトさせる関数である。
Figure JPOXMLDOC01-appb-M000002
 次に、ワードW~W63に対し、MC(メッセージ圧縮)演算を繰り返し実行して、256ビットのハッシュ値を算出する。具体的には、上記MC演算では、まず、変数a~hを次式のように初期化する。
(SHA-256)
FIG. 2 is a diagram for explaining an outline of a method for calculating a SHA-256 value (hash value). First, the message is padded to convert it into a bit sequence with a length that is a multiple of 512, and the bit sequence is divided into message blocks M of 512 bits. Next, the message block M is divided into 32-bit words W 0 -W 15 . Next, ME (message expansion) operation is repeatedly performed on the message block M to calculate W 16 to W 63 . The above ME calculation is represented by the following equation (1).
Figure JPOXMLDOC01-appb-M000001
Here, the logic functions σ0 and σ1 are represented by the following equation (2). In the following equation, S n (x) is a function that cyclically shifts x to the right by n bits. R n (x) is a function that shifts x right by n bits.
Figure JPOXMLDOC01-appb-M000002
Next, MC (message compression) operations are repeatedly performed on words W 0 -W 63 to compute a 256-bit hash value. Specifically, in the MC calculation, first, variables a to h are initialized as shown in the following equations.
  a=H;b=H;c=H;d=H;e=H;f=H;g=H;h=Hb = H1 ; c = H2; d =H3; e= H4 ; f= H5 ;
 次に、j=0~63について次式(3)の演算を繰り返す。
Figure JPOXMLDOC01-appb-M000003
 a=T+T;b=a;c=b;d=c;e=d+T;f=e;g=f;h=g  ・・・(3)。
Next, the calculation of the following equation (3) is repeated for j=0 to 63.
Figure JPOXMLDOC01-appb-M000003
a=T 1 +T 2 ;b=a;c=b;d=c;e=d+T 1 ;f=e;g=f;h=g (3).
 ここで、ワードKは規格にて定められた定数である。また、論理関数Σ、Σ、Ch、およびMajは次式(4)で表される。
Figure JPOXMLDOC01-appb-M000004
 最後に、256ビットの中間ハッシュ値HO|HO|…|HOが次式により算出される。
Here, the word Kj is a constant defined in the standard. Also, the logic functions Σ 0 , Σ 1 , Ch, and Maj are represented by the following equations (4).
Figure JPOXMLDOC01-appb-M000004
Finally, the 256 - bit intermediate hash values HO 0 |HO 1 | .
  HO=a+H;HO=b+H;HO=c+H;HO=d+H;HO=e+H;HO=f+H;HO=g+H;HO=h+H HO2 = c + H2 ; HO3 = d + H3; HO4 =e+ H4 ; HO5 =f+ H5 ; HO6 =g+ H6 ;
 上記中間ハッシュ値HO|HO|…|HOが次のメッセージブロックMに関する変数a~hの初期値となる。そして、全てのメッセージブロックMについて上記処理を繰り返し、最後段のメッセージブロックMに関して算出された中間ハッシュ値が、メッセージに対応する最終ハッシュ値となる。 The intermediate hash values HO 0 | HO 1 | . Then, the above processing is repeated for all message blocks M, and the intermediate hash value calculated for the last message block M becomes the final hash value corresponding to the message.
 (ハッシュ値演算装置の概要)
 図3は、本実施形態のハッシュ値演算装置の概略構成を示すブロック図である。図3に示すように、ハッシュ値演算装置10(処理装置)は、コントローラ11(制御部)、GRAM(Global Random Access Memory)12、バス13、複数の処理要素(PE)14、およびバスIF(interface)15を備える構成である。すなわち、ハッシュ値演算装置10は、複数のPE14を有するマルチコアプロセッサである。
(Overview of Hash Value Calculator)
FIG. 3 is a block diagram showing a schematic configuration of the hash value computing device of this embodiment. As shown in FIG. 3, the hash value calculation device 10 (processing device) includes a controller 11 (control unit), a GRAM (Global Random Access Memory) 12, a bus 13, a plurality of processing elements (PE) 14, and a bus IF ( interface) 15. That is, the hash value calculation device 10 is a multi-core processor having multiple PEs 14 .
 コントローラ11は、ハッシュ値演算装置10の各種構成の動作を統括的に制御するものであり、例えばCPU(Central Processing Unit)及びメモリを含むコンピュータによって構成される。そして、各種構成の動作制御は、制御プログラムをコンピュータに実行させることによって行われる。 The controller 11 comprehensively controls the operations of various components of the hash value calculation device 10, and is composed of a computer including a CPU (Central Processing Unit) and memory, for example. Operation control of various configurations is performed by causing a computer to execute a control program.
 GRAM12は、ハッシュ値演算装置10にて広域に利用される情報を記憶するものであり、フラッシュメモリ等の記憶デバイスによって構成される。バス13は、GRAM12、複数のPE14等の間でデータの転送を行うためのものである。PE14は、プロセッサ・コアである。なお、PE14の詳細は後述する。バスIF15は、外部装置とのデータの送受信を行うためのものである。 The GRAM 12 stores information that is widely used by the hash value calculation device 10, and is composed of a storage device such as a flash memory. The bus 13 is for transferring data between the GRAM 12, a plurality of PEs 14, and the like. PE 14 is the processor core. Details of the PE 14 will be described later. A bus IF 15 is for transmitting and receiving data to and from an external device.
 (PE)
 図4は、PE14の概略構成を示すブロック図である。図4に示すように、PE14は、ALU(Arithmetic Logic Unit)20、2つのRAM21・22、4つのシフトバッファ23~26、および加算器27を備える構成である。本実施形態では、各PE14は、中間ハッシュ値を算出する機能を有している。
(PE)
FIG. 4 is a block diagram showing a schematic configuration of the PE 14. As shown in FIG. As shown in FIG. 4, the PE 14 comprises an ALU (Arithmetic Logic Unit) 20, two RAMs 21 and 22, four shift buffers 23-26, and an adder 27. In this embodiment, each PE 14 has the function of calculating an intermediate hash value.
 ALU20は、算術演算および論理演算を行うものであり、本実施形態では、上記ME演算および上記MC演算を行うものである。なお、ALU20の詳細は後述する。 The ALU 20 performs arithmetic operations and logic operations, and in this embodiment, performs the ME operation and the MC operation. Details of the ALU 20 will be described later.
 RAM21(展開用メモリ)は、上記ME演算に利用されるデータ(ワードW~W63)を記憶するものであり、以下では「WRAM21」と称する。ワードW~W63のうち、ワードW~W15(メッセージブロックM)は、GRAM12からバス13を介してWRAM21に書き込まれる。ワードW~W63は、ALU20からシフトバッファ25を介してWRAM21に書き込まれる。 The RAM 21 (expansion memory) stores the data (words W 0 to W 63 ) used in the ME operation, and is hereinafter referred to as "WRAM 21". Of the words W 0 to W 63 , words W 0 to W 15 (message block M) are written from the GRAM 12 to the WRAM 21 via the bus 13 . Words W 0 -W 63 are written from ALU 20 to WRAM 21 via shift buffer 25 .
 RAM22(圧縮用メモリ)は、上記MC演算に利用されるハッシュ値の初期値H~Hを記憶し、算出された中間ハッシュ値HO~HOで更新するものであり、以下では「HRAM22」と称する。ハッシュ値の初期値H~Hは、GRAM12からバス13を介してHRAM22に書き込まれる。中間ハッシュ値HO~HOは、加算器27から書き込まれる。 The RAM 22 (compression memory) stores the initial hash values H 0 to H 7 used in the MC calculation, and updates them with the calculated intermediate hash values HO 0 to HO 7 . HRAM 22”. The initial hash values H 0 to H 7 are written from the GRAM 12 to the HRAM 22 via the bus 13 . Intermediate hash values HO 0 to HO 7 are written from adder 27 .
 なお、中間ハッシュ値HO~HOは、ハッシュ値の初期値H~Hと、上記MC演算の最終ループにより算出される変数a~hとをそれぞれ加算したものである。また、ハッシュ値の初期値H~Hは、初段のメッセージブロックMについては、規格にて定められた定数であり、その他のメッセージブロックMについては、前段のメッセージブロックMから算出された中間ハッシュ値HO~HOである。 The intermediate hash values HO 0 to HO 7 are the sums of the initial hash values H 0 to H 7 and the variables a to h calculated in the final loop of the MC calculation, respectively. The initial values H 0 to H 7 of the hash values are constants defined by the standard for the message block M of the first stage, and for the other message blocks M, intermediate values calculated from the message block M of the previous stage. Hash values HO 0 to HO 7 .
 シフトバッファ23(入力用バッファ)は、WRAM21から読み出したデータを一時記憶するものである。シフトバッファ23は、一時記憶したデータをALU20に送出する。なお、図4では、シフトバッファ23を「SBi1」と記載している。 The shift buffer 23 (input buffer) temporarily stores data read from the WRAM 21 . The shift buffer 23 sends the temporarily stored data to the ALU 20 . In addition, in FIG. 4, the shift buffer 23 is described as "SBi1".
 シフトバッファ24(入力用バッファ)は、HRAM22から読み出したハッシュ値の初期値H~Hを一時記憶するものである。シフトバッファ24は、一時記憶したハッシュ値の初期値H~HをALU20および加算器27に送出する。なお、図4では、シフトバッファ24を「SBi2」と記載している。 The shift buffer 24 (input buffer) temporarily stores initial hash values H 0 to H 7 read from the HRAM 22 . The shift buffer 24 sends the temporarily stored initial hash values H 0 to H 7 to the ALU 20 and the adder 27 . In addition, in FIG. 4, the shift buffer 24 is described as "SBi2".
 シフトバッファ25(出力用バッファ)は、ALU20が算出したワードを一時記憶するものである。シフトバッファ25は、一時記憶したワードをWRAM21に書き込む。なお、図4では、シフトバッファ25を「SBo1」と記載している。 The shift buffer 25 (output buffer) temporarily stores the word calculated by the ALU 20 . The shift buffer 25 writes the temporarily stored word to the WRAM 21 . In addition, in FIG. 4, the shift buffer 25 is described as "SBo1".
 シフトバッファ26(出力用バッファ)は、ALU20が算出した変数a~hを一時記憶するものである。シフトバッファ26は、一時記憶した変数a~hを加算器27に送出する。なお、図4では、シフトバッファ26を「SBo2」と記載している。 The shift buffer 26 (output buffer) temporarily stores variables a to h calculated by the ALU 20 . The shift buffer 26 sends the temporarily stored variables a to h to the adder 27 . Note that the shift buffer 26 is described as "SBo2" in FIG.
 加算器27は、シフトバッファ24からのハッシュ値の初期値H~Hと、シフトバッファ26からの変数a~hとをそれぞれ加算して、中間ハッシュ値HO~HOを算出するものである。加算器27は、算出した中間ハッシュ値HO~HOをHRAM22に書き込むと共に、バス13を介してGRAM12に送信する。なお、図示していないが、加算器27は、4つの加算部を備えている。 The adder 27 adds the initial hash values H 0 to H 7 from the shift buffer 24 and the variables a to h from the shift buffer 26 to calculate the intermediate hash values HO 0 to HO 7 . is. The adder 27 writes the calculated intermediate hash values HO 0 to HO 7 in the HRAM 22 and transmits them to the GRAM 12 via the bus 13 . Although not shown, the adder 27 has four adders.
 (ALU)
 図4に示すように、ALU20は、ME演算部30(展開部)、MC演算部31(圧縮部)、マルチプレクサ32、およびデマルチプレクサ33を備える構成である。
(ALU)
As shown in FIG. 4 , the ALU 20 has a configuration including an ME operation section 30 (expansion section), an MC operation section 31 (compression section), a multiplexer 32 and a demultiplexer 33 .
 ME演算部30は、WRAM21からシフトバッファ23を介して入力されたデータを用いて、上記ME演算を実行するものである。ME演算部30は、上記ME演算にて算出されたデータを、シフトバッファ25を介してWRAM21に出力すると共に、MC演算部に送出する。 The ME calculation unit 30 uses data input from the WRAM 21 via the shift buffer 23 to execute the ME calculation. The ME calculation unit 30 outputs the data calculated by the ME calculation to the WRAM 21 via the shift buffer 25 and to the MC calculation unit.
 MC演算部31は、ME演算部30からのデータと、マルチプレクサ32からのデータとを用いて、上記MC演算を実行するものである。MC演算部31は、上記MC演算にて算出されたデータを、デマルチプレクサ33に送出する。 The MC calculation unit 31 uses the data from the ME calculation unit 30 and the data from the multiplexer 32 to execute the MC calculation. The MC calculation unit 31 sends the data calculated by the MC calculation to the demultiplexer 33 .
 マルチプレクサ32は、MC演算部31に入力される変数a~hを、ループ#0ではHRAM22からシフトバッファ24を介して取得し、その他のループ#1~#63ではデマルチプレクサ33から取得するように切り替えるものである。デマルチプレクサ33は、MC演算部31が出力する変数a~hを、ループ#0~#62では次のループ#1~#63のためにマルチプレクサ32に出力(フィードバック)し、最終ループ#63ではシフトバッファ26および加算器27を介してHRAM22に出力するように切り替えるものである。 The multiplexer 32 acquires the variables a to h input to the MC calculation unit 31 from the HRAM 22 via the shift buffer 24 in the loop #0, and from the demultiplexer 33 in the other loops #1 to #63. It is to switch. The demultiplexer 33 outputs (feeds back) the variables a to h output by the MC calculation unit 31 to the multiplexer 32 for the next loops #1 to #63 in the loops #0 to #62, and in the final loop #63 It switches to output to HRAM 22 via shift buffer 26 and adder 27 .
 図1は、ALU20の概略構成を示すブロック図である。図1は、ALU20におけるj番目の1ループ処理を示している。なお、図1では、WをW(j)として示している。 FIG. 1 is a block diagram showing a schematic configuration of the ALU 20. As shown in FIG. FIG. 1 shows the j-th loop processing in the ALU 20. FIG. Note that in FIG. 1, Wj is shown as W( j ).
 図1に示すように、ME演算部30では、j=0~15の場合、ワードW(j)がマルチプレクサMUXを介してMC演算部31に送出される。次に、j=16~63の場合、第1演算処理ME-1および第2演算処理ME-2が順番に行われる。 As shown in FIG. 1, in the ME calculation unit 30, when j=0 to 15, the word W(j) is sent to the MC calculation unit 31 via the multiplexer MUX. Next, when j=16 to 63, the first arithmetic processing ME-1 and the second arithmetic processing ME-2 are performed in order.
 第1演算処理ME-1では、W(j-15)に対し論理演算部SIG0にて上記論理関数σの演算が行われて、算術演算部AdderにてW(j-16)と加算される。また、W(j-2)に対し論理演算部SIG1にて上記論理関数σの演算が行われて、算術演算部AdderにてW(j-7)と加算される。 In the first operation processing ME-1, W(j-15) is subjected to the operation of the logic function σ0 by the logic operation unit SIG0 , and is added to W(j-16) by the arithmetic operation unit Adder. be. Further, W(j-2) is subjected to the logic function .sigma.1 by the logic operation section SIG1, and is added to W(j-7) by the arithmetic operation section Adder.
 次に、第2演算処理ME-2では、第1演算処理ME-1にて演算された2つのワードが算術演算部Adderにて加算される。演算結果は、ワードW(j)として、シフトバッファ25を介してWRAM21に出力されると共に、MC演算部31に送出される。 Next, in the second arithmetic processing ME-2, the two words calculated in the first arithmetic processing ME-1 are added by the arithmetic operation unit Adder. The calculation result is output to the WRAM 21 via the shift buffer 25 as a word W(j), and is also sent to the MC calculation unit 31 .
 一方、MC演算部31では、第1から第4の演算処理MC-1~MC-4が順番に行われる。 On the other hand, in the MC calculation unit 31, the first to fourth calculation processes MC-1 to MC-4 are performed in order.
 第1演算処理MC-1では、定数K(j)と変数hとが算術演算部Adderにて加算される。また、変数eに対し論理演算部EP1にて上記論理関数Σの演算が行われると共に、変数e、f、gに対し論理演算部CHにて上記論理関数Chの演算が行われ、演算された2つのワードが算術演算部Adderにて加算される。次に、第2演算処理MC-2では、第1演算処理MC-1にて演算された2つのワードが算術演算部Adderにて加算される。次に、第3演算処理MC-3では、第2演算処理MC-2にて演算されたワードと、ME演算部30からのワードW(j)とが算術演算部Adderにて加算される。この演算結果がワードTである。 In the first arithmetic operation MC-1, the constant K(j) and the variable h are added by the arithmetic operation unit Adder. Further, the logical operation part EP1 performs the operation of the logical function Σ1 on the variable e, and the logical operation part CH performs the operation of the logical function Ch on the variables e, f, and g. The two words are added in the arithmetic operation unit Adder. Next, in the second arithmetic processing MC-2, the two words calculated in the first arithmetic processing MC-1 are added by the arithmetic operation unit Adder. Next, in the third calculation processing MC-3, the word calculated in the second calculation processing MC-2 and the word W(j) from the ME calculation section 30 are added by the arithmetic calculation section Adder. The result of this operation is word T1.
 また、第1演算処理MC-1では、変数aに対し論理演算部EP0にて上記論理関数Σの演算が行われると共に、変数a、b、cに対し論理演算部MAJにて上記論理関数Majの演算が行われ、演算された2つのワードが算術演算部Adderにて加算される。この演算結果がワードTである。 In the first operation processing MC-1, the logical operation unit EP0 performs the operation of the logical function Σ0 on the variable a, and the logical operation unit MAJ operates on the variables a, b, and c. Maj is calculated, and the calculated two words are added in the arithmetic operation unit Adder. The result of this operation is word T2.
 第4演算処理MC-4では、ワードTと変数dとが算術演算部Adderにて加算されて、次にループの変数eとして出力される。また、ワードTとワードTとが算術演算部Adderにて加算されて、次のループの変数aとして出力される。また、変数a~c、e~gが、ワイヤ割当て部WireAssignを介して、それぞれ次のループの変数b~d、f~hとして出力される。 In the fourth operation processing MC- 4 , the word T1 and the variable d are added in the arithmetic operation unit Adder and then output as the loop variable e. Also, the word T1 and the word T2 are added in the arithmetic operation unit Adder and output as the variable a of the next loop. Also, variables a to c and e to g are output as variables b to d and f to h of the next loop via wire assignment unit WireAssign.
 図1に示すように、ME演算部30の第1演算処理ME-1とMC演算部31の第1演算処理MC-1とが並行に実行され、ME演算部30の第2演算処理ME-2とMC演算部31の第2演算処理MC-2とが並行に実行される。そして、ME演算部30が算出したワードW(j)を用いて、MC演算部31の第3演算処理MC-3および第4演算処理MC-4が実行される。 As shown in FIG. 1, the first arithmetic processing ME-1 of the ME arithmetic unit 30 and the first arithmetic processing MC-1 of the MC arithmetic unit 31 are executed in parallel, and the second arithmetic processing ME-1 of the ME arithmetic unit 30 is executed in parallel. 2 and the second arithmetic processing MC-2 of the MC arithmetic unit 31 are executed in parallel. Then, using the word W(j) calculated by the ME calculation unit 30, the third calculation processing MC-3 and the fourth calculation processing MC-4 of the MC calculation unit 31 are executed.
 従って、ME演算部30およびMC演算部31を別々に実行する場合に比べて、各ループ処理を実行するのに必要なクロック数を4クロックにまで低減することができる。また、1つのPE14のみで、メッセージブロックMに関する中間ハッシュ値を計算することができる。従って、メッセージから最終ハッシュ値を求めるのに必要なPE14の数を低減することができる。 Therefore, the number of clocks required to execute each loop process can be reduced to 4 clocks compared to the case where the ME arithmetic unit 30 and the MC arithmetic unit 31 are executed separately. Also, an intermediate hash value for message block M can be calculated with only one PE 14 . Therefore, the number of PEs 14 required to determine the final hash value from the message can be reduced.
 また、WRAM21がメッセージブロックM(ワードW~W15)およびワードW16~W63を記憶し、HRAM22がハッシュ値の初期値を記憶する。これにより、外部のメモリにワードW16~W63を書き込んだり、上記外部のメモリからメッセージブロックM、ハッシュ値の初期値、およびワードW16~W63を読み出したりする必要がない。従って、PE14の処理効率を向上することができる。 WRAM 21 stores message block M (words W 0 to W 15 ) and words W 16 to W 63 , and HRAM 22 stores initial hash values. This eliminates the need to write the words W 16 to W 63 to the external memory and to read the message block M, the initial hash values, and the words W 16 to W 63 from the external memory. Therefore, the processing efficiency of the PE 14 can be improved.
 また、WRAM21がメッセージブロックM(ワードW~W15)を記憶し、HRAM22に記憶されたデータから中間ハッシュ値を算出することができる。従って、WRAM21が次のメッセージブロックMを記憶すれば、上記中間ハッシュ値を用いて、次のメッセージブロックMに対応する次の中間ハッシュ値を算出することができる。そして、これらを繰り返すことにより、1つのPE14のみで上記メッセージから最終ハッシュ値を求めることができる。 Also, the WRAM 21 stores the message block M (words W 0 to W 15 ), and the intermediate hash value can be calculated from the data stored in the HRAM 22 . Therefore, if the WRAM 21 stores the next message block M, the next intermediate hash value corresponding to the next message block M can be calculated using the intermediate hash value. By repeating these steps, only one PE 14 can obtain the final hash value from the message.
 (WRAM・HRAM)
 図4に示すように、WRAM21は、4つのメモリ部WM1~WM4を備える構成であり、メモリ部WM1~WM4のそれぞれには、第1~第4メッセージブロックMのデータが記憶される。本実施形態では、第1~第4メッセージブロックMのデータは、それぞれ異なっているが、一部または全部が同じであってもよい。メモリ部WM1~WM4のそれぞれは、16個のワードWj-16~Wj-1を記憶可能なメモリサイズ(512ビット)を少なくとも有していればよく、64個のワードW~W63を記憶可能なメモリサイズ(2048ビット)を有していてもよい。
(WRAM/HRAM)
As shown in FIG. 4, the WRAM 21 has four memory units WM1 to WM4, and data of the first to fourth message blocks M are stored in the memory units WM1 to WM4, respectively. In this embodiment, the data of the first to fourth message blocks M are different, but part or all of them may be the same. Each of the memory units WM1 to WM4 should have at least a memory size (512 bits) capable of storing 16 words W j−16 to W j−1 , and 64 words W 0 to W 63 . may have a memory size (2048 bits) capable of storing .
 HRAM22は、4つのメモリ部HM1~HM4を備える構成である。メモリ部HM1~HM4は、それぞれ、WRAM21のメモリ部WM1~WM4が記憶する第1~第4メッセージブロックMに対応するハッシュ値の第1~第4初期値H~Hを記憶する。ハッシュ値の第1~第4初期値H~Hは、第1~第4メッセージブロックMに対応する第1~第4中間ハッシュ値HO~HOにより更新される。メモリ部HM1~HM4のそれぞれは、ハッシュ値の初期値H~Hを記憶可能なメモリサイズ(256ビット)を少なくとも有していてもよい。 The HRAM 22 is configured to include four memory units HM1 to HM4. The memory units HM1 to HM4 store first to fourth initial values H 0 to H 7 of hash values corresponding to the first to fourth message blocks M stored in the memory units WM1 to WM4 of the WRAM 21, respectively. The first through fourth initial hash values H 0 through H 7 are updated by the first through fourth intermediate hash values HO 0 through HO 7 corresponding to the first through fourth message blocks M, respectively. Each of the memory units HM1 to HM4 may have at least a memory size (256 bits) capable of storing initial hash values H 0 to H 7 .
 図5は、ME演算部30およびMC演算部31における処理の流れの一例を示すタイミングチャートである。図5において、F1~F4は、それぞれ、WM1~WM4に記憶された第1~第4メッセージブロックMに関する処理を示している。また、Lj(j=0~63)は、ループ番号を示している。 FIG. 5 is a timing chart showing an example of the flow of processing in the ME calculation section 30 and the MC calculation section 31. FIG. In FIG. 5, F1 to F4 respectively indicate the processing for the first to fourth message blocks M stored in WM1 to WM4. Also, Lj (j=0 to 63) indicates a loop number.
 第1メッセージブロックMに関する処理F1は、下記のタイミングで行われる。図5に示すように、まず、クロックCK0では、第0ループが開始され、メモリ部WM1、HM1からデータが読み出されて、第1演算処理ME-1、MC-1が実行される。 The process F1 for the first message block M is performed at the following timing. As shown in FIG. 5, first, at clock CK0, the 0th loop is started, data is read from the memory units WM1 and HM1, and first arithmetic processes ME-1 and MC-1 are executed.
 次に、クロックCK1では、第2演算処理ME-2、MC-2が実行される。第2演算処理ME-2にて算出されたワードW(16)は、メモリ部WM1に記憶されると共に、MC演算部31に送出される。 Next, at clock CK1, second arithmetic processing ME-2 and MC-2 are executed. The word W(16) calculated in the second arithmetic processing ME-2 is stored in the memory section WM1 and sent to the MC arithmetic section 31 as well.
 次に、クロックCK2、CK3では、MC演算部31の第3演算処理MC-3および第4演算処理MC-4がそれぞれ実行されて、第0ループを終了する。従って、各ループは4つのタイミングで実行されることになる。 Next, at the clocks CK2 and CK3, the third arithmetic processing MC-3 and the fourth arithmetic processing MC-4 of the MC arithmetic unit 31 are executed, respectively, and the 0th loop ends. Therefore, each loop is executed at four timings.
 次に、クロックCK4では、第1ループが開始され、メモリ部WM1からデータが読み出されて、第1演算処理ME-1が実行される。また、前回のクロックCK3において第4演算処理MC-4にて算出された変数a~hを用いて第1演算処理MC-1が実行される。以下、上記動作が繰り返される。 Next, at clock CK4, the first loop is started, data is read from the memory unit WM1, and the first arithmetic processing ME-1 is executed. Further, the first arithmetic processing MC-1 is executed using the variables a to h calculated in the fourth arithmetic processing MC-4 at the previous clock CK3. Thereafter, the above operation is repeated.
 第2メッセージブロックMに関する処理F2は、クロックCK1にて第0ループが開始され、上記動作と同様の動作が繰り返される。同様に、第3および第4メッセージブロックMに関する処理F3、F4は、それぞれ、クロックCK2、CK3にて第0ループが開始され、上記動作と同様の動作が繰り返される。そして、クロックCK4にて、第1メッセージブロックMに関する処理F1の第1ループが開始される。 In the processing F2 regarding the second message block M, the 0th loop is started at the clock CK1, and the same operations as the above operations are repeated. Similarly, the processes F3 and F4 relating to the third and fourth message blocks M start the 0th loops at the clocks CK2 and CK3, respectively, and the same operations as described above are repeated. Then, at clock CK4, the first loop of process F1 relating to the first message block M is started.
 従って、本実施形態のPE14は、4つのメッセージブロックMにそれぞれ対応する4つのループ処理を、4クロックで算出することができる。すなわち、1クロックあたり1つのループ処理を実行することができる。その結果、ALU20における処理の効率を向上することができる。 Therefore, the PE 14 of this embodiment can calculate four loop processes corresponding to four message blocks M in four clocks. That is, one loop process can be executed per clock. As a result, efficiency of processing in the ALU 20 can be improved.
 なお、本実施形態では、WRAM21およびHRAM22のそれぞれが備えるメモリ部の数を4にしているが、これに限定されるものではない。WRAM21およびHRAM22のそれぞれは、1ループに必要なクロック数だけ、メモリ部を備えればよい。 Although the number of memory units provided in each of the WRAM 21 and the HRAM 22 is four in this embodiment, it is not limited to this. Each of the WRAM 21 and the HRAM 22 should be provided with a memory section for the number of clocks required for one loop.
 (シフトバッファ)
 図6は、シフトバッファ23、24の概略構成を示すブロック図である。
(shift buffer)
FIG. 6 is a block diagram showing a schematic configuration of shift buffers 23 and 24. As shown in FIG.
 図6に示すように、シフトバッファ23は、4つのシフトレジスタ40~43と、マルチプレクサ44とを備える構成である。シフトレジスタ40は、WRAM21のメモリ部WM1から4ワード(W(j-16)、W(j-15)、W(j-7)およびW(j-2))を格納するものである。同様に、シフトレジスタ41~43は、それぞれ、WRAM21のメモリ部WM2~WM4から上記4ワードを格納するものである。マルチプレクサ44は、シフトレジスタ40~43の何れか1つを選択し、選択したシフトレジスタの4ワードをALU20のME演算部30に入力するものである。 As shown in FIG. 6, the shift buffer 23 has a configuration including four shift registers 40 to 43 and a multiplexer 44 . The shift register 40 stores four words (W(j-16), W(j-15), W(j-7) and W(j-2)) from the memory portion WM1 of the WRAM 21. FIG. Similarly, the shift registers 41 to 43 store the four words from the memory sections WM2 to WM4 of the WRAM 21, respectively. The multiplexer 44 selects one of the shift registers 40 to 43 and inputs the four words of the selected shift register to the ME operation section 30 of the ALU 20 .
 また、シフトバッファ24は、4つのシフトレジスタ45~48と、マルチプレクサ49とを備える構成である。シフトレジスタ45~48は、それぞれ、HRAM22のメモリ部HM1~HM4からハッシュ値の初期値H~Hを格納するものである。マルチプレクサ49は、シフトレジスタ45~48の何れか1つを選択し、選択したシフトレジスタの初期値H~Hを変数a~hとして、マルチプレクサ32を介してALU20のMC演算部31に入力するものである。また、マルチプレクサ49は、選択したシフトレジスタのハッシュ値の初期値H~Hを加算器27に送出する。 Also, the shift buffer 24 has a configuration including four shift registers 45 to 48 and a multiplexer 49 . The shift registers 45 to 48 store the initial hash values H 0 to H 7 from the memory units HM1 to HM4 of the HRAM 22, respectively. The multiplexer 49 selects one of the shift registers 45 to 48, and inputs the initial values H 0 to H 7 of the selected shift register to the MC calculation unit 31 of the ALU 20 via the multiplexer 32 as variables a to h. It is something to do. The multiplexer 49 also sends the initial hash values H 0 to H 7 of the selected shift register to the adder 27 .
 図7は、シフトバッファ23における処理の流れの一例を示すタイミングチャートである。図7に示すように、シフトレジスタ40では、クロックCK10~CK13において、或るループにてMC演算部31に用いられる4ワードがメモリ部WM1から順次読み出される。そして、クロックCK13において、格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。これにより、第1メッセージブロックMに関する処理F1の上記或るループが開始される。 FIG. 7 is a timing chart showing an example of the flow of processing in the shift buffer 23. FIG. As shown in FIG. 7, in the shift register 40, four words used by the MC calculation unit 31 are sequentially read out from the memory unit WM1 in a certain loop at the clocks CK10 to CK13. Then, at clock CK13, the stored four words are input to MC operation section 31 of ALU 20 via multiplexer 44. FIG. This initiates a certain loop of process F1 for the first message block M as described above.
 次に、シフトレジスタ40では、クロックCK14~CK17において、次のループにてMC演算部31に用いられる4ワードが順次読み出される。そして、クロックCK17において、格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。以下、上記動作が繰り返される。 Next, in the shift register 40, four words to be used in the MC calculation unit 31 are sequentially read out in the next loop at the clocks CK14 to CK17. Then, at clock CK17, the stored four words are input to MC operation section 31 of ALU 20 via multiplexer 44. FIG. Thereafter, the above operation is repeated.
 一方、シフトレジスタ41では、クロックCK11~CK14において、或るループにてMC演算部31に用いられる4ワードがメモリ部WM2から順次読み出される。そして、クロックCK14において、格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。これにより、第2メッセージブロックMに関する処理F2の上記或るループが開始される。 On the other hand, in the shift register 41, the four words used by the MC calculation unit 31 are sequentially read from the memory unit WM2 in a certain loop during the clocks CK11 to CK14. Then, at clock CK14, the stored four words are input to MC operation section 31 of ALU 20 via multiplexer 44. FIG. This initiates a certain loop of process F2 for the second message block M as described above.
 同様に、シフトレジスタ42では、クロックCK15において、メモリ部WM3から順次格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。これにより、第3メッセージブロックMに関する処理F3の上記或るループが開始される。また、シフトレジスタ43では、クロックCK16において、メモリ部WM4から順次格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。これにより、第4メッセージブロックMに関する処理F4の上記或るループが開始される。そして、クロックCK17において、メモリ部WM1から順次格納された4ワードがマルチプレクサ44を介してALU20のMC演算部31に入力される。これにより、第1メッセージブロックMに関する処理F1の上記次のループが開始される。 Similarly, in the shift register 42, four words sequentially stored from the memory section WM3 are input to the MC calculation section 31 of the ALU 20 via the multiplexer 44 at the clock CK15. This initiates a loop of process F3 for the third message block M described above. In the shift register 43, the four words sequentially stored from the memory section WM4 are input to the MC calculation section 31 of the ALU 20 via the multiplexer 44 at the clock CK16. This initiates a certain loop of process F4 for the fourth message block M as described above. Then, at clock CK17, the four words sequentially stored from the memory section WM1 are input to the MC calculation section 31 of the ALU 20 via the multiplexer 44. FIG. Thereby, the next loop of the process F1 for the first message block M is started.
 従って、本実施形態のシフトバッファ23は、ME演算部30にて必要とされるデータを、WRAM21から順次読み出しておき、所定のタイミングでME演算部30に一斉に出力することができる。これにより、ME演算部30は、WRAM21からデータを読み出すために待機する必要がなくなる。その結果、前記処理要素における処理効率をさらに向上することができる。また、シフトバッファ23は、WRAM21のメモリ部WM1~WM4にそれぞれ対応するシフトレジスタ40~43を備えているので、1つのシフトレジスタのみを備えることによる処理速度の遅延を回避することができる。なお、シフトバッファ24も、シフトバッファ23と同様であるので、その説明を省略する。 Therefore, the shift buffer 23 of the present embodiment can sequentially read data required by the ME calculation unit 30 from the WRAM 21 and output them all at once to the ME calculation unit 30 at a predetermined timing. This eliminates the need for the ME calculation unit 30 to wait to read data from the WRAM 21 . As a result, processing efficiency in the processing elements can be further improved. Further, since the shift buffer 23 includes the shift registers 40 to 43 corresponding to the memory units WM1 to WM4 of the WRAM 21, it is possible to avoid the delay in processing speed due to the provision of only one shift register. Since the shift buffer 24 is similar to the shift buffer 23, the description thereof will be omitted.
 図8は、シフトバッファ25、26の概略構成を示すブロック図である。 FIG. 8 is a block diagram showing a schematic configuration of shift buffers 25 and 26. As shown in FIG.
 図8に示すように、シフトバッファ25は、4つのシフトレジスタ50~53と、デマルチプレクサ54とを備える構成である。デマルチプレクサ54は、ME演算部30にて算出されたワードW(j)をシフトレジスタ50~53の何れかに出力するものである。シフトレジスタ50~53は、それぞれ、第1~第4メッセージブロックMに関するワードW(j)を、デマルチプレクサ54を介して格納するものである。シフトレジスタ50~53は、格納したワードW(j)をメモリ部WM1~WM4にそれぞれ書き込む。 As shown in FIG. 8, the shift buffer 25 has a configuration including four shift registers 50 to 53 and a demultiplexer . The demultiplexer 54 outputs the word W(j) calculated by the ME calculation unit 30 to any one of the shift registers 50-53. The shift registers 50-53 store the words W(j) for the first to fourth message blocks M via the demultiplexer 54, respectively. The shift registers 50-53 write the stored word W(j) to the memory units WM1-WM4, respectively.
 また、シフトバッファ26は、4つのシフトレジスタ55~58と、デマルチプレクサ59とを備える構成である。デマルチプレクサ59は、MC演算部31にて算出された最終ループの変数a~hをシフトレジスタ55~58の何れかに出力するものである。シフトレジスタ55~58は、それぞれ、第1~第4メッセージブロックMに関する最終ループの変数a~hを、デマルチプレクサ54を介して格納するものである。シフトレジスタ55~58に格納された変数a~hは、加算器27にて、シフトレジスタ45~48からのハッシュ値の初期値H~Hとそれぞれ加算されて、中間ハッシュ値HO~HOとしてメモリ部HM1~HM4にそれぞれ書き込まれる。 Also, the shift buffer 26 has a configuration including four shift registers 55 to 58 and a demultiplexer 59 . The demultiplexer 59 outputs variables a to h of the final loop calculated by the MC calculation unit 31 to any one of the shift registers 55 to 58 . The shift registers 55 to 58 store final loop variables a to h for the first to fourth message blocks M via the demultiplexer 54, respectively. The variables a to h stored in the shift registers 55 to 58 are respectively added to the initial values H 0 to H 7 of the hash values from the shift registers 45 to 48 in the adder 27 to obtain the intermediate hash values HO 0 to HO7 is written in the memory units HM1 to HM4.
 図9は、シフトバッファ26における処理の流れの一例を示すタイミングチャートである。図9に示すように、シフトレジスタ55では、クロックCK20において、ALU20のMC演算部31が算出した第1メッセージブロックに関する最終ループの変数a~hが、デマルチプレクサ33を介して格納する。そして、上記変数a~hが、クロックCK21~CK28において、加算器27の第1加算部に順次送出される。第1加算部では、上記変数a~hが、シフトレジスタ45から取得した第1メッセージブロックに関するハッシュ値の初期値H~Hと順次加算されて、第1メッセージブロックの中間ハッシュ値HO~HOとして、HRAM22のメモリ部HM1に順次書き込まれる。 FIG. 9 is a timing chart showing an example of the flow of processing in the shift buffer 26. As shown in FIG. As shown in FIG. 9, in the shift register 55, variables a to h of the final loop regarding the first message block calculated by the MC calculation unit 31 of the ALU 20 are stored via the demultiplexer 33 at the clock CK20. Then, the variables a to h are sequentially sent to the first addition section of the adder 27 at the clocks CK21 to CK28. In the first adder, the variables a to h are sequentially added to the initial hash values H 0 to H 7 of the first message block obtained from the shift register 45 to obtain an intermediate hash value HO 0 of the first message block. . . . HO7 are sequentially written in the memory portion HM1 of the HRAM 22. FIG.
 一方、シフトレジスタ56では、クロックCK21において、ALU20のMC演算部31が算出した第2メッセージブロックに関する最終ループの変数a~hが、デマルチプレクサ33を介して格納する。そして、上記変数a~hが、クロックCK22~CK29において、加算器27の第2加算部に順次送出される。第2加算部では、上記変数a~hが、シフトレジスタ45から取得した第2メッセージブロックに関するハッシュ値の初期値H~Hと順次加算されて、第2メッセージブロックの中間ハッシュ値HO~HOとして、HRAM22のメモリ部HM2に順次書き込まれる。なお、シフトレジスタ57、58も同様である。 On the other hand, in the shift register 56, variables a to h of the final loop regarding the second message block calculated by the MC calculation unit 31 of the ALU 20 are stored via the demultiplexer 33 at the clock CK21. Then, the variables a to h are sequentially sent to the second adder of the adder 27 at the clocks CK22 to CK29. In the second adder, the variables a to h are sequentially added to the initial hash values H 0 to H 7 of the second message block obtained from the shift register 45 to obtain an intermediate hash value HO 0 of the second message block. . . . HO7 are sequentially written in the memory portion HM2 of the HRAM22. The shift registers 57 and 58 are also the same.
 従って、本実施形態のシフトバッファ25は、ME演算部30が出力するデータを、WRAM21に順次書き込むことができる。これにより、ME演算部30は、WRAM21に前記データを書き込むために待機する必要がなくなる。その結果、PE14における処理効率をさらに向上することができる。また、シフトバッファ25は、WRAM21のメモリ部WM1~WM4にそれぞれ対応するシフトレジスタ50~53を備えているので、1つのシフトレジスタのみを備えることによる処理速度の遅延を回避することができる。なお、シフトバッファ26も、シフトバッファ25と同様であるので、その説明を省略する。 Therefore, the shift buffer 25 of this embodiment can sequentially write the data output by the ME calculation unit 30 to the WRAM 21 . This eliminates the need for the ME calculation unit 30 to wait to write the data to the WRAM 21 . As a result, processing efficiency in the PE 14 can be further improved. Further, since the shift buffer 25 includes the shift registers 50 to 53 corresponding to the memory units WM1 to WM4 of the WRAM 21, it is possible to avoid the delay in processing speed due to the provision of only one shift register. Since the shift buffer 26 is similar to the shift buffer 25, the description thereof will be omitted.
 (変形例1)
 本変形例では、PE14は、4×L個(Lは2以上の整数)のメッセージブロックMに対応する4×L個の中間ハッシュ値HO~HOをそれぞれ算出する。この場合、WRAM21は、4つのメモリ部WM1~WM4からなるグループをL個備えればよい。このとき、WRAM21は、L×4×64×32ビット=Lキロバイトの記憶容量を有すればよい。また、HRAM22は、4つのメモリ部HM1~HM4からなるグループをL個備えればよい。このとき、HRAM22は、L×4×8×32ビット=L×128バイトの記憶容量を有すればよい。
(Modification 1)
In this modification, the PE 14 calculates 4×L intermediate hash values HO 0 to HO 7 corresponding to 4×L (L is an integer of 2 or more) message blocks M, respectively. In this case, the WRAM 21 may be provided with L groups of four memory units WM1 to WM4. At this time, the WRAM 21 may have a storage capacity of L×4×64×32 bits=L kilobytes. Also, the HRAM 22 may be provided with L groups of four memory units HM1 to HM4. At this time, the HRAM 22 should have a storage capacity of L*4*8*32 bits=L*128 bytes.
 そして、ALU20は、下記のように実行すればよい。すなわち、まず、第1グループの4つのメッセージブロックMに対応する4つの中間ハッシュ値HO~HOを算出する。次に、第2グループの4つのメッセージブロックMに対応する4つの中間ハッシュ値HO~HOを算出する。以下、第Lグループまで繰り返し実行される。 Then, the ALU 20 should execute as follows. That is, first, four intermediate hash values HO 0 to HO 7 corresponding to the four message blocks M of the first group are calculated. Next, four intermediate hash values HO 0 to HO 7 corresponding to the four message blocks M of the second group are calculated. Thereafter, the processing is repeatedly executed up to the L-th group.
 本変形例の場合、多数のメッセージブロックMに対応する多数の中間ハッシュ値HO~HOを、1つのPEにて算出することができる。 In the case of this modification, a large number of intermediate hash values HO 0 to HO 7 corresponding to a large number of message blocks M can be calculated by one PE.
 (変形例2)
 ところで、メッセージから最終ハッシュ値を求める場合、上述のように、或るメッセージブロックに対応する中間ハッシュ値が、次のメッセージブロックに関する初期のハッシュ値となる。
(Modification 2)
By the way, when obtaining the final hash value from the message, as described above, the intermediate hash value corresponding to a certain message block becomes the initial hash value for the next message block.
 そこで、本変形例では、PE14は、或るグループの4つのメッセージブロックに対応する4つの中間ハッシュ値が、それぞれ、次のグループの4つのメッセージブロックに関する4つの初期のハッシュ値となるように設定される。この場合、HRAM22は、4つのメモリ部HM1~HM4を備えればよい。従って、HRAM22は、4×8×32ビット=128バイトの記憶容量を有すればよい。 Therefore, in this modification, the PE 14 sets the four intermediate hash values corresponding to the four message blocks of a certain group to be the four initial hash values of the four message blocks of the next group. be done. In this case, the HRAM 22 should have four memory units HM1 to HM4. Therefore, the HRAM 22 should have a storage capacity of 4*8*32 bits=128 bytes.
 〔実施形態2〕
 本発明の別の実施形態について、図10~図12を参照して説明する。本実施形態のハッシュ値演算装置は、入力データに対し、上記SHA-256の演算を2回実行するもの(ダブルハッシュ)である。本実施形態のハッシュ値演算装置は、例えばビットコインのマイニングに好適である。
[Embodiment 2]
Another embodiment of the invention is described with reference to FIGS. 10-12. The hash value calculation device of this embodiment performs the above-described SHA-256 calculation twice on input data (double hash). The hash value calculation device of this embodiment is suitable for, for example, bitcoin mining.
 図10は、ビットコインのマイニングにおけるダブルハッシュの概要を示すブロック図である。図10の上段は、ビットコインのブロックチェーンにおける各ブロックの入力データの構造を示している。図10の下段は、上記ブロックに対しマイニングを行うための処理の概要を示している。 Fig. 10 is a block diagram showing an overview of double hashing in bitcoin mining. The upper part of FIG. 10 shows the structure of input data for each block in the Bitcoin blockchain. The lower part of FIG. 10 shows an overview of the processing for mining the above blocks.
 (ビットコインのマイニング)
 ビットコインのマイニング処理では、1024ビットの入力データDATが利用される。図10の上段に示すように、入力データDATは、32ビットのバージョン値、前回ブロックチェーンを作成したときの256ビットのハッシュ値(前のブロックのハッシュ値)、256ビットのマークルルート(Merkle root)ハッシュ値、32ビットのタイムスタンプ、32ビットのターゲット、32ビットのナンス(Nonce)、および384ビットのパディングからなる。
(Bitcoin mining)
1024-bit input data DAT is used in bitcoin mining processing. As shown in the upper part of FIG. 10, the input data DAT consists of a 32-bit version value, a 256-bit hash value (hash value of the previous block) when the block chain was created last time, and a 256-bit Merkle root (Hash value of the previous block). root) hash value, 32-bit timestamp, 32-bit target, 32-bit Nonce, and 384-bit padding.
 まず、入力データDATを2つのメッセージブロックM1・M2に分割する。次に、第1メッセージブロックM1と、ハッシュ値の初期値(初期ハッシュ値)とを用いてハッシュ関数SHA-256(1)を演算し、第1ハッシュ値Ha-1を求める。この処理は、図1~図9におけるハッシュ値演算装置のPE14にて実行されてもよいし、その他の演算装置にて実行されてもよい。なお、初期ハッシュ値は定数である。 First, the input data DAT is divided into two message blocks M1 and M2. Next, the hash function SHA-256(1) is calculated using the first message block M1 and the initial hash value (initial hash value) to obtain the first hash value Ha-1. This process may be executed by the PE 14 of the hash value calculation device in FIGS. 1 to 9, or may be executed by another calculation device. Note that the initial hash value is a constant.
 次に、256ビットの第1ハッシュ値Ha-1と、第2メッセージブロックM2とを用いてハッシュ関数SHA-256(2)を演算し、第2ハッシュ値Ha-2を求める。次に、256ビットの第2ハッシュ値Ha-2に対しパディングを行って512ビットの第3メッセージブロックM3を作成する。次に、第3メッセージブロックM3と、初期ハッシュ値とを用いてハッシュ関数SHA-256(3)を演算し、最終ハッシュ値Ha-Fを求める。換言すれば、第1ハッシュ値Ha-1と、第2メッセージブロックM2とを用いてダブルハッシュを実行し、最終ハッシュ値Ha-Fを取得する。 Next, the hash function SHA-256(2) is calculated using the 256-bit first hash value Ha-1 and the second message block M2 to obtain the second hash value Ha-2. Next, the 256-bit second hash value Ha-2 is padded to create a 512-bit third message block M3. Next, the hash function SHA-256(3) is calculated using the third message block M3 and the initial hash value to obtain the final hash value Ha-F. In other words, double hashing is performed using the first hash value Ha-1 and the second message block M2 to obtain the final hash value Ha-F.
 最終ハッシュ値Ha-Fが所定の閾値に等しいまたは該閾値よりも大きい場合、上記ナンスは正答ではないと判断され、上記ナンスが変更されて(具体的には、1だけ増分されて)、上記動作を繰り返す。一方、最終ハッシュ値Ha-Fが所定の閾値よりも小さい場合、上記ナンスは正答であると判断されて、上記ブロックチェーンに対し新たなブロックが生成される。 If the final hash value Ha-F is equal to or greater than a predetermined threshold, it is determined that the nonce is not correct, the nonce is changed (specifically, incremented by 1), and the repeat the action. On the other hand, if the final hash value Ha-F is smaller than the predetermined threshold, the nonce is determined to be correct and a new block is generated for the blockchain.
 (処理要素)
 本実施形態のハッシュ値演算装置10は、図1~図9に示すハッシュ値演算装置に比べて、PEの構成が異なり、その他の構成は同様である。
(processing element)
The hash value calculation device 10 of this embodiment differs from the hash value calculation devices shown in FIGS. 1 to 9 in the configuration of the PE, and the other configurations are the same.
 図11は、本実施形態のハッシュ値演算装置10におけるPE16の概略構成を示すブロック図である。本実施形態のPE16は、図10に示すハッシュ関数SHA-256(2)・SHA-256(3)を演算するものである。なお、ハッシュ関数SHA-256(2)に用いられる第1ハッシュ値Ha-1と、第2メッセージブロックM2とは、GRAM12(図3参照)に予め記憶されている。 FIG. 11 is a block diagram showing a schematic configuration of the PE 16 in the hash value calculation device 10 of this embodiment. The PE 16 of this embodiment computes the hash functions SHA-256(2) and SHA-256(3) shown in FIG. The first hash value Ha-1 and the second message block M2 used in the hash function SHA-256(2) are pre-stored in the GRAM 12 (see FIG. 3).
 図11は、本実施形態のハッシュ値演算装置10におけるPE16の概略構成を示すブロック図である。本実施形態のPE16は、図10に示すハッシュ関数SHA-256(2)・SHA-256(3)を演算するものである。また、本実施形態のPE16は、概略的には、図4に示すPE14におけるALU20、WRAM21、HRAM22、シフトバッファ23~26、および加算器27のセットを2つ備えている。 FIG. 11 is a block diagram showing a schematic configuration of the PE 16 in the hash value calculation device 10 of this embodiment. The PE 16 of this embodiment computes the hash functions SHA-256(2) and SHA-256(3) shown in FIG. In addition, the PE 16 of this embodiment schematically includes two sets of the ALU 20, WRAM 21, HRAM 22, shift buffers 23 to 26, and adder 27 in the PE 14 shown in FIG.
 具体的には、本実施形態のPE16は、第1セットのALU60、WRAM61、HRAM62、シフトバッファ63~66、および加算器67と、第2セットのALU70、WRAM71、HRAM72、シフトバッファ73~76、および加算器77とを備える構成である。なお、ALU60、70、WRAM61、71、HRAM62、72、シフトバッファ63~66、73~76、および加算器67、77は、図4に示すALU20、WRAM21、HRAM22、シフトバッファ23~26、および加算器27と同様の機能を有するので、その説明を省略する。 Specifically, the PE 16 of this embodiment includes a first set of ALU 60, WRAM 61, HRAM 62, shift buffers 63-66, and adder 67, and a second set of ALU 70, WRAM 71, HRAM 72, shift buffers 73-76, and an adder 77 . ALUs 60, 70, WRAMs 61, 71, HRAMs 62, 72, shift buffers 63-66, 73-76, and adders 67, 77 are equivalent to ALU 20, WRAM 21, HRAM 22, shift buffers 23-26, and adders shown in FIG. Since it has the same function as the device 27, its explanation is omitted.
 第1セットでは、GRAM12からの第2メッセージブロックM2がWRAM61に記憶され、GRAM12からの第1ハッシュ値Ha-1がHRAM62に記憶される。これにより、加算器67は第2ハッシュ値Ha-2を算出する。 In the first set, the second message block M2 from GRAM12 is stored in WRAM61 and the first hash value Ha-1 from GRAM12 is stored in HRAM62. Thereby, the adder 67 calculates the second hash value Ha-2.
 第2セットでは、第1セットからの第2ハッシュ値Ha-2が、第3メッセージブロックM3のワードW~WとしてWRAM71に記憶され、GRAM12からのパディングが第3メッセージブロックM3のワードW~W15としてWRAM71に記憶される。また、GRAM12からの初期ハッシュ値がHRAM72に記憶される。これにより、加算器77は最終ハッシュ値Ha-Fを算出する。 In the second set, the second hash values Ha-2 from the first set are stored in WRAM 71 as words W 0 -W 7 of the third message block M3, and the padding from GRAM 12 is the word W of the third message block M3. 8 to W 15 are stored in the WRAM 71 . Also, the initial hash value from the GRAM 12 is stored in the HRAM 72 . Thereby, the adder 77 calculates the final hash value Ha-F.
 従って、上記ダブルハッシュを本実施形態のPE16で実現することができ、ダブルハッシュを利用するシステムに本実施形態のPE16を組み込むことができる。 Therefore, the above double hashing can be realized by the PE 16 of this embodiment, and the PE 16 of this embodiment can be incorporated into a system that uses double hashing.
 (更新部)
 本実施形態のPE16は、第1セットに更新部68をさらに備えている。更新部68は、WRAM61に記憶されているナンスを更新するものである。
(update part)
The PE 16 of this embodiment further comprises an updater 68 in the first set. The updating unit 68 updates the nonce stored in the WRAM 61 .
 図12は、更新部68の詳細を示すブロック図である。図12に示すように、更新部68は、増分器68aおよびマルチプレクサ68bを備えている。 FIG. 12 is a block diagram showing details of the updating unit 68. As shown in FIG. As shown in FIG. 12, the updating section 68 comprises an incrementer 68a and a multiplexer 68b.
 第2メッセージブロックM2に含まれるナンスは、ワードWとしてWRAM61に記憶される。そこで、増分器68aは、第19ループにおいて、シフトバッファ63からALU60のME演算部30に入力されるワードWを取得して、1だけ増分する。増分器68aは、増分したワードWをマルチプレクサ68bに送出する。 The nonce contained in the second message block M2 is stored in WRAM 61 as word W3. Therefore, in the nineteenth loop, the incrementer 68a acquires the word W3 input from the shift buffer 63 to the ME operation unit 30 of the ALU 60 and increments it by one. Incrementer 68a sends the incremented word W3 to multiplexer 68b.
 第19ループは、ワードWが利用される最後のタイミングである。すなわち、上記入力によりME演算部30におけるワードWの利用が終了したときに、ワードWが更新されることになる。なお、更新部68は、ALU60のME演算部30におけるワードWの利用が終了した時点から、ME演算部30の全てのループ処理が終了した時点までの任意のタイミングで、ワードWのを更新することができる。 The 19th loop is the last time word W3 is used. That is, when the use of word W3 in the ME operation unit 30 is completed by the above input , word W3 is updated. Note that the updating unit 68 updates the word W3 at an arbitrary timing from when the use of the word W3 in the ME operation unit 30 of the ALU 60 ends to when all loop processing of the ME operation unit 30 ends. can be updated.
 マルチプレクサ68bは、ALU60からシフトバッファ65を介して取得したワードW16~W63をWRAM61に書き込むと共に、増分器68aが増分したワードWを新たなワードWとしてWRAM61に書き込む。 The multiplexer 68b writes the words W16 to W63 obtained from the ALU 60 through the shift buffer 65 to the WRAM 61 , and writes the word W3 incremented by the incrementer 68a to the WRAM 61 as a new word W3.
 従って、全てのループが終了した時には、WRAM61には新たなワードWが記憶されている。これにより、上記終了の直後に、PE16は、新たなナンスを含む第2メッセージブロックM2に対し再びループ処理を行って、新たな最終ハッシュ値Ha-Fを算出することができる。その結果、新たなナンスを含む第2メッセージブロックM2をGRAM12から取得する必要が無いので、上記算出を迅速に行うことができる。また、PE16は、多数の異なるナンスをそれぞれ含む多数の第2メッセージブロックM2から多数の最終ハッシュ値Ha-Fを算出でき、PE16が利用するナンスの量の制限が無くなる。 Thus, when all loops are completed , WRAM 61 will have a new word W3 stored. As a result, immediately after the above termination, the PE 16 can again loop the second message block M2 including the new nonce and calculate a new final hash value Ha-F. As a result, there is no need to acquire the second message block M2 containing a new nonce from the GRAM 12, so the above calculation can be performed quickly. Also, the PE 16 can compute multiple final hash values Ha-F from multiple second message blocks M2 each containing multiple different nonces, and there is no limit to the amount of nonces that the PE 16 can utilize.
 また、異なるL個のナンスをそれぞれ含むL個の第2メッセージブロックM2からL個の第2ハッシュ値Ha-2を算出する場合でも、WRAM61の記憶容量をL倍にする必要が無い。すなわち、WRAM61は、4×64×32ビット=1キロバイトの記憶容量を有すればよい。 Further, even when calculating L second hash values Ha-2 from L second message blocks M2 each containing L different nonces, there is no need to increase the storage capacity of the WRAM 61 by L times. That is, the WRAM 61 should have a storage capacity of 4*64*32 bits=1 kilobyte.
 なお、第2セットのWRAM71は、第2ハッシュ値Ha-2を順次更新して記憶すればよい。従って、WRAM71は、WRAM61と同様に、4×64×32ビット=1キロバイトの記憶容量を有すればよい。また、HRAM62・72は、記憶した第1ハッシュ値Ha-1および初期ハッシュ値を変更する必要が無い。従って、HRAM62・72は、4×8×32ビット=128バイトの記憶容量を有すればよい。 The WRAM 71 of the second set may store the second hash value Ha-2 while sequentially updating it. Therefore, like the WRAM 61, the WRAM 71 may have a storage capacity of 4*64*32 bits=1 kilobyte. Also, the HRAMs 62 and 72 do not need to change the stored first hash value Ha-1 and the initial hash value. Therefore, the HRAMs 62 and 72 should have a storage capacity of 4*8*32 bits=128 bytes.
 (判定部)
 図11に示すように、本実施形態のPE16は、第2セットに判定部78をさらに備えている。判定部78は、ALU70からシフトバッファ76を介して取得した最終ハッシュ値Ha-Fが、ターゲットの値よりも小さいかを判定するものである。
(Judgment part)
As shown in FIG. 11, the PE 16 of this embodiment further includes a determination unit 78 in the second set. The determination unit 78 determines whether the final hash value Ha-F obtained from the ALU 70 via the shift buffer 76 is smaller than the target value.
 最終ハッシュ値Ha-Fがターゲットの値に等しい、または該ターゲットの値よりも大きい場合、判定部78は、最終ハッシュ値Ha-Fが有効なハッシュ値ではないと判定して、最終ハッシュ値Ha-Fを破棄する。一方、最終ハッシュ値Ha-Fがターゲットの値よりも小さい場合、判定部78は、最終ハッシュ値Ha-Fが有効なハッシュ値であると判定する。このとき、判定部78は、当該最終ハッシュ値Ha-Fと、該最終ハッシュ値Ha-Fに対応するナンスとをGRAM12に出力する。そして、判定部78は、全てのPE16に対し、動作を終了するように指示する。 If the final hash value Ha-F is equal to or greater than the target value, the determination unit 78 determines that the final hash value Ha-F is not a valid hash value, and determines that the final hash value Ha-F is not valid. - Discard F. On the other hand, when the final hash value Ha-F is smaller than the target value, the determination unit 78 determines that the final hash value Ha-F is a valid hash value. At this time, the determination unit 78 outputs the final hash value Ha-F and the nonce corresponding to the final hash value Ha-F to the GRAM 12 . Then, the determination unit 78 instructs all the PEs 16 to end their operations.
 従って、本実施形態のPE16は、第2メッセージブロックM2に含まれるナンスを次々に更新して、第2ハッシュ値Ha-2を次々に算出し、最終ハッシュ値Ha-Fを次々に算出して、最終ハッシュ値Ha-Fが有効なハッシュ値であるかを次々に判定することができる。その結果、ビットコインのマイニングを効率よく実行することができる。 Therefore, the PE 16 of this embodiment successively updates the nonce included in the second message block M2, successively calculates the second hash value Ha-2, and successively calculates the final hash value Ha-F. , the final hash value Ha-F is a valid hash value in turn. As a result, bitcoin mining can be efficiently executed.
 なお、判定部78は、最終ハッシュ値Ha-Fが有効なハッシュ値であると判定した場合、全てのPE16が動作を終了するようにコントローラ11に指示したり、或いは、全てのPE16に指示したりしてもよい。これにより、その後の不要な上記マイニングの処理を実行せずに済む。 Note that when the determination unit 78 determines that the final hash value Ha-F is a valid hash value, the determination unit 78 instructs the controller 11 to end the operation of all the PEs 16, or instructs all the PEs 16. You can As a result, the subsequent unnecessary mining process can be avoided.
 (付記事項)
 本実施形態のハッシュ値演算装置10は、ビットコインのマイニングに適用しているが、その他のブロックチェーンのマイニングにも適用可能である。また、本実施形態のハッシュ値演算装置10は、ダブルハッシュの演算に適用しているが、3回以上のハッシュ関数の演算を実行する場合にも適用可能である。
(Additional notes)
Although the hash value calculation device 10 of the present embodiment is applied to mining of bitcoin, it can also be applied to mining of other blockchains. Further, although the hash value calculation device 10 of the present embodiment is applied to the double hash calculation, it can also be applied to the case of executing the calculation of the hash function three times or more.
 〔実施形態3〕
 本発明の他の実施形態について、図13を参照して説明する。
[Embodiment 3]
Another embodiment of the invention will be described with reference to FIG.
 図13は、本実施形態の組込みシステムの概略構成を示すブロック図である。図13に示すように、組込みシステム80は、プロセッサ81と、DDR(Double Data Rate)メモリ82と、AMBA(Advanced Microcontroller Bus Architecture)バス83と、図1~図12に示すハッシュ値演算装置10と、AXIバス84とを備える構成である。 FIG. 13 is a block diagram showing the schematic configuration of the embedded system of this embodiment. As shown in FIG. 13, an embedded system 80 includes a processor 81, a DDR (Double Data Rate) memory 82, an AMBA (Advanced Microcontroller Bus Architecture) bus 83, and the hash value calculation device 10 shown in FIGS. , and an AXI bus 84 .
 プロセッサ81は、CPU、キャッシュ、およびメモリ管理ユニット(MMU)を備える。プロセッサ81およびDDRメモリ82は、AMBAバス83を介して接続される。また、プロセッサ81およびハッシュ値演算装置10は、AXIバス84を介して接続される。図13に示すように、図1~図12に示すハッシュ値演算装置10を組込みシステムに組み込むことができる。 The processor 81 includes a CPU, cache, and memory management unit (MMU). Processor 81 and DDR memory 82 are connected via AMBA bus 83 . The processor 81 and hash value calculation device 10 are also connected via an AXI bus 84 . As shown in FIG. 13, the hash value calculation device 10 shown in FIGS. 1 to 12 can be incorporated into an embedded system.
 〔ソフトウェアによる実現例〕
 ハッシュ値演算装置10の制御ブロック(特にALU20、60、70)は、集積回路(ICチップ)等に形成された論理回路(ハードウェア)によって実現してもよいし、ソフトウェアによって実現してもよい。
[Example of realization by software]
The control blocks (especially the ALUs 20, 60, and 70) of the hash value calculation device 10 may be realized by a logic circuit (hardware) formed in an integrated circuit (IC chip) or the like, or may be realized by software. .
 後者の場合、ハッシュ値演算装置10は、各機能を実現するソフトウェアであるプログラムの命令を実行するコンピュータを備えている。このコンピュータは、例えば1つ以上のプロセッサを備えていると共に、上記プログラムを記憶したコンピュータ読み取り可能な記録媒体を備えている。そして、上記コンピュータにおいて、上記プロセッサが上記プログラムを上記記録媒体から読み取って実行することにより、本発明の目的が達成される。上記プロセッサとしては、例えばCPU(Central Processing Unit)を用いることができる。上記記録媒体としては、「一時的でない有形の媒体」、例えば、ROM(Read Only Memory)等の他、テープ、ディスク、カード、半導体メモリ、プログラマブルな論理回路などを用いることができる。また、上記プログラムを展開するRAM(Random Access Memory)などをさらに備えていてもよい。また、上記プログラムは、該プログラムを伝送可能な任意の伝送媒体(通信ネットワークや放送波等)を介して上記コンピュータに供給されてもよい。なお、本発明の一態様は、上記プログラムが電子的な伝送によって具現化された、搬送波に埋め込まれたデータ信号の形態でも実現され得る。 In the latter case, the hash value computing device 10 is equipped with a computer that executes program instructions, which are software that implements each function. This computer includes, for example, one or more processors, and a computer-readable recording medium storing the program. In the computer, the processor reads the program from the recording medium and executes it, thereby achieving the object of the present invention. As the processor, for example, a CPU (Central Processing Unit) can be used. As the recording medium, a "non-temporary tangible medium" such as a ROM (Read Only Memory), a tape, a disk, a card, a semiconductor memory, a programmable logic circuit, etc. can be used. In addition, a RAM (Random Access Memory) or the like for developing the above program may be further provided. Also, the program may be supplied to the computer via any transmission medium (communication network, broadcast wave, etc.) capable of transmitting the program. Note that one aspect of the present invention can also be implemented in the form of a data signal embedded in a carrier wave in which the program is embodied by electronic transmission.
 本発明は上述した各実施形態に限定されるものではなく、請求項に示した範囲で種々の変更が可能であり、異なる実施形態にそれぞれ開示された技術的手段を適宜組み合わせて得られる実施形態についても本発明の技術的範囲に含まれる。 The present invention is not limited to the above-described embodiments, but can be modified in various ways within the scope of the claims, and can be obtained by appropriately combining technical means disclosed in different embodiments. is also included in the technical scope of the present invention.
 例えば、上記実施形態では、SHA-256の値を求めているが、入力データを用いて繰り返し処理を行って、入力データを展開し、展開されたデータを用いて繰り返し処理を行って、当該データを圧縮する任意のハッシュ値演算装置に対し、本発明を適用することができる。 For example, in the above embodiment, the value of SHA-256 is obtained. The present invention can be applied to any hash value calculation device that compresses .
 〔まとめ〕
 本発明の一態様に係る処理要素は、所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備えており、前記展開部および前記圧縮部は、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行し、前記圧縮部は、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行するものである。
〔summary〕
A processing element according to one aspect of the present invention is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain a bit sequence longer than the bit length. and a compression unit that repeats loop processing on the expanded bit sequence and compresses it to the intermediate hash value, and the expansion unit and the compression unit are one loop of the expansion unit processing and a part of one loop processing of the compression unit are executed in parallel, and the compression unit performs one loop processing of the compression unit using the word calculated by the one loop processing of the decompression unit. Among them, the remaining processes that are not executed in parallel are executed.
 上記の構成によると、各ループ処理において、前記展開部の演算処理と、前記圧縮部の演算処理の一部とを並行して実行できる。これにより、前記各ループ処理を実行するのに必要なクロック数を低減することができる。 According to the above configuration, in each loop process, the arithmetic processing of the decompression unit and part of the arithmetic processing of the compression unit can be executed in parallel. As a result, the number of clocks required to execute each loop process can be reduced.
 前記展開部は、或るループ処理により算出されたワードを別のループ処理にて利用し、前記圧縮部は、或るループ処理により算出された変数を次のループ処理にて利用する。そして、全てのループ処理が終了することにより、前記中間ハッシュ値が算出される。 The expansion unit uses words calculated by one loop process in another loop process, and the compression unit uses variables calculated by one loop process in the next loop process. Then, the intermediate hash value is calculated by completing all the loop processes.
 従って、1つの前記処理要素のみで、前記メッセージブロックから前記中間ハッシュ値を計算することができる。その結果、メッセージから最終ハッシュ値を求めるのに必要な処理要素の数を低減することができる。 Therefore, it is possible to calculate the intermediate hash value from the message block with only one processing element. As a result, the number of processing elements required to determine the final hash value from the message can be reduced.
 本態様に係る処理要素では、前記メッセージブロックおよび前記ワードを記憶する展開用メモリと、前記圧縮部の最初のループ処理にて用いられるハッシュ値の初期値を記憶する圧縮用メモリとをさらに備えてもよい。上記の構成によると、外部のメモリに前記ワードを書き込んだり、前記外部のメモリから前記メッセージブロック、前記ハッシュ値の初期値、および前記ワードを読み出したりする必要がない。従って、前記処理要素の処理効率を向上することができる。 The processing element according to this aspect further comprises a decompression memory that stores the message block and the word, and a compression memory that stores an initial hash value used in the first loop processing of the compression unit. good too. According to the above configuration, it is not necessary to write the word to the external memory or to read the message block, the initial value of the hash value, and the word from the external memory. Therefore, the processing efficiency of the processing element can be improved.
 本態様に係る処理要素では、前記圧縮部は、前記圧縮用メモリに記憶された前記ハッシュ値の初期値を前記中間ハッシュ値で更新してもよい。上記の構成によると、前記展開用メモリに記憶された前記メッセージブロックが次のメッセージブロックで更新されることにより、前記処理要素は次の中間ハッシュ値を算出することができる。そして、これを繰り返すことにより、1つの前記処理要素のみで、前記メッセージから最終ハッシュ値を求めることができる。 In the processing element according to this aspect, the compression unit may update the initial value of the hash value stored in the compression memory with the intermediate hash value. According to the above configuration, by updating the message block stored in the expansion memory with the next message block, the processing element can calculate the next intermediate hash value. By repeating this, only one processing element can obtain the final hash value from the message.
 本態様に係る処理要素では、前記展開用メモリおよび前記圧縮用メモリのそれぞれは、前記圧縮部が1ループの処理を実行するのに必要なクロック数だけメモリ部を備えてもよい。上記の構成によると、前記展開用メモリの複数のメモリ部に複数のメッセージブロックを記憶し、前記圧縮用メモリの複数のメモリ部に、前記複数のメッセージブロックに対応する複数のハッシュ値の初期値を記憶する。これにより、複数のメッセージブロックに対する複数のループ処理を上記クロック数で実行することができる。すなわち、1クロックあたり1つのループ処理を実行することができる。その結果、前記処理要素における処理効率をさらに向上することができる。 In the processing element according to this aspect, each of the decompression memory and the compression memory may include a memory section for the number of clocks required for the compression section to execute one loop process. According to the above configuration, a plurality of message blocks are stored in the plurality of memory units of the decompression memory, and initial hash values corresponding to the plurality of message blocks are stored in the plurality of memory units of the compression memory. memorize As a result, a plurality of loop processes for a plurality of message blocks can be executed with the above number of clocks. That is, one loop process can be executed per clock. As a result, processing efficiency in the processing elements can be further improved.
 本態様に係る処理要素では、前記展開用メモリから前記展開部に入力されるデータを一時記憶する入力用バッファと、前記圧縮用メモリから前記圧縮部に入力されるデータを一時記憶する入力用バッファとをさらに備えてもよい。 In the processing element according to this aspect, an input buffer for temporarily storing data input from the decompression memory to the decompression unit, and an input buffer for temporarily storing data input from the compression memory to the compression unit and may be further provided.
 上記の構成によると、前記入力用バッファは、前記展開部にて必要とされるデータを、前記展開用メモリから順次読み出しておき、所定のタイミングで前記展開部に一斉に出力することができる。これにより、前記展開部は、前記展開用メモリから前記データを読み出すために待機する必要がなくなる。また、前記入力用バッファは、前記圧縮部にて必要とされるデータを、前記圧縮用メモリから順次読み出しておき、所定のタイミングで前記圧縮部に一斉に出力することができる。これにより、前記圧縮部は、前記圧縮用メモリから前記データを読み出すために待機する必要がなくなる。その結果、前記処理要素における処理効率をさらに向上することができる。 According to the above configuration, the input buffer can sequentially read out the data required by the expansion section from the expansion memory and simultaneously output the data to the expansion section at a predetermined timing. This eliminates the need for the expansion unit to wait for reading the data from the expansion memory. Further, the input buffer can sequentially read the data required by the compression section from the compression memory and output them all at once to the compression section at a predetermined timing. This eliminates the need for the compression unit to wait to read the data from the compression memory. As a result, processing efficiency in the processing elements can be further improved.
 なお、前記展開用メモリおよび前記圧縮用メモリのそれぞれが複数の前記メモリ部を備える場合、前記入力用バッファは、複数の前記メモリ部に対応するバッファ部を備えることが望ましい。 It should be noted that when each of the expansion memory and the compression memory includes a plurality of memory units, the input buffer preferably includes buffer units corresponding to the plurality of memory units.
 本態様に係る処理要素では、前記展開部から前記展開用メモリに出力するデータを一時記憶する出力用バッファと、前記圧縮部から前記圧縮用メモリに出力するデータを一時記憶する出力用バッファとをさらに備えてもよい。 The processing element according to this aspect includes an output buffer for temporarily storing data to be output from the decompression unit to the decompression memory, and an output buffer for temporarily storing data to be output from the compression unit to the compression memory. You may have more.
 この場合、前記出力用バッファは、前記展開部が出力するデータを、前記展開用メモリに順次書き込むことができる。これにより、前記展開部は、前記展開用メモリに前記データを書き込むために待機する必要がなくなる。また、前記出力用バッファは、前記圧縮部が出力するデータを、前記圧縮用メモリに順次書き込むことができる。これにより、前記圧縮部は、前記圧縮用メモリに前記データを書き込むために待機する必要がなくなる。その結果、前記処理要素における処理効率をさらに向上することができる。 In this case, the output buffer can sequentially write the data output by the expansion unit to the expansion memory. This eliminates the need for the expansion unit to wait for writing the data in the expansion memory. Further, the output buffer can sequentially write the data output from the compression unit to the compression memory. This eliminates the need for the compression unit to wait for writing the data in the compression memory. As a result, processing efficiency in the processing elements can be further improved.
 なお、前記展開用メモリおよび前記圧縮用メモリのそれぞれが複数の前記メモリ部を備える場合、前記出力用バッファは、複数の前記メモリ部に対応するバッファ部を備えることが望ましい。 When the expansion memory and the compression memory each include a plurality of memory units, it is preferable that the output buffer includes buffer units corresponding to the plurality of memory units.
 本態様に係る処理要素では、前記展開部、前記圧縮部、前記展開用メモリ、および前記圧縮用メモリのセットを複数個備えており、或るセットの前記圧縮部は、圧縮した前記中間ハッシュ値を別のセットの前記メッセージブロックの一部として前記別のセットの前記展開用メモリに書き込んでもよい。 The processing element according to this aspect includes a plurality of sets of the expansion unit, the compression unit, the expansion memory, and the compression memory, and one set of the compression units includes the compressed intermediate hash value may be written to the other set of the expansion memory as part of the other set of the message blocks.
 この場合、ダブルハッシュ等のように、前記メッセージブロックに対しハッシュ関数を複数回実行することを、1つの処理要素で実現することができる。その結果、ビットコインなどのようなダブルハッシュを利用するシステムに前記処理要素を適用することができる。 In this case, a single processing element can be used to execute a hash function on the message block multiple times, such as double hashing. As a result, the processing element can be applied to systems that utilize double hashes, such as Bitcoin.
 本態様に係る処理要素では、前記セットの数は2つであり、第1のセットの前記展開用メモリに記憶された前記メッセージブロックにおける所定範囲のワードを、第1のセットの前記展開部における当該ワードの利用が終了した場合に更新する更新部をさらに備えてもよい。上記の構成によると、前記メッセージブロックにおける所定範囲のワードを次々に更新して、中間ハッシュ値を次々に算出することができる。その結果、ビットコインのマイニングを効率よく実行することができる。なお、前記更新部は、第1のセットの前記展開部における前記ワードの利用が終了した時点から、第1のセットの全てのループ処理が終了した時点までの任意のタイミングで、前記ワードを更新することができる。 In the processing element according to this aspect, the number of sets is two, and words in a predetermined range in the message block stored in the expansion memory of the first set are converted to An updating unit may be further provided for updating when the use of the word is finished. According to the above configuration, it is possible to successively update the predetermined range of words in the message block and successively calculate intermediate hash values. As a result, bitcoin mining can be efficiently executed. Note that the updating unit updates the word at an arbitrary timing from the end of use of the word in the expansion unit of the first set to the end of all loop processing of the first set. can do.
 本態様に係る処理要素では、第2のセットの前記圧縮部が圧縮した前記中間ハッシュ値を最終ハッシュ値として、該最終ハッシュ値が有効なハッシュ値であるかを判定する判定部をさらに備えてもよい。上記の構成によると、第1のセットの圧縮部が次々に算出した前記中間ハッシュ値を用いて、第2セットの前記圧縮部が前記最終ハッシュ値を次々に算出することができる。これにより、前記判定部は、次々に算出された最終ハッシュ値が有効なハッシュ値であるかを判定することができる。その結果、ビットコインのマイニングをさらに効率よく実行することができる。 The processing element according to this aspect further comprises a determination unit that determines whether the intermediate hash value compressed by the compression unit of the second set is a final hash value, and that the final hash value is a valid hash value. good too. According to the above configuration, the compression units of the second set can successively calculate the final hash values using the intermediate hash values successively calculated by the compression units of the first set. Accordingly, the determination unit can determine whether the successively calculated final hash values are valid hash values. As a result, bitcoin mining can be performed more efficiently.
 なお、前記判定部は、前記最終ハッシュ値が有効なハッシュ値であると判定した場合、当該最終ハッシュ値と、該最終ハッシュ値に対応する前記所定範囲のワードとを、外部の装置に通知して、前記処理要素の動作を終了させてもよい。これにより、その後の不要な前記マイニングの処理を実行せずに済む。 When determining that the final hash value is a valid hash value, the determination unit notifies an external device of the final hash value and the predetermined range of words corresponding to the final hash value. may terminate the operation of the processing element. This eliminates the need to execute the subsequent unnecessary mining process.
 本発明の各態様に係る処理要素は、コンピュータによって実現してもよく、この場合には、コンピュータを前記処理要素が備える各部(ソフトウェア要素)として動作させることにより前記処理要素をコンピュータにて実現させる処理要素の制御プログラム、およびそれを記録したコンピュータ読み取り可能な記録媒体も、本発明の範疇に入る。 The processing elements according to each aspect of the present invention may be realized by a computer. In this case, the processing elements are realized by the computer by operating the computer as each part (software element) included in the processing elements. A control program for a processing element and a computer-readable recording medium recording it are also included in the scope of the present invention.
 本発明の別の態様に係る処理装置は、上記構成の処理要素を複数個備え、複数の前記処理要素を制御する制御部をさらに備えるものである。 A processing apparatus according to another aspect of the present invention includes a plurality of processing elements configured as described above, and further includes a control section for controlling the plurality of processing elements.
 上記の構成によると、上述の効果を奏することができる。また、ビットコインのマイニングにおいて、制御部が、前記ワードの変更範囲を前記処理要素ごとに設定することにより、前記マイニングを複数の前記処理要素にて並行に実行することができ、前記マイニングをさらに効率よく実行することができる。 According to the above configuration, the above effects can be achieved. Further, in bitcoin mining, the control unit sets the word change range for each processing element, so that the mining can be executed in parallel by a plurality of the processing elements, and the mining can be further performed. can be executed efficiently.
 この場合、制御部は、有効なハッシュ値と判定された最終ハッシュ値と、該最終ハッシュ値に対応する所定範囲のワードとを、或る処理要素から取得した場合、全ての処理要素に対し動作を終了するように指示することが望ましい。これにより、その後の不要な前記マイニングの処理を実行せずに済む。 In this case, when a final hash value determined to be a valid hash value and a predetermined range of words corresponding to the final hash value are acquired from a certain processing element, the control unit operates on all processing elements. should be instructed to end the This eliminates the need to execute the subsequent unnecessary mining process.
 本発明の他の態様に係る処理要素の制御方法は、所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備える処理要素の制御方法であって、前記展開部および前記圧縮部にて、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行させるステップと、前記圧縮部にて、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行させるステップとを含んでいる。 A processing element control method according to another aspect of the present invention is a processing element that calculates an intermediate hash value from a message block of a predetermined bit length, and repeats loop processing on the message block to obtain: A control method for a processing element, comprising: an expansion unit that expands a bit sequence to a longer bit sequence; and a compression unit that repeats loop processing on the expanded bit sequence and compresses the expanded bit sequence to the intermediate hash value, wherein the expansion unit and the a step of causing the compression unit to execute one loop process of the decompression unit and a part of the one loop process of the compression unit in parallel; and a step of executing the remaining processes, which are not executed in parallel, of the one loop process of the compression unit, using the words obtained.
 上記の方法によれば、上述の処理要素と同様の効果を奏することができる。 According to the above method, the same effects as those of the above processing elements can be achieved.
10 ハッシュ値演算装置(処理装置)
11 コントローラ(制御部)
12 GRAM
13 バス
14、16 PE
15 バスIF
20、60、70 ALU
21、61、71 WRAM(展開用メモリ)
22、62、72 HRAM(圧縮用メモリ)
23、24、63、64、73、74シフトバッファ(入力用バッファ)
25、26、65、66、75、76シフトバッファ(出力用バッファ)
27、67、77 加算器
30 ME演算部(展開部)
31 MC演算部(圧縮部)
32、44、49、68b マルチプレクサ
33、54、59 デマルチプレクサ
40~43、45~48 シフトレジスタ(入力用バッファ)
50~53、55~58 シフトレジスタ(出力用バッファ)
68 更新部
68a 増分器
78 判定部
80 システム
81 プロセッサ
82 DDRメモリ
82 メモリ
83 AMBAバス
84 AXIバス
10 Hash value calculation device (processing device)
11 controller (control unit)
12 GRAM
13 bus 14, 16 PE
15 bus interface
20, 60, 70 ALUs
21, 61, 71 WRAM (development memory)
22, 62, 72 HRAM (memory for compression)
23, 24, 63, 64, 73, 74 shift buffers (input buffers)
25, 26, 65, 66, 75, 76 shift buffers (output buffers)
27, 67, 77 Adder 30 ME calculation unit (development unit)
31 MC calculation unit (compression unit)
32, 44, 49, 68b Multiplexers 33, 54, 59 Demultiplexers 40-43, 45-48 Shift registers (input buffers)
50-53, 55-58 shift register (buffer for output)
68 update unit 68a incrementer 78 decision unit 80 system 81 processor 82 DDR memory 82 memory 83 AMBA bus 84 AXI bus

Claims (12)

  1.  所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、
     前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、
     展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備えており、
     前記展開部および前記圧縮部は、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行し、
     前記圧縮部は、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行する処理要素。
    A processing element that calculates an intermediate hash value from a message block of predetermined bit length,
    an expansion unit that repeats loop processing on the message block and expands it into a bit sequence longer than the bit length;
    a compression unit that repeats loop processing on the expanded bit sequence and compresses it to the intermediate hash value,
    The expansion unit and the compression unit execute in parallel one loop processing of the expansion unit and part of one loop processing of the compression unit,
    The compression unit is a processing element that uses the word calculated by the one loop processing of the decompression unit to execute the remaining processing that is not executed in parallel in the one loop processing of the compression unit.
  2.  前記メッセージブロックおよび前記ワードを記憶する展開用メモリと、
     前記圧縮部の最初のループ処理にて用いられるハッシュ値の初期値を記憶する圧縮用メモリとをさらに備える、請求項1に記載の処理要素。
    an expansion memory for storing the message blocks and the words;
    2. The processing element according to claim 1, further comprising a compression memory for storing an initial hash value used in the first loop processing of said compression unit.
  3.  前記圧縮部は、前記圧縮用メモリに記憶された前記ハッシュ値の初期値を前記中間ハッシュ値で更新する、請求項2に記載の処理要素。 The processing element according to claim 2, wherein the compression unit updates the initial value of the hash value stored in the compression memory with the intermediate hash value.
  4.  前記展開用メモリおよび前記圧縮用メモリのそれぞれは、前記圧縮部が1ループの処理を実行するのに必要なクロック数だけメモリ部を備える、請求項2または3に記載の処理要素。 4. The processing element according to claim 2 or 3, wherein each of said decompression memory and said compression memory comprises a memory section for the number of clocks necessary for said compression section to execute processing of one loop.
  5.  前記展開用メモリから前記展開部に入力されるデータを一時記憶する入力用バッファと、前記圧縮用メモリから前記圧縮部に入力されるデータを一時記憶する入力用バッファとをさらに備える、請求項2から4までの何れか1項に記載の処理要素。 3. An input buffer for temporarily storing data inputted from said expansion memory to said expansion unit, and an input buffer for temporarily storing data inputted from said compression memory to said compression unit. 5. A processing element according to any one of clauses 1 to 4.
  6.  前記展開部から前記展開用メモリに出力するデータを一時記憶する出力用バッファと、前記圧縮部から前記圧縮用メモリに出力するデータを一時記憶する出力用バッファとをさらに備える、請求項2から5までの何れか1項に記載の処理要素。 6. An output buffer for temporarily storing data to be output from said decompression unit to said decompression memory, and an output buffer for temporarily storing data to be output from said compression unit to said compression memory. A processing element according to any one of the preceding claims.
  7.  前記展開部、前記圧縮部、前記展開用メモリ、および前記圧縮用メモリのセットを複数個備えており、
     或るセットの前記圧縮部は、圧縮した前記中間ハッシュ値を別のセットの前記メッセージブロックの一部として前記別のセットの前記展開用メモリに書き込む、請求項2から6までの何れか1項に記載の処理要素。
    a plurality of sets of the decompression unit, the compression unit, the decompression memory, and the compression memory,
    7. Any one of claims 2 to 6, wherein the compression unit of a set writes the compressed intermediate hash value as part of the message block of another set into the decompression memory of the other set. Processing elements described in .
  8.  前記セットの数は2つであり、
     第1のセットの前記展開用メモリに記憶された前記メッセージブロックにおける所定範囲のワードを、第1のセットの前記展開部における当該ワードの利用が終了した場合に更新する更新部をさらに備える、請求項7に記載の処理要素。
    the number of said sets is two;
    further comprising an update unit that updates a predetermined range of words in the message block stored in the expansion memory of the first set when use of the words in the expansion unit of the first set ends; A processing element according to clause 7.
  9.  第2のセットの前記圧縮部が圧縮した前記中間ハッシュ値を最終ハッシュ値として、該最終ハッシュ値が有効なハッシュ値であるかを判定する判定部をさらに備える、請求項8に記載の処理要素。 9. The processing element according to claim 8, further comprising a determining unit for determining whether the intermediate hash value compressed by the compressing unit of the second set is a final hash value and whether the final hash value is a valid hash value. .
  10.  請求項1から9までの何れか1項に記載の処理要素を複数個備え、
     複数の前記処理要素を制御する制御部をさらに備える、処理装置。
    A plurality of processing elements according to any one of claims 1 to 9,
    A processing device, further comprising a control unit that controls the plurality of processing elements.
  11.  所定のビット長のメッセージブロックから中間ハッシュ値を算出する処理要素であって、前記メッセージブロックに対しループ処理を繰り返して、前記ビット長よりも長いビット系列に展開する展開部と、展開されたビット系列に対しループ処理を繰り返して、前記中間ハッシュ値に圧縮する圧縮部とを備える処理要素の制御方法であって、
     前記展開部および前記圧縮部にて、前記展開部の1ループ処理と、前記圧縮部の1ループ処理の一部とを並行して実行させるステップと、
     前記圧縮部にて、前記展開部の1ループ処理により算出されたワードを用いて、前記圧縮部の1ループ処理のうち、前記並行して実行されない残りの処理を実行させるステップとを含む、処理要素の制御方法。
    A processing element for calculating an intermediate hash value from a message block of a predetermined bit length, comprising: an expansion unit for repeating loop processing on the message block and expanding it into a bit sequence longer than the bit length; and expanded bits. A control method for a processing element comprising: a compression unit that repeats loop processing for a sequence and compresses to the intermediate hash value,
    causing the decompression unit and the compression unit to concurrently execute one loop process of the decompression unit and part of the one loop process of the compression unit;
    and causing the compression unit to use the words calculated by the one-loop processing of the decompression unit to execute the remaining processing that is not executed in parallel in the one-loop processing of the compression unit. How the element is controlled.
  12.  請求項1に記載の処理要素としてコンピュータを機能させるための制御プログラムであって、前記展開部および前記圧縮部としてコンピュータを機能させるための制御プログラム。 A control program for causing a computer to function as the processing element according to claim 1, the control program for causing the computer to function as the expansion section and the compression section.
PCT/JP2022/002090 2021-01-22 2022-01-21 Processing element, control method and control program therefor, and processing device WO2022158549A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2022576751A JPWO2022158549A1 (en) 2021-01-22 2022-01-21

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2021009164 2021-01-22
JP2021-009164 2021-01-22

Publications (1)

Publication Number Publication Date
WO2022158549A1 true WO2022158549A1 (en) 2022-07-28

Family

ID=82548954

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2022/002090 WO2022158549A1 (en) 2021-01-22 2022-01-21 Processing element, control method and control program therefor, and processing device

Country Status (2)

Country Link
JP (1) JPWO2022158549A1 (en)
WO (1) WO2022158549A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118013592A (en) * 2024-04-10 2024-05-10 成都时域半导体有限公司 Message digest generation circuit and method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170302440A1 (en) * 2015-04-14 2017-10-19 PeerNova, Inc. Secure hash algorithm in digital hardware for cryptographic applications

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170302440A1 (en) * 2015-04-14 2017-10-19 PeerNova, Inc. Secure hash algorithm in digital hardware for cryptographic applications

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MARTINO RAFFAELE; CILARDO ALESSANDRO: "SHA-2 Acceleration Meeting the Needs of Emerging Applications: A Comparative Survey", IEEE ACCESS, IEEE, USA, vol. 8, 7 February 2020 (2020-02-07), USA , pages 28415 - 28436, XP011773274, DOI: 10.1109/ACCESS.2020.2972265 *
TRAN THI HONG; PHAM HOAI LUAN; PHAN TRI DUNG; NAKASHIMA YASUHIKO: "BCA: A 530-mW Multicore Blockchain Accelerator for Power-Constrained Devices in Securing Decentralized Networks", IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS I: REGULAR PAPERS, IEEE, US, vol. 68, no. 10, 17 August 2021 (2021-08-17), US , pages 4245 - 4258, XP011880415, ISSN: 1549-8328, DOI: 10.1109/TCSI.2021.3102618 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118013592A (en) * 2024-04-10 2024-05-10 成都时域半导体有限公司 Message digest generation circuit and method

Also Published As

Publication number Publication date
JPWO2022158549A1 (en) 2022-07-28

Similar Documents

Publication Publication Date Title
US9960909B2 (en) High speed and low power hashing system and method
US10097345B2 (en) Secure hash algorithm in digital hardware for cryptographic applications
WO2002101978A2 (en) Apparatus and method for a hash processing system using multiple hash storage areas
JP2009521059A (en) Perform cyclic redundancy check operations according to user level instructions
TW201636829A (en) Cryptographic hashing circuitry having improved scheduling efficiency
WO2022158549A1 (en) Processing element, control method and control program therefor, and processing device
US20200036517A1 (en) Secure hash algorithm implementation
WO2002101525A2 (en) Apparatus and methods for a hash processing system using integrated message digest and secure hash architectures
JP5231800B2 (en) Semiconductor integrated circuit device and clock control method for semiconductor integrated circuit device
CN108959168B (en) SHA512 full-flow water circuit based on-chip memory and implementation method thereof
WO2022174700A1 (en) Computing apparatus for proof of work, and asic chip and computing method for proof of work
Atiwa et al. Accelerated hardware implementation of blake2 cryptographic hash for blockchain
CN112650471A (en) Processor and method for processing masked data
CN110022203A (en) A kind of SM3 acceleration method and device
CN116318660B (en) Message expansion and compression method and related device
Sideris et al. Hardware acceleration of SHA-256 algorithm using NIOS-II processor
WO2023000577A1 (en) Data compression method and apparatus, electronic device, and storage medium
WO2004042602A1 (en) Apparatus to implement dual hash algorithm
KR100954843B1 (en) Method and Apparatus of elliptic curve cryptographic operation based on block indexing on sensor mote and Recording medium using by the same
JP2004227248A (en) Arithmetic unit and arithmetic method
JP2013517576A (en) Multi-stage multiplexing operations including combining data selection and data alignment or data replication
JP6961950B2 (en) Storage method, storage device and storage program
WO2024168608A1 (en) Logic operation circuit, compression circuit of secure hash algorithm, and chip
Tuan et al. Three-stage pipeline implementation for SHA2 using data forwarding
CN115344525B (en) Method and device for accelerating point-stiffened part of elliptic curve

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22742668

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022576751

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22742668

Country of ref document: EP

Kind code of ref document: A1