2
$\begingroup$

From wikipedia: "They differ in the word size; SHA-256 uses 32-bit words where SHA-512 uses 64-bit words."

In this context what do they mean with words? is it the same as a 32 bit (or 64 bit) block in a block cipher? just simply the size in which it divides up it's input?

$\endgroup$
5
$\begingroup$

Word size is not a term originating in cryptography. Rather it is a term which came from the area of computer architecture. Here it specifies either how many bits are transferred over a bus at a time or the size of a register.

When used in the description of cryptographic primitives (such as a compression function or a block cipher), it covers the size of the variables in the definition of the primitive. Ideally these variable sizes line up with the register size of the CPU they are going to be executed on.

In case of the SHA-2 family, the internal state is always 8 words, and the block size is always 16 words. The word size is either 32 bits or 64 bits.

This is why on a 32 bit CPU SHA-224 and SHA-256 are faster than the other variants, but on a 64 bit CPU they are slower than the other variants.

$\endgroup$
  • 1
    $\begingroup$ Great and clear explanation, also explains why SHA-512 is faster than SHA-256 on 64 bit pc, which I found counter intuitive. $\endgroup$ – Vincent Apr 30 '15 at 10:28
3
$\begingroup$

The word size in hash functions means the size of the integral unit of operation for the internal transformations.

For example: for SHA-512, you'll get some input, split it and then perform operations on 64-bit words (=unsigned integers, like modulo addition or shift) whereas for SHA-256 you'll use 32-bit operations (= operations on 32-bit-integers, like modulo addition or shift).

The name "word" is derived from machine word which refers to the "natural unit of data used by a particular processor design". In this case though it is the natural unit for the hash function.

$\endgroup$
  • $\begingroup$ So simply the same as block size for block ciphers. $\endgroup$ – Vincent Apr 30 '15 at 7:39
  • 1
    $\begingroup$ no, not the same as the block size $\endgroup$ – Richie Frame Apr 30 '15 at 7:42
  • 1
    $\begingroup$ more like the smallest unit used while scrambling the block. $\endgroup$ – SEJPM Apr 30 '15 at 7:44
  • 3
    $\begingroup$ @VincentAdvocaat The block size within the SHA-512 is larger than 64 bit. The block size is already part of the hash design; the word size is used in turn to process the blocks. $\endgroup$ – Maarten Bodewes Apr 30 '15 at 7:48
  • 1
    $\begingroup$ @MaartenBodewes In fact the block size in SHA-2 is exactly 16 words, and the internal state is 8 words. That is true for all the variants. $\endgroup$ – kasperd Apr 30 '15 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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