1 /*************************** sha-private.h ***************************/
2 /********************** See RFC 4634 for details *********************/
3 #ifndef _SHA_PRIVATE__H
4 #define _SHA_PRIVATE__H
6 * These definitions are defined in FIPS-180-2, section 4.1.
7 * Ch() and Maj() are defined identically in sections 4.1.1,
10 * The definitions used in FIPS-180-2 are as follows:
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)))
17 #else /* USE_MODIFIED_MACROS */
19 * The following definitions are equivalent and potentially faster.
22 #define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z))
23 #define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
24 #endif /* USE_MODIFIED_MACROS */
26 #define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z))
28 #endif /* _SHA_PRIVATE__H */