* Illustration by John Tenniel, from Alice's Adventures in Wonderland, of Alice swimming in the pool of tears

ANF Bit

Greg Whitehead @grwster 20140929193436000

Have you ever wondered how individual input bits affect the output of the SHA-256 hash function?

Probably not... but I did, so I wrote a computer algebra system for bitwise boolean logic and implemented SHA-256 on top of it.

This is the SHA-256 hash of a single variable bit 'a' (^ = xor):

10111(1^a)01a10a111(1^a)10a1111a(1^a)aa11a0a(1^a)a(1^a)1(1^a)(1^a)101a110(1^a)1a(1^a)aa011a00110(1^a)1(1^a)0(1^a)a101(1^a)0(1^a)a01(1^a)0a(1^a)a0100a0(1^a)(1^a)(1^a)0(1^a)10aa11a(1^a)(1^a)0(1^a)0a11aaa(1^a)1(1^a)(1^a)(1^a)(1^a)(1^a)(1^a)11a(1^a)(1^a)010(1^a)(1^a)101a(1^a)(1^a)11(1^a)1a(1^a)00(1^a)aa1(1^a)1(1^a)(1^a)110(1^a)01a1a(1^a)a(1^a)011a00(1^a)(1^a)1(1^a)(1^a)1000010a0(1^a)(1^a)(1^a)1aa(1^a)0(1^a)01(1^a)10a(1^a)a11(1^a)10110aa(1^a)a(1^a)0(1^a)0a(1^a)1aaa011a0(1^a)(1^a)(1^a)0(1^a)101a(1^a)aaa(1^a)0(1^a)a(1^a)aa01(1^a)a(1^a)1(1^a)0(1^a)01

This is the first bit of the SHA-256 hash of eight variable bits 'abcdefgh':

(b^ac^d^abd^cd^bcd^abcd^e^ae^abe^ce^abce^ade^bde^abde^bcde^abcde^f^abf^cf^bcf^df^adf^bdf^cdf^bcdf^ef^aef^acef^adef^bdef^abdef^abcdef^g^bg^bcg^abcg^dg^abdg^cdg^acdg^bcdg^abcdg^aeg^abeg^ceg^bceg^abceg^adeg^cdeg^acdeg^bcdeg^abcdeg^bfg^acfg^dfg^bdfg^abdfg^cdfg^bcdfg^acefg^bcefg^defg^abdefg^cdefg^acdefg^bcdefg^bh^abh^ch^ach^abch^dh^abdh^abcdh^eh^beh^ceh^aceh^bceh^adeh^abfh^acfh^adfh^abdfh^cdfh^acdfh^bcdfh^abcdfh^efh^aefh^cefh^bcefh^abcefh^adefh^bdefh^abdefh^acdefh^bcdefh^abcdefh^gh^bgh^cgh^bcgh^abcgh^abdgh^cdgh^acdgh^abcdgh^egh^aegh^begh^abegh^cegh^acegh^adegh^bdegh^abdegh^acdegh^afgh^acfgh^bcfgh^dfgh^bdfgh^abdfgh^acdfgh^bcdfgh^efgh^aefgh^befgh^acefgh^bcefgh^abcefgh^defgh^bdefgh^acdefgh^abcdefgh)