** Initialize a new hash. iSize determines the size of the hash ** in bits and should be one of 224, 256, 384, or 512. Or iSize ** can be zero to use the default hash size of 256 bits. */
| 1795 | ** can be zero to use the default hash size of 256 bits. |
| 1796 | */ |
| 1797 | static void SHA3Init(SHA3Context *p, int iSize){ |
| 1798 | memset(p, 0, sizeof(*p)); |
| 1799 | if( iSize>=128 && iSize<=512 ){ |
| 1800 | p->nRate = (1600 - ((iSize + 31)&~31)*2)/8; |
| 1801 | }else{ |
| 1802 | p->nRate = (1600 - 2*256)/8; |
| 1803 | } |
| 1804 | #if SHA3_BYTEORDER==1234 |
| 1805 | /* Known to be little-endian at compile-time. No-op */ |
| 1806 | #elif SHA3_BYTEORDER==4321 |
| 1807 | p->ixMask = 7; /* Big-endian */ |
| 1808 | #else |
| 1809 | { |
| 1810 | static unsigned int one = 1; |
| 1811 | if( 1==*(unsigned char*)&one ){ |
| 1812 | /* Little endian. No byte swapping. */ |
| 1813 | p->ixMask = 0; |
| 1814 | }else{ |
| 1815 | /* Big endian. Byte swap. */ |
| 1816 | p->ixMask = 7; |
| 1817 | } |
| 1818 | } |
| 1819 | #endif |
| 1820 | } |
| 1821 | |
| 1822 | /* |
| 1823 | ** Make consecutive calls to the SHA3Update function to add new content |
no outgoing calls
no test coverage detected