2
$\begingroup$

I understand that the word size is the internal "working package size" below the block size of a cryptographic hash function (and a block cipher), as each block is broken into words an than processed round-based. Does this size have any practical relevance when using that function? For instance do algorithms with 64b word size perform better on 64b machines? Or does aligning the message-to-hash at the word size have any impact?

$\endgroup$
1
  • 2
    $\begingroup$ It is mainly a performance thing, although some algorithms can be bit-sliced to perform well on smaller word size processors, such as Keccak. SHA-512 can not be bit-sliced as far as I am aware, and has poor performance with 32-bit calculations. Be aware in these cases that a 32-bit processor can still perform 64-bit calculations if it has the appropriate instructions and registers. $\endgroup$ Commented Mar 10, 2014 at 9:46

1 Answer 1

2
$\begingroup$

Yes, the internal word size of a hash algorithm has some significance, pretty much for the reasons given in the question.

Algorithms with 64-bit word size have a (typically sizable) performance edge on 64-bit machines (more precisely: for large messages, and comparable implementations, the ratio of the number of bytes hashed in a given time over that for a comparable algorithm with 32-bit word size will likely be significantly higher using a 64-bit machine and making good use of the architecture, than this ratio is on a 32-bit machine). For this reason we have SHA-512/256, a 256-bit hash obtained by truncating to 256-bit a natively 512-bit hash with internal 64-bit word size: on a 64-bit machine, SHA-512/256 can be faster than SHA-256, a natively 256-bit hash with internal 32-bit word size. See this for more details.

And, on most machines, there is some (typically small) performance penalty if the message to hash is not aligned to the native word size.

$\endgroup$
1
  • 2
    $\begingroup$ For more real world performance numbers of SHA256 vs SHA512 see my chart at en.wikipedia.org/wiki/SHA-2 which compares performance on modern processors with optimized algorithms $\endgroup$ Commented Mar 11, 2014 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.