1 /************************ sha-private.h ************************/ 2 /***************** See RFC 6234 for details. *******************/ 3 #ifndef _SHA_PRIVATE__H 4 #define _SHA_PRIVATE__H 5 /* 6 * These definitions are defined in FIPS 180-3, section 4.1. 7 * Ch() and Maj() are defined identically in sections 4.1.1, 8 * 4.1.2, and 4.1.3. 9 * 10 * The definitions used in FIPS 180-3 are as follows: 11 */ 12 13 #ifndef USE_MODIFIED_MACROS 14 #define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) 15 #define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) 16 #else /* USE_MODIFIED_MACROS */ 17 /* 18 * The following definitions are equivalent and potentially faster. 19 */ 20 21 #define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z)) 22 #define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) 23 24 #endif /* USE_MODIFIED_MACROS */ 25 26 #define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z)) 27 28 #endif /* _SHA_PRIVATE__H */ 29 30