MCPcopy Create free account
hub / github.com/audacity/audacity / SHA3Init

Function SHA3Init

lib-src/sqlite/shell.c:1797–1820  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

1795** can be zero to use the default hash size of 256 bits.
1796*/
1797static 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

Callers 2

sha3FuncFunction · 0.85
sha3QueryFuncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected