I'm learning about cryptographic hash functions and know why certain boolean functions were chosen to be used in the compression function of cryptographic hash functions (older question).

Hash functions like MD5, SHA-1 and SHA-2 all use boolean function with three inputs. However, SHA-2 uses two functions per round.

SHA-2 uses the following functions in every round:

$f_{1}(B,C,D)=(B\wedge C)\lor(D\wedge \lnot B)$

$f_{2}(B,C,D)=(B\wedge C)\oplus(B\wedge D)\oplus(C\wedge D)$

I do not understand why boolean functions with three inputs are used. Why not use a boolean function with 4, 5 or 6 inputs? Why does SHA-2 use two three valued functions per round, why not one six valued function? If the functions are balanced, good for diffusion and not fully linear, it should not make a difference.

  • $\begingroup$ Strictly speaking these are vector boolean functions (vector input, vector output) of the form $$f:\mathbb{F}_2^{3m}\rightarrow \mathbb{F}_2^m,$$ where $m=32.$ One plausible reason may be the difficulty of analysing vector boolean functions more than three inputs. $\endgroup$
    – kodlu
    Dec 5, 2016 at 7:05
  • $\begingroup$ This question should be closed, because there is no clear answer why this and not a different design was chosen (thus making it opinion-based). $\endgroup$
    – tylo
    Dec 5, 2016 at 13:29
  • $\begingroup$ This question is not almost entirely based on opinions, but instead requires facts, references, or specific expertise. Just because my question might not have a clear answer, does not mean it is opinion-based. $\endgroup$
    – Cartman123
    Dec 5, 2016 at 16:59
  • $\begingroup$ Agreed. The question is clear and objective, even if clear and objective answers may be difficult. $\endgroup$
    – otus
    Dec 6, 2016 at 7:10


Your Answer

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

Browse other questions tagged or ask your own question.