MCPcopy Create free account
hub / github.com/InoriRus/Kyty / SHA3Update

Function SHA3Update

source/3rdparty/sqlite/src/shell.c:1741–1773  ·  view source on GitHub ↗

** Make consecutive calls to the SHA3Update function to add new content ** to the hash */

Source from the content-addressed store, hash-verified

1739** to the hash
1740*/
1741static void SHA3Update(
1742 SHA3Context *p,
1743 const unsigned char *aData,
1744 unsigned int nData
1745){
1746 unsigned int i = 0;
1747#if SHA3_BYTEORDER==1234
1748 if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
1749 for(; i+7<nData; i+=8){
1750 p->u.s[p->nLoaded/8] ^= *(u64*)&aData[i];
1751 p->nLoaded += 8;
1752 if( p->nLoaded>=p->nRate ){
1753 KeccakF1600Step(p);
1754 p->nLoaded = 0;
1755 }
1756 }
1757 }
1758#endif
1759 for(; i<nData; i++){
1760#if SHA3_BYTEORDER==1234
1761 p->u.x[p->nLoaded] ^= aData[i];
1762#elif SHA3_BYTEORDER==4321
1763 p->u.x[p->nLoaded^0x07] ^= aData[i];
1764#else
1765 p->u.x[p->nLoaded^p->ixMask] ^= aData[i];
1766#endif
1767 p->nLoaded++;
1768 if( p->nLoaded==p->nRate ){
1769 KeccakF1600Step(p);
1770 p->nLoaded = 0;
1771 }
1772 }
1773}
1774
1775/*
1776** After all content has been added, invoke SHA3Final() to compute

Callers 4

SHA3FinalFunction · 0.70
sha3FuncFunction · 0.70
hash_step_vformatFunction · 0.70
sha3QueryFuncFunction · 0.70

Calls 1

KeccakF1600StepFunction · 0.70

Tested by

no test coverage detected