The present invention relates to the operation of a message scheduler when performing cryptographic hashing in respect of plural different input messages to be hashed. The present invention relates particularly, although not exclusively, to cryptographic hashing when mining for cryptocurrency, such as Bitcoin.
Bitcoin mining comprises applying three instances of a SHA256 cryptographic hashing function (referred to herein respectively as “SHA2560.” “SHA2561” and “SHA2562”) to an input message, which is derived from a Bitcoin Block Header. SHA2560 uses a standard initialisation vector IV and is applied to a first part of the Bitcoin Block Header. SHA2561 then uses the message digest H0 of SHA2560 as an initialisation vector and is applied to a second part of the Bitcoin Block Header plus some padding. Finally, SHA2562 again uses the standard initialisation vector IV and is applied to the message digest of SHA2561 plus some padding.
The ultimate aim of Bitcoin mining is to find a SHA2562 message digest or “hash” that is lower than or equal to the current Target. If the Target condition is met, then the Bitcoin Block Header in question is accepted by the Bitcoin Network and the Bitcoin miner receives a mining award. On the other hand, if the Target condition is not met, the Bitcoin miner will need to perform cryptographic hashing in respect of one or more different Bitcoin Block Headers until the specified Target condition is met.
The different Bitcoin Block Headers are generally generated by incrementing a Nonce field in the second part of the Bitcoin Block Header. In this case, since the first part of the Bitcoin Block Header remains unchanged, the output of SHA2560 is unchanged and there is no need to re-perform SHA2560 for each new Nonce. Once all values for the Nonce have been exhausted, then a Bitcoin Block Header that references different transactions, by way of a different HashMerkleRoot, might be considered. Since the HashMerkleRoot spans both parts of the Bitcoin Block Header, SHA2560 then needs to be re-performed to generate a new message digest H0, and SHA2561 then needs to be re-applied to the second part of the Bitcoin Block Header using that new message digest H0 as the initialisation vector.
Bitcoin mining can be extremely computationally expensive and various optimisations have therefore been proposed. For example, Rahul P. Naik, “Optimising the SHA256 Hashing Algorithm for Faster and More Efficient Bitcoin Mining”, MSc Information Security Department of Computer Science UCL, 2013, describes various optimisations which make use of the fact that certain portions of the Bitcoin Block Header remain unchanged, or are slow to change, or are merely incremented, for plural different input messages. US 2018/0006808 A1 describes further optimisations which use hardwired values for the portions of input messages that always remain the same.
The above optimisations go some way to reducing the computational burden but further optimisation, particularly relating to message scheduling, is possible. In this regard, when performing the cryptographic hashing, a message scheduler is used to calculate (from distinct portions of the input message) a set of input values for compression by the cryptographic compression function. This process of calculating the input values can contribute significantly to the computational effort required to perform the cryptographic hashing.
EP 3 095 044 A1 accordingly describes an optimisation commonly known as “ASICBoost” in which different input messages are used for SHA2560 but in which the last 32 bits of the HashMerkleRoot in the Bitcoin Block Header, which are used to derive the input message for SHA2561, are kept the same. This is achieved either by identifying multiple instances of HashMerkleRoot that collide in the last 32 bits (commonly known as “Covert ASICBoost”) or by incrementing the Version in the Bitcoin Block Header (commonly known as “Overt ASICBoost”). The same message schedule for SHA2561 can then be reused for multiple outputs of SHA2560. Pham et al, “Double SHA-256 Hardware Architecture With Compact Message Expander for Bitcoin Mining”. IEEE Access, Volume 8, 2020, pp. 139634-139646, also describes avoiding certain message scheduler calculations for SHA2561 and SHA2562 where the input values will always have the value 0x00000000.
It is desired to provide further improvements relating to message scheduling for cryptographic hashing.
According to an aspect of the present invention there is provided a method of performing cryptographic hashing in respect of plural different input messages to be hashed, the method comprising:
According to another aspect of the present invention there is provided an apparatus for performing cryptographic hashing in respect of plural different input messages to be hashed, the apparatus comprising:
As will be appreciated, the present invention can greatly increase speed and efficiency when performing cryptographic hashing in respect of plural different input messages which have invariable portions and variable portions. In particular, the Applicant has recognised that certain input values for a cryptographic compression function may vary for plural different input messages to be hashed. This is because those variable input values are derived from message portions which vary across the plural different input messages to be hashed. However, the Applicant has identified that even those variable input values might be calculated at least in part using message portions which do not vary across the plural different input messages to be hashed. The Applicant has then recognised that those variable input values can at least be partially calculated once in respect of an initial input message using the invariable portions, and that those partially-calculated input values can then be reused to calculate fully-calculated input values for one or more subsequent input messages. This can significantly reduce the number of calculations which need to be performed when calculating the variable input values for plural different input messages to be hashed. This in turn can significantly increase the processing speed and/or can significantly reduce the processing burden placed on the apparatus used to perform the cryptographic hashing. This is in contrast to the known optimisations in which only invariable fully-calculated input values are determined in advance and then reused for plural different input messages.
In embodiments, the cryptographic hashing may be performed when mining for cryptocurrency, such as (but not limited to) Bitcoin. However, the techniques disclosed herein may equally be applied in other cryptographic hashing contexts in which plural input messages have invariable portions and variable portions.
In embodiments, the cryptographic compression function may be a SHA256 compression function. The cryptographic compression function may be a first instance cryptographic compression function (referred to herein as “SHA2560”), a second instance cryptographic compression function (referred to herein as “SHA2561”), or a third instance cryptographic compression function (referred to herein as “SHA2562”). Overall, the cryptographic hashing may comprise performing plural (e.g. three) instances of a cryptographic compression function, with a message scheduler for one or more (e.g. each) instance operating in the manner of the present invention.
In embodiments, the plural different input messages to be hashed may each correspond to a different Bitcoin Block Header. The Bitcoin Block Headers may each comprise a Version field, a HashPrevBlock field, a HashMerkleRoot field, a Timestamp field, a Target field, and a Nonce field. The Bitcoin Block Headers may be padded with a Padding+Length field for the purposes of the cryptographic hashing. The one or more invariable portions and/or one or more variable portions may be distinct portions of an input message to be hashed.
In embodiments in which the cryptographic compression function is a first instance cryptographic compression function (SHA2560), the plural different input messages to be hashed may each comprise a Version field, a HashPrevBlock field, and/or a (first) part of a HashMerkleRoot field. The one or more invariable portions may correspond to the HashPrevBlock field and/or to the (first) part of the HashMerkleRoot field. The one or more variable portions may correspond to the Version field. The Version field may be incremented across the plural different input messages. In embodiments in which the cryptographic compression function is a first instance cryptographic compression function (SHA2560), the cryptographic compression function may use the SHA256 standard initialisation vector as the initialisation vector.
In embodiments in which the cryptographic compression function is a second instance cryptographic compression function (SHA2561), the plural different input messages to be hashed may each comprise a (second) part of a HashMerkleRoot field, a Timestamp field, a Target field, a Nonce field, and/or a Padding+Length field. The one or more invariable portions may correspond to the (second) part of the HashMerkleRoot field, the Timestamp field, the Target field, and/or the Padding+Length field. The one or more variable portions may correspond to the Nonce field. The Nonce field may be incremented across the plural different input messages. In embodiments in which the cryptographic compression function is a second instance cryptographic compression function (SHA2561), the cryptographic compression function may use a message digest (from a first instance cryptographic compression function (SHA2560)) as the initialisation vector.
In embodiments in which the cryptographic compression function is a third instance cryptographic compression function (SHA2562), the plural different input messages to be hashed may each comprise a Message Digest field (from a second instance cryptographic compression function (SHA2561)) and a Padding+Length field. The one or more invariable portions may correspond to the Padding+Length field. The one or more variable portions may correspond to the Message Digest field. In embodiments in which the cryptographic compression function is a third instance cryptographic compression function (SHA2562), the cryptographic compression function may use the SHA256 standard initialisation vector as the initialisation vector.
It will be appreciated that the one or more invariable portions referred to herein will not vary across the plural different input messages to be hashed, i.e. those message portions will be the same in each and every one of the plural different input messages. Moreover, it may be the case that one or more of those invariable portions will always be the same for the cryptographic hashing context (e.g. independent of any Bitcoin Block Header), such as the Padding+Length field. However, it will also be appreciated that one or more of the invariable portions may change for input messages not forming part of the plural different input messages to be processed in the manner of the present invention. For example, one or more of the invariable portions may change if there is an update to the HashPrevBlock field, HashMerkleRoot field, Timestamp field, and/or Target field. In this case, the one or more partially-calculated input values may need to be re-calculated based on a further initial input message for a further set of plural different input messages so as to again be processed in the manner of the present invention.
It will also be appreciated that the one or more variable portions referred to herein will vary across the plural different input messages to be hashed, i.e. those message portions will be different in each and every one of the plural different input messages. For example, as discussed above, those one or more variable portions may be incremented across the plural different input messages.
In embodiments, for the initial input message, the calculation of a partially-calculated input value of the set of one or more partially-calculated input values may comprise performing some, but not all, of the operations in a (e.g. SHA256) message scheduling calculation. The message scheduling calculation may comprise performing:
Thus, for the initial input message, the calculation of a partially-calculated input value of the set of one or more partially-calculated input values may comprise performing one or more of: an add operation; a bitwise rotate right (ROTR) operation; a bitwise shift right (SHR) operation; and a bitwise exclusive OR (⊕) operation.
In embodiments, the message scheduler may be configured to store one or more partially-calculated input values (e.g. in electronic storage such as (but not limited to) registers and/or memory). The message scheduler may be configured to retrieve one or more partially-calculated input values (e.g. from the electronic storage) prior to performing calculations using one or more of the partially-calculated input values.
In embodiments, for a subsequent input message to be hashed, the calculation of a fully-calculated input value of the set of fully-calculated input values may comprise performing some, but not all, of the operations (e.g. performing the remaining operations) in a (e.g. SHA256) message scheduling calculation. Again, the message scheduling calculation may comprise performing:
Thus, for a subsequent input message to be hashed, the calculation of a fully-calculated input value of the set of fully-calculated input values may comprise performing one or more of: an add operation; a bitwise rotate right (ROTR) operation; a bitwise shift right (SHR) operation; and a bitwise exclusive OR (⊕) operation.
In embodiments, for each subsequent input message to be hashed, the calculation of a fully-calculated input value may also comprise adding a round-specific constant to the fully-calculated input value. Adding a round-specific constant may be performed by the message scheduler. Alternatively, adding a round-specific constant may be performed by a message compressor that performs the cryptographic compression function in respect of the subsequent input message.
In embodiments, the message scheduler may be further configured to derive a set of one or more incrementable fully-calculated input values for the cryptographic compression function based on one or more incremented portions of the initial input message to be hashed, wherein the one or more incremented portions will be incremented across the plural different input messages to be hashed. The message scheduler may be further configured to store one or more of the incrementable fully-calculated input values (e.g. in electronic storage such as (but not limited to) registers and/or memory). The message scheduler may be further configured to retrieve the one or more incrementable fully-calculated input values (e.g. from the electronic storage). For each of the one or more subsequent input messages, the process of calculating the set of fully-calculated input values may comprise calculating a set of one or more incremented fully-calculated input values for the cryptographic compression function by incrementing the one or more incrementable fully-calculated input values. The set of one or more incremented fully-calculated input values may then be provided for use when performing the cryptographic compression function in respect of the subsequent input message. The set of one or more incremented fully-calculated input values may also be used as the set of one or more incrementable fully-calculated input values for the next subsequent input message.
In embodiments in which the cryptographic compression function is a first instance cryptographic compression function (SHA2560), the one or more incremented portions may correspond to the Version field. In embodiments in which the cryptographic compression function is a second instance cryptographic compression function (SHA2561), the one or more incremented portions may correspond to the Nonce field.
In embodiments, the message scheduler may be further configured to derive a set of one or more invariable fully-calculated input values for the cryptographic compression function based (e.g. solely) on one or more invariable portions of the initial input message to be hashed, wherein corresponding ones of the invariable portions do not vary across the plural different input messages to be hashed. The message scheduler may be further configured to store one or more of the invariable fully-calculated input values (e.g. in electronic storage such as (but not limited to) registers and/or memory). The message scheduler may be further configured to retrieve the one or more invariable fully-calculated input values (e.g. from the electronic storage). One or more of the invariable fully-calculated input values may, for example, be stored in non-volatile memory. One or more of the invariable fully-calculated input values may also or instead be hardwired, for example in cases where those invariable fully-calculated input values will always be the same for the cryptographic hashing context (e.g. independent of any Bitcoin Block Header). The set of one or more invariable fully-calculated input values may then be provided for use when performing the cryptographic compression function in respect of the subsequent input message.
The Applicants have further identified that, due to the calculation of input values based on an initial input message, certain calculations which are needed when performing full calculation of input values in respect of a subsequent input message can be performed in parallel. This is because some calculations required when calculating the one or more fully-calculated input values for the subsequent input message will already have been performed when calculating the input values for the initial input message. This can allow for parallel calculation of the fully-calculated input values for the subsequent input message.
Thus, in embodiments, calculating the set of one or more fully-calculated input values for a subsequent input message may comprise calculating a first set of fully-calculated input values for the subsequent input message and calculating a second set of fully-calculated input values for the subsequent input message, wherein calculation of the first set of fully-calculated input values is performed in parallel with calculation of the second set of fully-calculated input values. In embodiments, one or more of the first set of fully-calculated input values may be used when calculating one or more of the second set of fully-calculated values and one or more of the second set of fully-calculated input values may be used when calculating one or more of the first set of fully-calculated values. These embodiments can significantly increase the processing speed by introducing parallelism to the message scheduler.
As will be appreciated, where there are variable fully-calculated input values which cannot make use of one or more invariable portions in the manner described herein, calculating the set of fully-calculated input values for a subsequent input message may further comprise fully calculating those variable fully-calculated input values using the full message scheduling calculation.
As will also be appreciated, embodiments may further comprise, for each of one or more subsequent input messages, causing a message compressor to perform the cryptographic compression function in respect of the subsequent input message using the set of fully-calculated input values to generate a message digest. The message digest from one instance may be passed to a subsequent instance (in the case of SHA2560 and SHA2561) or may be compared to the Target (in the case of SHA2562).
Embodiments can be implemented in any desired and suitable data processing apparatus, such as any suitably configured computer-based, processor-based, and/or circuitry-based, system. Similarly, the various functions of the apparatus described herein can be carried out in any desired and suitable manner. For example, the functions of the apparatus described herein may be implemented in hardware and/or software as desired. Thus, unless otherwise indicated, the various functional elements described herein may, for example, comprise a suitable processor or processors, controller or controllers, functional unit or units, circuitry, processing logic, microprocessor arrangements, etc., that are operable to perform the various functions, etc., such as appropriately dedicated hardware elements (processing circuitry) and/or programmable hardware elements (processing circuitry) that are configured to operate in the desired manner. In embodiments, the apparatus may comprise one or more integrated circuits, such as one or more ASICs (Application-Specific Integrated Circuits) and/or FPGAs (Field-Programmable Gate Arrays). In embodiments, the apparatus may comprise, and/or may be in communication with, one or more electronic storage devices that store the data (e.g. input message data, partially-calculated input values, fully-calculated input values, round-specific constants, initialisation vectors, message digests, etc.) as described herein.
By way of example only, embodiments of the present invention will now be described in detail with reference being made to the accompanying drawings in which:
In SHA256, the message scheduler 110 divides the input message 104 into 16×32-bit words M[0]-M[15] and expands those 16×32-bit words to derive a set of 64×32-bit input values W[0]-W[63] for the message compressor 112 in accordance with the following:
The 8 elements HA-HH of the initialisation vector 106 are stored as working variables A-H in electronic storage 114 as follows:
The message compressor 112 then performs 64 rounds of a SHA256 message compression function using the set of input values W[0]-W[63] provided by the message scheduler 110, together with the working variables A-H stored in electronic storage 114 and a set of 64×32-bit round-specific constants K[0]-K[63] in accordance with the following:
After the 64 rounds the following calculations are performed:
With the final message digest (big-endian) being given by:
In SHA256, the standard initialisation vector IV is:
and the round-specific constants K[0]-K[63] are:
In order to perform the cryptographic hashing, a first input message 418 is provided to a first cryptographic hashing module 424. The first cryptographic hashing module 424 then performs a first instance cryptographic hashing SHA2560 of the first input message 418 using the standard initialisation vector IV 422. SHA2560 produces a first message digest H0 which is stored in electronic storage 426. The second input message 420 is provided to a second cryptographic hashing module 428. The second cryptographic hashing module 428 then performs a second instance cryptographic hashing SHA2561 of the second input message 420 using the first message digest H0 as the initialisation vector. SHA2561 produces a second message digest H1 430. The second message digest H1 is combined with a Padding+Length 432 to create a third input message 434 of suitable size for cryptographic hashing using SHA256. In some embodiments, the Padding+Length may again be provided by non-volatile memory or hardwired values since the values in question are always constant. The third input message 434 is provided to a third cryptographic hashing module 438. The third cryptographic hashing module 438 performs a third instance cryptographic hashing SHA2562 of the third input message 434 using the standard initialisation vector IV 436. SHA2562 produces a third, and final, message digest H2 440. If the third message digest H2 meets the Target condition, then the Bitcoin Block Header used to create that message digest H2 can be broadcast to the Bitcoin Network. On the other hand, if the third message digest H2 does not meet the Target condition, then one or more different Bitcoin Block Headers will need to be considered. In this embodiment, the one or more different Bitcoin Block Headers are derived by incrementing the Version field 404 and/or by incrementing the Nonce field 414 so as to give plural different input messages (plural different first input messages 418, plural different second input messages 420, and/or plural different third input messages 434) to be hashed.
Referring again to
Based on the current Target, W[01] and W[02] will remain unchanged as 0x00000000. Additions of these values can be avoided.
σ0(W[01]) and σ0(W[02]) will also remain unchanged as 0x00000000 in view of observation 3 above. Additions of these values can be avoided.
Various reusable values μ[t] can be calculated once for an initial value of W[00], such as 0x20000000, using the space-saving rolled hardware of
For other values of W[00], the reusable values μ[t] can be directly fed into the computation variants CV1-CV7 shown in
Constant-modified reusable values μ′[t]=μ[t]+K[t] can also be computed once for an initial value of W[00], such as 0x20000000, and then reused for other values of W[00] in cases where μ[t]=W[t].
For other values of W[00], the constant-modified reusable values μ′[t] can be directly fed into the message compression function of SHA2560.
The reusable values μ[t] and μ′[t] can be fed into the set of message schedule computation variants in a fully unrolled ASIC hardware implementation 700 to obtain a SHA2560 fully unrolled message schedule as shown in
Keeping the above observations in mind, the following reusable values μ[t] and μ′[t] can be stored for an initial input message and reused for subsequent input messages:
+
+
+ W[00]
+ W[00]
+
+
+
+
It is notable from the above that for t=18, 20, 22, 24-30, 32, 34 and 36, the reusable values μ[t] are partially-calculated versions of input values W[t] or W′[t] for the SHA2560 cryptographic compression function which are calculated using invariable portions of the plural input messages to be hashed. Those reusable values μ[t] are then reused to calculate the fully-calculated input values W[t] or W′[t] for a subsequent input message using values based on one or more variable portions of the input messages to be hashed.
For example, for t=18, the reusable value μ[18]=W[11]+σ0(W[03]) is a partially-calculated version of the fully-calculated input value W[18]=W[11]+σ0(W[03])+W[02]+σ1(W[16]) for the SHA2560 cryptographic compression function which is calculated using only the invariable portions W[11], W[03] and W[02] of the input messages to be hashed. That reusable value μ[18] can then be reused to calculate (using CV3) the fully-calculated input value W[18]=μ[18]+σ1(W[16]) for a subsequent input message using a value σ1(W[16]) which is based on the variable portion W[00] of the input messages to be hashed. Doing this for t=18 saves 2 add operations, 2 ROTR operations, 1 SHR operation and 2 ⊕ operations for each subsequent input message to be hashed.
As will be appreciated, the savings for all values of t will accumulate over time to give a significant reduction in the number of operations and thus processing time/resources required when performing SHA2560. In particular, the following overall savings are possible for each subsequent input message:
Referring again to
The constant-modified reusable values μ′[04]=W[04]+K[04]=0xB956C25B and μ′[15]=W[15]+K[15]=0xC19BF3F4 will forever remain unchanged and independent of any Bitcoin Block Header. They can thus be added to the list of SHA2561 round-specific constants stored in non-volatile memory and directly fed from the non-volatile memory into the message compression function of SHA2561.
Various reusable values μ[t] can be calculated once for an initial value of W[03], such as 0x00000000, using the space-saving rolled hardware of
For other values of W[03], the reusable values μ[t] can be directly fed into the computation variants CV1-CV7 shown in
Constant-modified reusable values μ′[t]=μ[t]+K[t] can also be computed once for an initial value of W[03], such as 0x00000000, and then reused for other values of W[03] in cases where μ[t]=W[t].
For other values of W[03], the constant-modified reusable values p′[t] can be directly fed into the message compression function of SHA2561.
The reusable values μ[t] and μ′[t] can be fed into the set of message schedule computation variants in a fully unrolled ASIC hardware implementation 800 to obtain a SHA2561 fully unrolled message schedule as shown in
The reusable values μ[t] and μ′[t] also allow the parallel computation of the message schedule. This is because the computation of W[t] no longer needs to be serialised since certain W[t] can be computed without the knowledge of the prior W[t]. An example parallel architecture 900 is shown in
Keeping the above observations in mind, the following reusable values μ[t] and μ′[t] can be stored for an initial input message and reused for subsequent input messages:
+
+
+
+
+
+
+
+
+
+ W[02]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
In this embodiment, a first set of calculation modules (one module in the first set is indicated as 906a) and a second set of calculation modules (one module in the second set is indicated as 906b) are also provided for performing the appropriate computation variants as shown in
It is notable from the above that for t=18, 20 and 22-32 the reusable values μ[t] are partially-calculated versions of input values W[t] or W′[t] for the SHA2561 cryptographic compression function which are calculated using invariable portions of the input messages to be hashed. Those reusable values μ[t] are then reused to calculate the fully-calculated input values W[t] or W′[t] for a subsequent input message using values based on one or more variable portions of the input messages to be hashed.
For example, for t=18, the reusable value μ[18]=σ1(W[16])+W[02] is a partially-calculated version of the fully-calculated input value W[18]=W[11]+σ0(W[03])+W[02]+σ1(W[16]) for the SHA2561 cryptographic compression function which is calculated using only the invariable portions W[16], W[11] and W[02] of the input messages to be hashed. That reusable value μ[18] can then be reused to calculate (using CV2) the fully-calculated input value W[18]=μ[18]+σ0(W[03]) for a subsequent input message using a value σ0(W[03]) which is based on the variable portion W[03] of the input messages to be hashed. Doing this for t=18 saves 2 add operations, 2 ROTR operations, 1 SHR operation and 2 ⊕ operations for each subsequent input message to be hashed.
As will be appreciated, the savings for all values of t will again accumulate over time to give a significant reduction in the number of operations and thus processing time/resources required when performing SHA2561. In particular, the following overall savings are possible for each subsequent input message:
Referring again to
The reusable values μ[17]=0x00A00000, μ[23]=0x11002000, and μ[30]=0x00400022 will forever remain unchanged and independent of any Bitcoin Block Header. They can thus be added to the list of SHA2562 round-specific constants stored in non-volatile memory and directly fed from the non-volatile memory into the message compression function of SHA2562.
The constant-modified reusable values p′[08]=W[08]+K[08]=0x5807AA98 and μ′[15]=W[15]+K[15]=0xC19BF274 will forever remain unchanged and independent of any Bitcoin Block Header. They can thus be added to the list of SHA2562 round-specific constants stored in non-volatile memory and directly fed from the non-volatile memory into the message compression function of SHA2562.
Various reusable values μ[t] can be calculated once using the space-saving rolled hardware of
For other input messages (i.e. other values of H1), the reusable values μ[t] can be directly fed into the computation variants CV1-CV7 shown in
The reusable values μ[t] and μ′[t] can be fed into the set of message schedule computation variants in a fully unrolled ASIC hardware implementation 1000 to obtain a SHA2562 fully unrolled message schedule as shown in
W[61] to W[63] need not be implemented in a fully unrolled ASIC implementation. This is because these computations do not fall in the critical path since one can assert a winning Nonce by observing the value of the working variable E at round 61 [t=60].
Keeping the above observations in mind, the following reusable values μ[t] and μ′[t] can be stored for an initial input message and reused for subsequent input messages:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ W[08]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
It is notable from the above that for t=17, 23 and 30 the reusable values μ[t] are partially-calculated versions of input values W[t] or W′[t] for the SHA2562 cryptographic compression function which are calculated using invariable portions of the input messages to be hashed. Those reusable values μ[t] are then reused to calculate the fully-calculated input values W[t] or W′[t] for a subsequent input message using values based on one or more variable portions of the input messages to be hashed.
For example, for t=17, the reusable value μ[17]=σ1(W[15]) is a partially-calculated version of the fully-calculated input value W[17]=W[10]+σ0(W[02])+W[01]+σ1(W[15]) for the SHA2562 cryptographic compression function which is calculated using only the invariable portion W[15] of the input messages to be hashed. That reusable value μ[17] can then be reused to calculate (using CV6) the fully-calculated input value W[17]=μ[17]+σ0(W[02])+W[01] for a subsequent input message using values σ0(W[02]) and W[01] which are based on the variable portions W[02] and W[01] of the input messages to be hashed. Doing this for t=17 saves 1 add operation, 2 ROTR operations, 1 SHR operation and 2 ⊕ operations for each subsequent input message to be hashed.
As will be appreciated, the savings for all values of t will again accumulate over time to give a significant reduction in the number of operations and thus processing time/resources required when performing SHA2562. In particular, the following overall savings are possible for each subsequent input message:
It will accordingly be appreciated from the above that embodiments of the present invention can greatly increase speed and efficiency when performing cryptographic hashing in respect of plural different input messages which have invariable portions and variable portions.
Number | Date | Country | Kind |
---|---|---|---|
2113962.1 | Sep 2021 | GB | national |
This application is the U.S. national stage application of International Application No. PCT/GB2022/052458, filed Sep. 28, 2022, which international application was published on Apr. 6, 2023, as WO 2023/052762 A1 in the English language. The International Application claims priority to Great Britain Patent Application No. 2113962.1, filed Sep. 29, 2021. The international application and Great Britain application are incorporated herein by reference, in their entireties.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/GB2022/052458 | 9/28/2022 | WO |